How to configure subinterface

How to configure subinterface

Sub-Interface: 

Sub interfaces divide the parent interface into two or more virtual interfaces on which you can assign unique Layer 3 parameters such as IP addresses and dynamic routing protocols. The IP address for each sub interface should be in a different subnet from any other sub interface on the parent interface.  

 

Tested model & firmware version: 

  • Switch model name: 

Accton-AS5712-54X 

  • Community sonic version: 

202211.2 

 

NOTE: 

  • There is no L2 bridging across these subport interfaces; each subport interface is regarded to be in its own bridge domain. 

  • The MTU of the sub-interface will not be configured; instead, it will inherit the value of the parent interface. 

  • Parent interface is not a router port and should be a physical port or a port-channel. 

  • The VLAN cannot be utilised for a standard VLAN if the sub-interface is using it. 

 

SUB INTERFACE WITH IP: 

TOPOLOGY: 

        

Configuration commands (sonic configurations): 

Note: Commands are to be executed in sudo mode. 

 Step: Configure an IP address for sub interfaces as per topology. 

Router1:  

root@sonic:/home/admin# config interface ip add Ethernet48.1 10.1.1.1/24 

Router2: 

root@sonic:/home/admin# config interface ip add Ethernet48.1 10.1.1.2/24 

 

VALIDATION (SONIC SHOW OUTPUTS) 

  • Subinterfaces and IP information. 

Router1: 

root@sonic:/home/admin# show subinterfaces status 

  Sub port interface    Speed    MTU    Vlan    Admin                  Type 

--------------------  -------  -----  ------  -------  -------------------- 

        Ethernet48.1      10G   9100       1       up  802.1q-encapsulation 

 

root@sonic:/home/admin# show ip interfaces 

  

Interface    Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP 

-----------  --------  -------------------  ------------  --------------  ------------- 

Ethernet48.1           10.1.1.1/24          up/up         N/A             N/A 

Loopback1              2.2.2.2/32           up/up         N/A             N/A 

docker0                240.127.1.1/24       up/down       N/A             N/A 

eth0                   172.26.1.81/24       up/up         N/A             N/A 

lo                     127.0.0.1/16         up/up         N/A             N/A 

 

 

Router2: 

root@sonic:/home/admin# show subinterfaces status 

  Sub port interface    Speed    MTU    Vlan    Admin                  Type 

--------------------  -------  -----  ------  -------  -------------------- 

        Ethernet48.1      10G   9100       1       up  802.1q-encapsulation 

 

root@sonic:/home/admin# show ip interfaces 

  

Interface    Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP 

-----------  --------  -------------------  ------------  --------------  ------------- 

Ethernet48.1           10.1.1.2/24          up/up         N/A             N/A 

Loopback1              2.2.2.2/32           up/up         N/A             N/A 

docker0                240.127.1.1/24       up/down       N/A             N/A 

eth0                   172.26.1.82/24       up/up         N/A             N/A 

lo                     127.0.0.1/16         up/up         N/A             N/A 

 

 

  • Ping Router1(Ethernet48.1) to Router2(Ethernet48.1). 

root@sonic:/home/admin# ping 10.1.1.2 

PING 10.1.1.2 (10.1.1.2) 56(84) bytes of data. 

64 bytes from 10.1.1.2: icmp_seq=1 ttl=64 time=0.480 ms 

  

--- 10.1.1.2 ping statistics --- 

1 packets transmitted, 1 received, 0% packet loss, time 0ms 

rtt min/avg/max/mdev = 0.480/0.480/0.480/0.000 ms 

root@sonic:/home/admin# show arp 

Address       MacAddress         Iface         Vlan 

------------  -----------------  ------------  ------ 

10.1.1.2      04:f8:f8:81:da:8c  Ethernet48.1  - 

 

 

SUB INTERFACE WITH IP and VLAN: 

TOPOLOGY: 

         


Configuration commands (sonic configurations): 

Note: Commands are to be executed in sudo mode. 

Router1:  Configure an IP address for sub interfaces as per topology. 

root@sonic:/home/admin# config interface ip add Ethernet48.1 10.1.1.1/24 

 

Router2: Add the Ethernet ports in a VLAN and configure an IP address for VLAN.  

 

VALIDATION (SONIC SHOW OUTPUTS) 

  • Subinterfaces , IP and vlan information. 

Router1: 

root@sonic:/home/admin# show subinterfaces status 

  Sub port interface    Speed    MTU    Vlan    Admin                  Type 

