Management IP

The management interface (eth0) in SONiC, by default, is configured in DHCP mode. Connect the management interface to the same network to which your DHCP server is connected. The IP address received from the DHCP server can be viewed using the show ip interfaces | grep eth0 command.

A static IP address can be used as an alternative if there is no DHCP server in your network. In DHCP mode, the switch gets the default gateway address from the DHCP server. If the switch is configured with a static IP address, then the gateway should be configured manually.

Interface IP Address Configuration

Follow the steps below to manually configure the management interface IP address.

Step

Command

Description

1

config interface ip add <interface_name> <ip_addr> <default gateway IP address>

Configure the management interface IP address manually.

  • interface_name may be any of the following: Ethernet0–Ethernet53 and eth0.

  • ip_addr: An IPv4 address to be configured in the interface.

  • default gateway IP address: The IPv4 address of the default gateway.

2

show ip interfaces | grep eth0

Display the management interface IP address.

3

sudo config save –y

sudo config save –y

The following example shows the commands used to manually configure the management interface with IP address 192.168.86.10 and default gateway 192.168.86.100.

admin@sonic: ~$ sudo config interface ip add eth0 192.168.86.10/24 192.168.86.100/24

The following example shows how to view the management IP address.

admin@sonic: ~$ show ip interfaces |grep eth0

eth0

192.168.86.10/24

up/up

N/A

N/A

admin@sonic: ~$

Important: 

Zero Touch Provisioning (ZTP) is enabled by default. ZTP restarts the network discovery to get ZTP parameters until the ZTP files are found. This might cause the switch to become unreachable intermittently. If ZTP is not used, then keep ZTP disabled and save the config by using the below commands.

  • ztp disable -y

  • config save -y

Gateway Configuration

Follow the step below to manually configure the gateway.

admin@sonic: ~$ sudo config route add prefix 0.0.0.0/0 nexthop 192.168.86.1

The following example shows how to view the default gateway.

admin@sonic: ~$ show ip route |grep 0.0.0.0/0

S>* 0.0.0.0/0 [1/0] via 192.168.86.1, eth0, weight 1, 00:09:22