Layer 2 Subinterface Configuration
This chapter contains examples of configuring L2 Subinterfaces.
A single physical interface when required to handle multiple VLAN traffic, can be divided into multiple logical interfaces called sub-interfaces.
All sub-interfaces under the physical port will use their parent port for sending and receiving data.
Sub-interfaces let you divide a physical interface into multiple logical interfaces that are tagged with different VLAN identifiers. Because VLANs allow you to keep traffic separate on a given physical interface, you can increase the number of interfaces available to your network without adding additional physical interfaces.
Note: Refer to the release note for features supported by L2 Sub-interface.
Topology
Below figure shows and example of subinterface configuration for one node with cross-connect. In this example, there is one router R1 with 2 connections
The xe1.10 and xe2.10 subinterface is created on R1
Sub-interface can be created over physical or LAG interfaces.
Note: Use dot1ad ethertype (0x8100 | 0x88a8 | 0x9100 | 0x9200) command to configure the service-tpid value on parent port of a subinterface. By this the tpid used for service tag for a subinterface may be inherited from the one applied to parent interface.
Note: For any dot1ad subinterface to be functional, dot1ad ethertype should be set to desired value as 0x88a8/0x9100/0x9200. Default value is 8100. To verify the ethertype value for the interface use show interface <subinterface> command.
Configure L2 Subinterface with cross-connect
#configure terminal | Enter configure mode. |
(config)#interface xe1 | Enter interface mode |
(config-if)# dot1ad ethertype 0x88a8 | Configure interface with tpid value as 88a8 |
(config-if)#exit | Exit interface mode. |
(config)#interface xe1.10 switchport | Creates a L2 sub-interface as xe1.10 |
(config-if)#encapsulation dot1q 10 | Configure the encapsulation as dot1q matching vlan 10 |
(config-if)#exit | Exit interface mode. |
(config)#interface xe2 | Enter interface mode |
(config-if)# dot1ad ethertype 0x88a8 | Configure interface with tpid value as 88a8 |
(config-if)#exit | Exit interface mode. |
(config-if)#interface xe2.10 switchport | Creates a L2 sub-interface as xe2.10 |
(config-if)#encapsulation dot1q 10 | Configure the encapsulation as dot1q matching vlan 10 |
(config-if)#exit | Exit interface mode. |
(config)# cross-connect CC1 | Create cross-connect with name CC1 |
(config-xc)# interface xe1.10 | Attach interface xe1.10 |
(config-xc)# interface xe2.10 | Attach interface xe2.10 |
(config-xc)#exit | Exit cross-connect mode. |
(config)#commit | Commit the transaction. |
Configure L2 Subinterface(Double-Push) with cross-connect
#configure terminal | Enter configure mode. |
(config)#interface xe1.10 switchport | Creates a L2 sub-interface as xe1.10 |
(config-if)#encapsulation untagged | Configure the encapsulation as untagged |
(config-if)# rewrite push 0x8100 200 inner-dot1q 200 | Configure rewrite push with inner vlan 200 and outer vlan 200 |
(config-if)#exit | Exit interface mode |
(config)#interface xe2.10 switchport | Creates a L2 sub-interface as xe2.10 |
(config-if)# encapsulation dot1ad 200 inner-dot1q 200 | Configure the encapsulation with inner vlan 200 and outer vlan 200 |
(config-if)#exit | Exit interface mode |
(config)# cross-connect CC1 | Create cross-connect with name CC1 |
(config-xc)# interface xe1.10 | Attach interface xe1.10 |
(config-xc)# interface xe2.10 | Attach interface xe2.10 |
(config-xc)#exit | Exit cross-connect mode. |
(config)#commit | Commit the transaction. |
Configure L2 Subinterface(Double-Pop) with cross-connect
#configure terminal | Enter configure mode. |
(config)##interface xe1.10 switchport | Creates a L2 sub-interface as xe1.10 |
(config-if)#encapsulation untagged | Configure the encapsulation as untagged |
(config-if)#exit | Exit interface mode |
(config)#interface xe2.10 switchport | Creates a L2 sub-interface as xe2.10 |
(config-if)# encapsulation dot1ad 200 inner-dot1q 200 | Configure the encapsulation with inner vlan 200 and outer vlan 200 |
(config-if)# rewrite pop-2tag | Configure rewrite pop-2tag |
(config-if)#exit | Exit interface mode |
(config)# cross-connect CC1 | Create cross-connect with name CC1 |
(config-xc)# interface xe1.10 | Attach interface xe1.10 |
(config-xc)# interface xe2.10 | Attach interface xe2.10 |
(config-xc)#exit | Exit cross-connect mode. |
(config)#commit | Commit the transaction. |
Creating a Subinterface with Encapsulation
Single encapsulation as dot1q with vlan range
configure terminal (config)#interface xe1.100 switchport
(config-if)# encapsulation dot1q 100-200
Single encapsulation as dot1ad with vlan range
configure terminal (config)#interface xe1.100 switchport
(config-if)# encapsulation dot1ad 100-200
Double encapsulation as dot1q
configure terminal (config)#interface xe1.100 switchport
(config-if)# encapsulation dot1q 10 inner-dot1q 10
Double encapsulation as dot1ad
configure terminal (config)#interface xe1.200 switchport
(config-if)# encapsulation dot1ad 20 inner-dot1q 20
Encapsulation as default
configure terminal (config)#interface xe1.101 switchport
(config-if)# encapsulation default
Encapsulation as untagged
configure terminal (config)#interface xe1.102 switchport
(config-if)# encapsulation untagged
Rewrite with push
configure terminal (config)#interface xe1.10 switchport
(config-if)# encapsulation dot1q 10
(config-if)# rewrite push 0x8100 100
(config-if)#interface xe2.20 switchport
(config-if)# encapsulation dot1q 100 inner-dot1q 10
(config-if)#exit
(config)# cross-connect CC1
(config-xc)# interface xe1.10
(config-xc)# interface xe2.10
Note: For incoming traffic at sub-interface “interface IFNAME”, the "rewrite push" will add VLAN tag with TPID values 8100.
Note: For outgoing traffic at sub-interface "interface IFNAME", the "rewrite push" will pop the VLAN. The egress pop removes whatever outer VLAN tag is present, regardless of its value. This is not restricted to VLAN 100.
Rewrite with translate
configure terminal (config)# interface xe1
(config-if)# dot1ad ethertype 0x9100
(config-if)#interface xe1.10 switchport
(config-if)# encapsulation dot1ad 200
(config-if)# rewrite translate 1-to-1 0x9100 100
(config-if)#interface xe2
(config-if)# dot1ad ethertype 0x9100
(config-if)#interface xe2.20 switchport
(config-if)# encapsulation dot1ad 100
(config-if)#exit
(config)# cross-connect CC1
(config-xc)# interface xe1.10
(config-xc)# interface xe2.10
Note: For incoming and outgoing traffic at sub-interface “interface IFNAME”, the "rewrite translate" will update VLAN tag with TPID values 9100.
Rewrite with pop
#configure terminal (config)#interface xe1.10 switchport
(config-if)# encapsulation dot1q 100
(config-if)# rewrite pop
(config-if)#interface xe2.20 switchport
(config-if)# encapsulation untagged
(config-if)#exit
(config)# cross-connect CC1
(config-xc)# interface xe1.10
(config-xc)# interface xe2.10
Note: For incoming traffic at sub-interface “interface IFNAME”, the "rewrite pop" will pop the vlan.
Note: For outgoing traffic at sub-interface “interface IFNAME”, the "rewrite pop" will add VLAN tag with TPID values 8100.
Note: Push, pop and translate rewrite operations are supported with tpid values 8100/88a8/9100/9200 as symmetric operation.
No subinterfaces
#configure terminal (config)#interface xe1
(config-if)# no subinterfaces
Note: no Subinterfaces will remove all the Subinterfaces.
Note: Same physical interface will support both L2 and L3 subinterfaces.
L2SI Statistics
Enable below commands to get L2SI statistics
#configure terminal (config)# hardware-profile statistics ac-lif enable
Note: Reload the node, and then only statistics command will get effective.
Verification commands
Subinterfaces appear as any physical interface in the show running-config or the show ip interface brief output and can be configured as any other interface.
The following examples display subinterface information from various show commands.
show interface brief
R1#show interface brief | include xe1
xe1 ETH -- routed up none 10g --
xe1.10 SUBINTERFACE up -- N/A
show interface <>
R1#show interface xe1.10
Interface xe1.10
Hardware is SUBINTERFACE Current HW addr: b86a.97d0.25c5
Physical:(Not Applicable) Logical:(not set)
Port Mode is Switch
Interface index: 20484106
Metric 1
<UP,BROADCAST,RUNNING,MULTICAST>
VRF Binding: Not bound
Encapsulation Dot1q (0x8100) Virtual LAN
Outer Match: Dot1q VLAN 10
Label switching is disabled
No Virtual Circuit configured
Administrative Group(s): None
Bandwidth 1g
DHCP client is disabled.
Last Flapped: Never
Statistics last cleared: Never
RX
unicast packets 0 multicast packets 0 broadcast packets 0
input packets 0 bytes 0
jumbo packets 0
undersize 0 oversize 0 CRC 0 fragments 0 jabbers 0
input error 0
input with dribble 0 input discard 0
Rx pause 0
TX
unicast packets 0 multicast packets 0 broadcast packets 0
output packets 0 bytes 0
jumbo packets 0
output errors 0 collision 0 deferred 0 late collision 0
output discard 0
Tx pause 0
show cross-connect
R1#show cross-connect
cross-connect status
XC name Ep1 Ep2 Status
-----------------------------+----------------+----------------+-------
CC1 xe1.10 xe2.10 UP
-----------------------------+----------------+----------------+-------
AC cross-connect summary
Total : 1
Up : 1
Down : 0
R1#show running-config interface xe1
!
interface xe1
dot1ad ethertype 0x88a8
!
R1#show run interface xe1.10
!
interface xe1.10 switchport
encapsulation dot1q 10
rewrite push 0x8100 10
!
R1#show running-config interface xe1
!
interface xe2
dot1ad ethertype 0x88a8
!
R1#show run interface xe2.10
!
interface xe2.10 switchport
encapsulation dot1q 10
!
show interface xe1.10 counters
R1#show interface xe1.10 counters
Interface xe1.10
Rx Packets: 50000
Rx Bytes: 50000000
R1#show interface xe2.10 counters
Interface xe2.10
Tx Packets: 50000
Tx Bytes: 49900000