Port IP addresses

This page describes how to configure management port and front panel interfaces.

Example model & SONiC version:

  • Aurora 615/715
  • Netberg SONiC: sonic-202012-nb-inno-211121

Management interface

Default settings:

  1. All Netberg models will name management port “eth0”
  2. DHCP address on management port”eth0″
  • Configure IP address on management port “eth0”
admin@sonic:~$ sudo config interface ip add eth0 192.168.0.126/24
admin@sonic:~$ sudo config interface ip add eth0 2001::8/64
  • Check IP addresses
# show ip interfaces
Interface    Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP
-----------  --------  -------------------  ------------  --------------  -------------
Loopback0              10.1.0.1/32          up/up         N/A             N/A
docker0                240.127.1.1/24       up/down       N/A             N/A
eth0                   192.168.0.126/24     up/up         N/A             N/A
lo                     127.0.0.1/16         up/up         N/A             N/A

# show ipv6 interfaces
Interface    Master    IPv6 address/mask                        Admin/Oper    BGP Neighbor    Neighbor IP
-----------  --------  ---------------------------------------  ------------  --------------  -------------
Bridge                 fe80::b4d1:a3ff:fec0:207d%Bridge/64      up/down       N/A             N/A
Loopback0              fe80::845c:fdff:fe2c:7143%Loopback0/64   up/up         N/A             N/A
docker0                fd00::1/80                               up/down       N/A             N/A
                       fe80::1%docker0/64                       up/down       N/A             N/A
eth0                   2001::8/64                               up/up         N/A             N/A
                       fe80::72b3:d5ff:fecc:f7f3%eth0/64        up/up         N/A             N/A
lo                     ::1/128                                  up/up         N/A             N/A
  • Check management interface
# show management_interface address
Management IP address = 192.168.0.126/24
Management Network Default Gateway = 192.168.0.1
Management IP address = 2001::8/64
Management Network Default Gateway = 2001::1
  • Save settings to config_db.json
admin@sonic:~$ sudo config save -y
  • Check IP address setting in config_db.json
root@sonic:/home/admin# vi /etc/sonic/config_db.json
   "MGMT_INTERFACE": {
        "eth0|192.168.0.126/24": {
            "gwaddr": "192.168.0.1"
        },
        "eth0|2001::8/64": {
            "gwaddr": "2001::1"
        }
     }, 

Front panel interfaces

Method 1

  • Configure IP address on front port. E.g., Ethernet0
admin@sonic:~$ sudo config interface ip add Ethernet0 172.18.0.1/24
admin@sonic:~$ sudo config interface ip add Ethernet0 2002::1/64
  • Check IP addresses
admin@sonic:~$ sudo show ip interfaces
Interface    Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP
-----------  --------  -------------------  ------------  --------------  -------------
Ethernet0              10.0.0.0/31          up/down       N/A             10.0.0.1
                       172.18.0.1/24        up/up         N/A             N/A
Loopback0              10.1.0.1/32          up/up         N/A             N/A
docker0                240.127.1.1/24       up/down       N/A             N/A
eth0                   192.168.0.126/24     up/up         N/A             N/A
lo                     127.0.0.1/16         up/up         N/A             N/A

admin@sonic:~$ sudo show ipv6 interfaces
Interface    Master    IPv6 address/mask                        Admin/Oper    BGP Neighbor    Neighbor IP
-----------  --------  ---------------------------------------  ------------  --------------  -------------
Bridge                 fe80::8013:9ff:feb5:5bc6%Bridge/64       up/down       N/A             N/A
Ethernet0              2002::1/64                               up/up         N/A             N/A
Loopback0              fe80::744f:d2ff:fe6f:8c8e%Loopback0/64   up/up         N/A             N/A
docker0                fd00::1/80                               up/down       N/A             N/A
                       fe80::1%docker0/64                       up/down       N/A             N/A
eth0                   2001::8/64                               up/up         N/A             N/A
                       fe80::72b3:d5ff:fecc:f7f3%eth0/64        up/up         N/A             N/A
