Skip to content
Ask AI

Logical Interfaces

Please refer to VLAN.

Please refer to LAG .

Table 1 Sub-interface Status View

CommandPurpose
show sub-interface [ethernet interface_name.subinterface-number]Display information about the status of subinterfaces.
show {ip|ipv6} interfacesDisplay IP address configuration of subinterfaces.

show sub-interface [ethernet interface_name.subinterface-number]

Section titled “show sub-interface [ethernet interface_name.subinterface-number]”

[Command]

show sub-interface [ethernet interface_name.subinterface-number]

[Purpose]

Display information about the status of subinterfaces.

[Parameters]

ParameterDescription
interface_nameParent interface name. (eg.0/1)
subinterface-numberSubinterface number.

[View]

Privileged User View

[Use Cases]

sonic# show sub-interface
Sub port interface Speed MTU vlan Admin Type
-------------------- ------- ----- ------ ------- --------------------
0/0.2 25G 9100 2 up 802.1q-encapsulation

[Command]

show {ip|ipv6} interfaces

[Purpose]

Display IP address configuration of subinterfaces.

[View]

Privileged User View

[Use Cases]

sonic# show ip interfaces
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
----------- -------- ------------------- ------------ -------------- -------------
0/0.2 2.0.0.1/24 up/down N/A N/A
0/48 199.0.3.1/24 up/up N/A N/A
0/52 199.0.7.1/24 up/up N/A N/A
loopback0 10.1.0.34/32 up/up N/A N/A
mgmt 10.250.0.138/24 up/up N/A N/A

Table 2 Subinterface Config

CommandPurpose
interface {ethernet|link-aggregation} interface_name.subinterface-numberCreate a subinterface.
mtu mtuConfigure the MTU value on a subinterface.
shutdownBring the subinterface down administratively.
ip address {A.B.C.D/M|A::B/M} [secondary]Configure IP address for the subinterface.
mac_address HH:HH:HH:HH:HH:HHSpecify a MAC address to the subinterface.
Section titled “interface {ethernet|link-aggregation} interface_name.subinterface-number”

[Command]

interface {ethernet|link-aggregation} interface_name.subinterface-number

[Purpose]

Create a subinterface.

[Parameters]

ParameterDescription
interface_nameParent interface name. (eg.0/1)
subinterface-numberSubinterface number.

[View]

Global Configuration View

[Notes]

Run command no interface {ethernet|link-aggregation} interface_name.subinterface-number to delete the subinterface.

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 0/1.1
sonic(config-if-0/1.1)# show this
!
interface ethernet 0/1.1
sonic(config)# no interface ethernet 0/1.1

[Command]

mtu mtu

[Purpose]

Configure the MTU value on a subinterface.

[Parameters]

ParameterDescription
mtuMaximum Transmission Unit, the range is from 1312 to 9216. The default is 9216 Bytes.

[View]

Subinterface Configuration View

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 0/1.1
sonic(config-if-0/1.1)# mtu 2000
sonic(config-if-0/1.1)# show this
!
interface ethernet 0/1.1
mtu 2000

[Command]

shutdown

[Purpose]

Bring the subinterface down administratively.

[View]

Subinterface Configuration View

[Notes]

Run command no shutdown to bring the sub-interface up administratively.

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 0/1.1
sonic(config-if-0/1.1)# shutdown
sonic(config-if-0/1.1)# show this
!
interface ethernet 0/1.1
shutdown

[Command]

ip address {A.B.C.D/M|A::B/M} [secondary]

[Purpose]

Configure IP address for the subinterface.

[Parameters]

ParameterDescription
A.B.C.D/MIPv4 address with prefix length.
A::B/MIPv6 address with prefix length.
secondaryThe default is Primary IP, specifying this option means configuring as Secondary IP, which requires that the Secondary IP and Primary IP be in the same network segment.

[View]

Subinterface Configuration View

[Notes]

IPv4 address with subnet mask /32 is not allowed to be configured. Addresses with subnet mask /31 is allowed. In other subnet masks, addresses with the host portion all-zeros or all-ones are not allowed. IPv6 address with subnet mask /127 or /128 is not allowed to be configured. In other subnet masks, addresses with the host portion all-zeros are not allowed, but all-ones are allowed. Run command no ip address {A.B.C.D/M|A::B/M} [secondary]to delete IP address configuration of the subinterface.

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 0/2.2
sonic(config-if-0/2.2)# ip address 3.3.3.6/24
sonic(config-if-0/2.2)# show this
!
interface ethernet 0/2.2
ip address 3.3.3.6/24

[Command]

mac_address HH:HH:HH:HH:HH:HH

[Purpose]

Specify a MAC address to the subinterface.

[Parameters]

ParameterDescription
HH:HH:HH:HH:HH:HHMAC address, not case sensitive.

[View]

Subinterface Configuration View

[Notes]

The default is the MAC of the switch. Run command no mac_address to restore the MAC of the sub-interface to default.

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 0/2.2
sonic(config-if-0/2.2)# mac-address 18:17:25:37:67:af
sonic(config-if-0/2.2)# show this
!
interface ethernet 0/2.2
mac-address 18:17:25:37:67:af

Table 3 Loopback View

CommandPurpose
show {ip|ipv6} interfacesDisplay IP address configuration of loopback interfaces.

[Command]

show {ip|ipv6} interfaces

[Purpose]

Display IP address configuration of loopback interfaces.

[View]

Privileged User View

[Use Cases]

sonic# show ip interfaces
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
----------- -------- ------------------- ------------ -------------- -------------
0/48 199.0.3.1/24 up/up N/A N/A
0/52 199.0.7.1/24 up/up N/A N/A
0/72 10.72.0.1/24 up/up N/A N/A
loopback0 10.1.0.34/32 up/up N/A N/A
mgmt 10.250.0.138/24 up/up N/A N/A

Table 4 Loopback Config

CommandPurpose
interface loopback loopback-idEnter Loopback Interface Configuration View.
ip address {A.B.C.D/M|A::B/M}Configure IP address for the loopback interface.

[Command]

interface loopback loopback-id

[Purpose]

Enter Loopback Interface Configuration View

[Parameters]

ParameterDescription
loopback-idLoopback interface number, integer form, range from 0 to 999.

[View]

Global Configuration View

[Notes]

Loopback0 has been created by default and cannot be deleted. Run command no interface loopback loopback-id to delete loopback interface.

[Use Cases]

sonic# configure terminal
sonic(config)# interface loopback 1
sonic(config-loif-1)# show this
!
interface loopback 1

[Command]

ip address {A.B.C.D/M|A::B/M}

[Purpose]

Configure IP address for the loopback interface.

[Parameters]

ParameterDescription
A.B.C.D/MIPv4 address with prefix length.
A::B/MIPv6 address with prefix length.

[View]

Loopback Interface Configuration View

[Notes]

Run command no ip address {A.B.C.D/M|A::B/M} to delete IP address configuration of the loopback interface.

[Use Cases]

sonic# configure terminal
sonic(config)# interface loopback 2
sonic(config-loif-2)# ip address 3.3.3.6/24
sonic(config-loif-2)# show this
!
interface loopback 2
ip address 3.3.3.6/24