# Photon Network Manager Command-line Interface (netmgr) For locally logged-on users, Photon OS provides a command line interface to manage network configuration of the system. - [Setup Steps](#setup-steps) - [Syntax](#syntax) - [Network Manager CLI](#network-manager-cli) # Setup Steps The netmgr tool is included with your Photon OS distribution. To make sure that you have the latest version, you can run: ~~~~ tdnf install netmgmt ~~~~ # Syntax The CLI is built on set, get, add, delete command model and uses the option-name - option-value model of specifying command parameters. ~~~~ netmgr <--get | --set | --add | --del> ~~~~ Passed-in parameter values can be enclosed in single (') or double-quotes (") as long as you use matching characters to denote the beginning and end of the value. Unless a parameter value contains special characters or spaces, you can also omit quotes altogether. ## network object ```` is one of the following values: - ``link_info`` - ``ip4_address`` - ``ip6_address`` - ``ip_route`` - ``dns_servers`` - ``dns_domains`` - ``dhcp_duid`` - ``if_iaid`` - ``ntp_servers`` - ``hostname`` - ``wait_for_link`` - ``wait_for_ip`` - ``error_info`` - ``net_info`` # Network Manager CLI ## link_info Get the mac address, MTU, link state, and link mode for the (optionally) specified interface. ~~~~ netmgr link_info --get --interface ~~~~ Set the MAC address, link state (up or down), link mode (manual or auto), or MTU for the specified interface. ~~~~ netmgr link_info --set --interface --macaddr netmgr link_info --set --interface --mode netmgr link_info --set --interface --state netmgr link_info --set --interface --mtu ~~~~ ## ip4_address Get the IPv4 address for the specified interface. ~~~~ netmgr ip4_address --get --interface ~~~~ Set the IPv4 address (dot-decimal/prefix notation), mode (dhcp, static, or none), and (optionally) the default gateway for the specified interface. ~~~~ netmgr ip4_address --set --interface --mode --addr --gateway ~~~~ ## ip6_address Get IPv6 addresses for the specified interface. ~~~~ netmgr ip6_address --get --interface ~~~~ Add one or more IPv6 addresses (comma-separated list in colon-separated/prefix notation) to the specified interface. ~~~~ netmgr ip6_address --add --interface --addrlist ~~~~ Delete one or more IPv6 addresses (comma-separated list in colon-separated/prefix notation) from the specified interface. ~~~~ netmgr ip6_address --del --interface --addrlist ~~~~ Set the IPv6 DHCP mode (1=enable, 0=disable) and IPv6 auto-configuration settings (1=enable, 0=disable) for the specified interface. ~~~~ netmgr ip6_address --set --interface --dhcp <1|0> --autoconf <1|0> ~~~~ ## ip_route Get the static IP route for the specified interface. ~~~~ netmgr ip_route --get --interface ~~~~ Add the static IP route (gateway IP, destination network, and metric) to the specified interface. ~~~~ netmgr ip_route --add --interface --gateway --destination --metric ~~~~ Delete the specified static IP route from the specified interface. ~~~~ netmgr ip_route --del --interface --destination ~~~~ ## dns_servers Get the list of DNS servers. ~~~~ netmgr dns_servers --get ~~~~ Set the DNS mode (DHCP or static) for one or more DNS servers (comma-separated list). ~~~~ netmgr dns_servers --set --mode --servers ~~~~ Add a DNS server to the list of DNS servers. ~~~~ netmgr dns_servers --add --servers ~~~~ Remove the specified DNS server from the list of DNS servers. ~~~~ netmgr dns_servers --del --servers ~~~~ ## dns_domains Get the list of DNS domains. ~~~~ netmgr dns_domains --get ~~~~ Set the list of DNS domains (one or more DNS domains in a comma-separated list). ~~~~ netmgr dns_domains --set --domains ~~~~ Add a DNS domain to the list of DNS domains. ~~~~ netmgr dns_domains --add --domains ~~~~ Delete a DNS domain from the list of DNS domains. ~~~~ netmgr dns_domains --del --domains ~~~~ ## dhcp_duid Get the DHCP DUID (optionally interface-specific DUID) for the system. ~~~~ netmgr dhcp_duid --get ~~~~ Set the DHCP DUID for the system, optionally per-interface if the interface is specified. ~~~~ netmgr dhcp_duid --set --duid ~~~~ ## if_iaid Get the IAID for the specified interface. ~~~~ netmgr if_iaid --get --interface ~~~~ Set the IAID for the specified interface. ~~~~ netmgr if_iaid --set --interface --iaid ~~~~ ## ntp_servers Get the NTP servers list. ~~~~ netmgr ntp_servers --get ~~~~ Set the NTP servers list. ~~~~ netmgr ntp_servers --set --servers ~~~~ Add the specified server to the NTP servers list. ~~~~ netmgr ntp_servers --add --servers ~~~~ Delete the specified server from the NTP servers list. ~~~~ netmgr ntp_servers --del --servers ~~~~ ## hostname Get the system hostname. ~~~~ netmgr hostname --get ~~~~ Set the system hostname. ~~~~ netmgr hostname --set --name ~~~~ ## wait_for_link Wait for the specified network interface to be up and usable (it can send and receive packets). ~~~~ netmgr wait_for_link --interface --timeout ~~~~ The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely). **Note:** You might need to use wait_for_ip to wait until you can send and receive IP packets. ## wait_for_ip Wait for the specified interface to acquire a valid IP address for the specified address type. ~~~~ netmgr wait_for_ip --interface --timeout --addrtype ~~~~ The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely). ## error_info Get error information about the specified error code. ~~~~ netmgr error_info --errcode ~~~~ Here is a list of error codes: - 4097 - invalid parameter - 4098 - not supported - 4099 - out of memory - 4100 - value not found - 4101 - value exists - 4102 - invalid interface - 4103 - invalid mode - 4104 - bad configuration file - 4105 - write failed - 4106 - timeout - 4107 - DCHP timeout ## net_info Get the specified network configuration parameter for the specified object. ~~~~ netmgr net_info --get --object --paramname ~~~~ **Note:** The object can be an interface name (for example, "eth0") or a file name (for example, /etc/systemd/resolved.conf). Set the value of the specified network configuration parameter for the specified object (interface or file). ~~~~ netmgr net_info --set --object --paramname --paramvalue ~~~~ **Note** : You can add (+) or remove (-) a parameter by prepending the parameter name with + or -. For example, in order to add static IPv4 address "10.10.10.1/24" to eth0 interface, the following command adds this **Address** to the **Network** section of the **eth0** network configuration file. ~~~~ netmgr net_info --set --object eth0 --paramname +Network_Address --paramvalue "10.10.10.1/24" ~~~~