--------------------  -------  -----  ------  -------  -------------------- 

       Ethernet48.10      10G   9100      10       up  802.1q-encapsulation 

 

root@sonic:/home/admin# show ip interfaces 

  

Interface    Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP 

-----------  --------  -------------------  ------------  --------------  ------------- 

Ethernet48.10          10.1.1.1/24          up/up         N/A             N/A 

Loopback1              2.2.2.2/32           up/up         N/A             N/A 

docker0                240.127.1.1/24       up/down       N/A             N/A 

eth0                   172.26.1.81/24       up/up         N/A             N/A 

lo                     127.0.0.1/16         up/up         N/A             N/A 

 

 

Router2: 

root@sonic:/home/admin# show ip interfaces 

  

Interface    Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP 

-----------  --------  -------------------  ------------  --------------  ------------- 

Vlan10                 10.1.1.2/24          up/up         N/A             N/A 

Loopback1              2.2.2.2/32           up/up         N/A             N/A 

docker0                240.127.1.1/24       up/down       N/A             N/A 

eth0                   172.26.1.82/24       up/up         N/A             N/A 

lo                     127.0.0.1/16         up/up         N/A             N/A 

 

root@sonic:/home/admin# show vlan brief 
+-----------+-----------------+---------------+----------------+-----------------------+ 
|   VLAN ID | IP Address      | Ports         | Port Tagging   | DHCP Helper Address   | 
+===========+=================+===============+================+=======================+ 
|        10 | 10.1.1.2/24     | Ethernet48    | tagged         |                       | 
+-----------+-----------------+---------------+----------------+-----------------------+ 

 

  • Ping Router1(Ethernet48.10) to Router2(Vlan10). 

root@sonic:/home/admin# ping 10.1.1.2 

PING 10.1.1.2 (20.1.1.2) 56(84) bytes of data. 

64 bytes from 10.1.1.2: icmp_seq=1 ttl=64 time=0.320 ms 

  

--- 10.1.1.2 ping statistics --- 

1 packets transmitted, 1 received, 0% packet loss, time 0ms 

rtt min/avg/max/mdev = 0.320/0.320/0.320/0.000 ms 

Router1 : 

root@sonic:/home/admin# show arp 

Address       MacAddress         Iface          Vlan 

------------  -----------------  -------------  ------ 

10.1.1.2      04:f8:f8:81:da:8c  Ethernet48.10  - 

Router2: 

root@sonic:/home/admin# show arp 

Address       MacAddress         Iface         Vlan 

------------  -----------------  ------------  ------ 

10.1.1.1      68:21:5f:9c:fc:7b  Ethernet48    10 

 

SUB INTERFACE WITH PORTCHANNEL: 

TOPOLOGY: 

 


Configuration commands (sonic configurations): 

Note: Commands are to be executed in sudo mode. 

Router1:  

  • Configure a Portchannel and add the Ethernet Ports in Portchannel. 

  • Add the portchannel in a VLAN and assign the IP address. 

  • Configure IP for subinterface in a portchannel. 

root@sonic:/home/admin# config interface ip add PortChannel1.20 20.1.1.1/24 

 

Router2: 

  • Configure a Portchannel and add the Ethernet Ports in Portchannel. 

  • Add the portchannel in a VLAN and assign the IP address. 

 

VALIDATION (SONIC SHOW OUTPUTS) 

  • Subinterfaces information. 

Router1: 

root@sonic:/home/admin# show subinterfaces status 

  Sub port interface    Speed    MTU    Vlan    Admin                  Type 

--------------------  -------  -----  ------  -------  -------------------- 

     PortChannel1.20      10G   9100      20       up  802.1q-encapsulation 

 

root@sonic:/home/admin# show ip interfaces 

  

Interface    Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP 

-----------  --------  -------------------  ------------  --------------  ------------- 

PortChannel1.20        20.1.1.1/24          up/up         N/A             N/A 

Loopback1              2.2.2.2/32           up/up         N/A             N/A 

docker0                240.127.1.1/24       up/down       N/A             N/A 

eth0                   172.26.1.82/24       up/up         N/A             N/A 

lo                     127.0.0.1/16         up/up         N/A             N/A 

 

