Static IP configuration using NetworkManager on Shunya OS

Commandline Utility(nmcli)

nmcli is a command-line tool for controlling NetworkManager and reporting network status.

List available connection

sudo nmcli con show

Example output of this command:

NAME                UUID                                  TYPE            DEVICE
Wired connection 1  a7657019-3f34-4633-a6f6-e96a38926d50  802-3-ethernet  eth0

Setting a Static ip to the available connections

sudo nmcli con modify "Connection name" connection.autoconnect yes ipv4.method manual ipv4.address desired_ip/subnet ipv4.gateway desired_gateway ipv4.dns desired_dns

For example: if we want want to set static ip to Wired connection 1 here is how we do it:

sudo nmcli con modify "Wired connection 1" connection.autoconnect yes ipv4.method manual ipv4.address 192.168.0.135/24 ipv4.gateway 192.168.0.1 ipv4.dns 1.1.1.1

Note

Don’t forget to restart manager for your static ip to be set. This can be done by sudo systemctl restart NetworkManager

Reverting back to dynamic ip

sudo nmcli con modify "Connection name" connection.autoconnect yes ipv4.method auto ipv4.address "" ipv4.gateway "" ipv4.dns ""

For example: if we want want to set static ip to Wired connection 1 here is how we do it:

sudo nmcli con modify "Wired connection 1" connection.autoconnect yes ipv4.method auto ipv4.address "" ipv4.gateway "" ipv4.dns ""

Note

Don’t forget to restart manager for the dynamic ip to be set. This can be done by sudo systemctl restart NetworkManager