Configuring Management Interface and Loopback Interface
The management interface (eth0) in SONiC is configured (by default) to use DHCP client to get the IP address from the DHCP server. Connect the management interface to the same network in which your DHCP server is connected and get the IP address from DHCP server. The IP address received from DHCP server can be verified using the /sbin/ifconfig eth0 Linux command.
- Use Click CLI.
admin@Celestica-DS1000:~$ config interface ip add eth0 <ip_addr> <default gateway IP> -
Use config_db.json and configure the MGMT_INTERFACE key with the appropriate values. For details, refer here
Add the following example configuration in a file (example: mgmt_ip.json) and load it as follows.{ "MGMT_INTERFACE|eth0|10.208.81.132/24": { "value": { "gwaddr": "10.208.81.1" } }Note: If the interface IP address and default gateway were already present, users should remove them before loading the above configuration.Users can either use theshow management_interface addresscommand to check the already configured MGMT_INTERFACE or theredis-clicommand as follows to check the same.admin@Celestica-DS1000:~$ redis-cli -n 4 keys "MGMT_INTERFACE*" 1) "MGMT_INTERFACE|eth0|10.208.81.132/24" admin@Celestica-DS1000:~$After removing the key, users can load the new configuration using the
config load mgmt_ip.jsoncommand and then dosystemctl restart interfaces-configto make it effective. Users shall verify the configured management interface IP address value using theifconfigLinux command orshow ip interfacesthrough click CLI. -
Once the IP address is configured, the same can be verified using the
/sbin/ifconfig eth0Linux command. Users can SSH login to this management interface IP address from their management network.Example:admin@sonic:~$ /sbin/ifconfig eth0 eth0: flags=4163 mtu 1500 inet 10.11.11.13 netmask 255.255.255.0 broadcast 10.11.12.255
The same method can be used to configure the Loopback interface address.
-
/sbin/ifconfig loLinux command shall be used. OR, -
Add the key LOOPBACK_INTERFACE and value in config_db.json and load it.