root@sonic:/home/admin# show vlan brief 
+-----------+-----------------+---------------+----------------+-----------------------+ 
|   VLAN ID | IP Address      | Ports         | Port Tagging   | DHCP Helper Address   | 
+===========+=================+===============+================+=======================+           |        10 | 10.1.1.1/24     | PortChannel1  | tagged         |                       | 
+-----------+-----------------+---------------+----------------+-----------------------+ 

 

Router2: 

root@sonic:/home/admin# show ip interfaces 

  

Interface    Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP 

-----------  --------  -------------------  ------------  --------------  ------------- 

Vlan10                    10.1.1.2/24          up/up         N/A             N/A 

Vlan20                    20.1.1.2/24          up/up         N/A             N/A 

docker0                240.127.1.1/24       up/down       N/A             N/A 

eth0                   172.26.1.83/24       up/up         N/A             N/A 

lo                     127.0.0.1/16         up/up         N/A             N/A 

 

root@sonic:/home/admin# show vlan brief 

 
+-----------+-----------------+---------------+----------------+-----------------------+ 
|   VLAN ID | IP Address      | Ports         | Port Tagging   | DHCP Helper Address   | 
+===========+=================+===============+================+=======================+ 
|        10 | 10.1.1.2/24     | PortChannel1 | tagged         |                       | 
+-----------+-----------------+---------------+----------------+-----------------------+ 
|        20 | 20.1.1.2/24     | PortChannel1 | tagged         |                       | 
+-----------+-----------------+---------------+----------------+-----------------------+ 

 

 

  • Ping Router1(Vlan10) to Router2(Vlan10). 

  • Ping Router1(PortChannel1.20) to Router2(Vlan20). 

root@sonic:/home/admin# ping 10.1.1.2 

PING 10.1.1.2 (10.1.1.2) 56(84) bytes of data. 

64 bytes from 10.1.1.2: icmp_seq=1 ttl=64 time=0.631 ms 

  

--- 10.1.1.2 ping statistics --- 

1 packets transmitted, 1 received, 0% packet loss, time 0ms 

rtt min/avg/max/mdev = 0.631/0.631/0.631/0.000 ms 

 

root@sonic:/home/admin# ping 20.1.1.2 

PING 20.1.1.2 (20.1.1.2) 56(84) bytes of data. 

64 bytes from 20.1.1.2: icmp_seq=1 ttl=64 time=0.516 ms 

  

--- 20.1.1.2 ping statistics --- 

1 packets transmitted, 1 received, 0% packet loss, time 0ms 

rtt min/avg/max/mdev = 0.516/0.516/0.516/0.000 ms 

 

Router1: 

root@sonic:/home/admin# show arp 

Address       MacAddress         Iface            Vlan 

------------  -----------------  ---------------  ------ 

10.1.1.2      68:21:5f:9c:fc:7b  PortChannel1     10 

20.1.1.2      68:21:5f:9c:fc:7b  PortChannel1.20  - 

 

Router2: 

root@sonic:/home/admin# show arp 

Address       MacAddress         Iface          Vlan 

------------  -----------------  -------------  ------ 

10.1.1.1      04:f8:f8:81:da:8c  PortChannel1   10 

20.1.1.1      04:f8:f8:81:da:8c  PortChannel1   20 

 

 

 

 

    • Related Articles

    • How to configure BGP

      BGP (Border Gateway Protocol) Objective BGP (Border Gateway Protocol) is the protocol that enables the global routing system of the internet. It manages how packets get routed from network to network by exchanging routing and reachability information ...
    • How to Configure Basic VRF Management

      VRF Management Objective This document explains how to configure Basic VRF (Virtual Routing and Forwarding) Management on SONiC-OS-4.4.2-Enterprise_Base. Management VRF provides a separate routing table specifically for out-of-band management ...
    • How to Configure BGP (Border Gateway Protocol)

      BGP (Border Gateway Protocol) Objective This document explains how to configure Border Gateway Protocol (BGP) on [device or platform name]. BGP is the protocol that enables the global routing system by exchanging routing information between ...
    • How to Configure ACL (Access Control List)

      ACL (Access Control List) Objective This document explains how to configure Access Control Lists (ACLs) on broadcom sonic. ACLs consist of one or more access control entries (ACEs) that define rules to permit or deny network traffic based on ...
    • How to Configure Portchannel (Link Aggregation Group - LAG)

      Portchannel (Link Aggregation Group - LAG) Objective This document explains how to configure a port channel (Link Aggregation Group, LAG) . A port channel is a logical communication link that combines multiple physical Ethernet ports into one ...