lo                     ::1/128                                  up/up         N/A             N/A
  • Save settings to config_db.json
admin@sonic:~$ sudo config save -y

Method 2

To configure interfaces and ports on SONiC, modify the INTERFACE hierarchy statements in the /etc/sonic/config_db.json file.

    "INTERFACE": {
        "Ethernet0": {},
        "Ethernet0|172.18.0.1/24": {},
     }

    "PORT": {
        "Ethernet0": {
            "admin_status": "up",
            "alias": "Ethernet0",
            "fec": "rs",
            "index": "0",
            "lanes": "121,122,123,124",
            "mtu": "9100",
            "speed": "100000"
        },

Port channel interface

Method 1

  • Create port channel interfaces (refer to LAG)
  • Assign IP addresses to the interface
admin@sonic:~$ sudo config interface ip add PortChannel01 192.168.0.100/24
 admin@sonic:~$ sudo config interface ip add PortChannel01 2002::1/64
  • Check IP addresses
admin@sonic:~$ show ip interfaces
Interface      Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP
-------------  --------  -------------------  ------------  --------------  -------------
Loopback0                10.1.0.1/32          up/up         N/A             N/A
PortChannel01            192.168.0.100/24       up/down       N/A             N/A
docker0                  240.127.1.1/24       up/down       N/A             N/A
eth0                     192.168.0.126/24     up/up         N/A             N/A
lo                       127.0.0.1/16         up/up         N/A             N/A
admin@sonic:~$ show ipv6 interfaces
Interface      Master         IPv6 address/mask                         Admin/Oper    BGP Neighbor    Neighbor IP
-------------  -------------  ----------------------------------------  ------------  --------------  -------------
Bridge                        fe80::3049:73ff:fef0:271%Bridge/64        up/down       N/A             N/A
Loopback0                     fe80::5c79:5bff:fe2e:f6fb%Loopback0/64    up/up         N/A             N/A
PortChannel01                 2002::1/64                                up/down       N/A             N/A
docker0                       fd00::1/80                                up/down       N/A             N/A
fe80::1%docker0/64                        up/down       N/A             N/A
eth0                          fe80::72b3:d5ff:fecc:f7f3%eth0/64         up/up         N/A             N/A
lo                            ::1/128                                   up/up         N/A             N/A

Save settings to config_db.json

admin@sonic:~$ sudo config save -y

Method 2

Modify the PORTCHANNEL hierarchy statements in the /etc/sonic/config_db.json file.

    "PORTCHANNEL": {
        "PortChannel01": {
            "admin_status": "up",
            "mtu": "9100"
        }
    },
    "PORTCHANNEL_INTERFACE": {
        "PortChannel01": {},
        "PortChannel01|192.168.0.100/24": {},
        "PortChannel01|2002::1/64": {}
    },
    "PORTCHANNEL_MEMBER": {
        "PortChannel01|Ethernet0": {},
        "PortChannel01|Ethernet12": {}
    },

Loopback interface

  • A new loopback interface will appear automatically upon assigning an IP address to its name.
admin@sonic:~$ sudo config interface ip add Loopback0 1.1.1.1/32
admin@sonic:~$ sudo config interface ip add Loopback0 2002::1/128
  • Check IP address
admin@sonic:~$ show ip interfaces
Interface    Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP
-----------  --------  -------------------  ------------  --------------  -------------
Loopback0              1.1.1.1/32           up/up         N/A             N/A
docker0                240.127.1.1/24       up/down       N/A             N/A
eth0                   192.168.10.1/16      up/up         N/A             N/A
lo                     127.0.0.1/8          up/up         N/A             N/A
admin@sonic:~$ show ipv6 interfaces
Interface    Master    IPv6 address/mask                       Admin/Oper    BGP Neighbor    Neighbor IP
-----------  --------  --------------------------------------  ------------  --------------  -------------
Loopback0              2002::1/128                             up/up         N/A             N/A
lo                     ::1/128                                 up/up         N/A             N/A
  • Save the setting to config_db.json
admin@sonic:~$ sudo config save -y
NEWS

Latest news