Linux – Network Manager – change static IP via nmcli

1 . Display available network adapters

[root@HOST]# nmcli conn show
NAME UUID TYPE DEVICE
Wired connection 2 7d08ebcc-94a7-337f-9b74-edecb7cbfd37 ethernet ens192

2. Change the IP address, gateway and DNS:

[root@HOST]# nmcli connection modify 7d08ebcc-94a7-337f-9b74-edecb7cbfd37 ipv4.address 192.168.101.200/24
[root@HOST]# nmcli conn modify 7d08ebcc-94a7-337f-9b74-edecb7cbfd37 ipv4.gateway 192.168.101.254
[root@HOST]# nmcli conn mod 7d08ebcc-94a7-337f-9b74-edecb7cbfd37 ipv4.method manual
[root@HOST]# nmcli conn mod 7d08ebcc-94a7-337f-9b74-edecb7cbfd37 ipv4.dns 192.168.1.74
[root@HOST]# nmcli conn up 7d08ebcc-94a7-337f-9b74-edecb7cbfd37
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/11)