Linux – Network Manager – change static IP via nmcli

1 . Display available network adapters

[root@HOST]# nmcli conn show
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
[root@HOST]# nmcli conn modify 7d08ebcc-94a7-337f-9b74-edecb7cbfd37 ipv4.gateway
[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
[root@HOST]# nmcli conn up 7d08ebcc-94a7-337f-9b74-edecb7cbfd37
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/11)

Leave a Reply

Your email address will not be published. Required fields are marked *

two × 1 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.