I am trying to modify the current eth0 with nmcli
I ran this: nmcli con mod eth0 ipv4.addr 192.168.1.15/22 gw4 192.168.1.1 ipv4.dns 192.168.1.14
and now nmcli shows (two ipv4) addresses.
inet4 192.168.1.15/22 inet4 192.168.2.212/22
I think the original connection was DHCP... the 2.212 item listed.
So I want to change the original DHCP to a static network - how do I do that? I only want the one address not two.
So now I need to "remove" both or all and add the 1 I want as static ? how do I do that?
Thanks,
Jerry
On Fri, Dec 11, 2020 at 9:20 PM Jerry Geis jerry.geis@gmail.com wrote:
I am trying to modify the current eth0 with nmcli
I ran this: nmcli con mod eth0 ipv4.addr 192.168.1.15/22 gw4 192.168.1.1 ipv4.dns 192.168.1.14
and now nmcli shows (two ipv4) addresses.
inet4 192.168.1.15/22 inet4 192.168.2.212/22
I think the original connection was DHCP... the 2.212 item listed.
So I want to change the original DHCP to a static network - how do I do that? I only want the one address not two.
So now I need to "remove" both or all and add the 1 I want as static ? how do I do that?
Thanks,
Jerry
Supposing you don't need ipv6 and you are on console not having problems of loosing connectivity I would do
nmcli con mod eth0 ipv4.method manual ipv6.method ignore autoconnect yes ipv4.addresses 192.168.1.15/22 gw4 192.168.1.1 ipv4.dns 192.168.1.14 nmcli dev dis eth0 nmcli con up eth0
just tried on a CentOS 8.1 with Network Manager and configured with dhcp. HIH, Gianluca
On 12/11/20 3:19 PM, Jerry Geis wrote:
So now I need to "remove" both or all and add the 1 I want as static ? how do I do that?
You have to remove the addresses and then add a new one. The ipv4.addresses is plural and additional when you set it. So to override you need to first remove all addresses, and add those you want to keep. Once you change method to manual, dhcp should be disabled.
You do need to reactivate the connection once you've save the changes (same/typical nmcli procedure).