10. Network configuration

This section describes how to configure network settings via CLI, REST, IPMI and Redfish interface. It is described upstream in https://github.com/openbmc/phosphor-networkd/blob/master/docs/Network-Configuration.md.

10.1. BMC command line

  • To get the default network gateway of the BMC:

    $ busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/config xyz.openbmc_project.Network.SystemConfiguration DefaultGateway
    
  • To get the default IPv6 gateway of the BMC:

    $ busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/config xyz.openbmc_project.Network.SystemConfiguration DefaultGateway6
    
  • To get the default network gateway of the BMC:

    $ busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/config xyz.openbmc_project.Network.SystemConfiguration HostName
    

DHCP settings:

  • To check if DNS is enabled:

    $ busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/config/dhcp xyz.openbmc_project.Network.DHCPConfiguration DNSEnabled
    
  • To check HostnameEnabled:

    $ busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/config/dhcp xyz.openbmc_project.Network.DHCPConfiguration HostNameEnabled
    
  • To check if NTP is enabled:

    $ busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/config/dhcp xyz.openbmc_project.Network.DHCPConfiguration NTPEnabled
    
  • To check SendHostNameEnabled:

    $ busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/config/dhcp xyz.openbmc_project.Network.DHCPConfiguration SendHostNameEnabled
    

You can execute the following operations on interface “eth0”:

  • Check if auto-negotiation is enabled:

    $ busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/eth0 xyz.openbmc_project.Network.EthernetInterface AutoNeg
    
  • Check if DHCP is enabled:

    $ busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/eth0 xyz.openbmc_project.Network.EthernetInterface DHCPEnabled
    

10.2. REST API

You can uses the REST interface to query the network configuration, by using openbmctool.py.

  • Viewing current configuration:

    python3 openbmctool.py -H <hostip/hostname> -U <user> -P <password> network view-config
    
  • Get hostname:

    python3 openbmctool.py -H <hostip/hostname> -U <user> -P <password> network getHostName
    
  • Print out default network gateway on the BMC:

    python3 openbmctool.py -H <hostip/hostname> -U <user> -P <password> network getDefaultGW
    
  • Get IPs on the given interface:

    python3 openbmctool.py -H <hostip/hostname> -U <user> -P <password> network getIP -I <interface>
    

10.3. IPMI

  • Print network information:

    $ ipmitool -I lanplus -U <user> -P <password> -H <hostip/hostname> lan print <channel>
    
  • Enable DHCP:

    $ ipmitool -I lanplus -U <user> -P <password> -H <hostip/hostname> lan set <channel> ipsrc dhcp
    
  • Configure static IP:

    $ ipmitool -I lanplus -U <user> -P <password> -H <hostip/hostname> lan set <channel> ipsrc static
    
  • Set IP address:

    $ ipmitool -I lanplus -U <user> -P <password> -H <hostip/hostname> lan set <channel> ipaddr <ipaddr>
    
  • Set netmask:

    $ ipmitool -I lanplus -U <user> -P <password> -H <hostip/hostname> lan set <channel> netmask <x.x.x.x>
    
  • Set default network gateway IP address:

    $ ipmitool -I lanplus -U <user> -P <password> -H <hostip/hostname> lan set <channel> defgw ipaddr <ip>
    

Note

Since the system does not allow unpingable network gateway addresses, make sure the network gateway address is pingable.