On Mon, Jan 18, 2021 at 2:56 PM Jerry Geis jerry.geis@gmail.com wrote:
Hi All,
I use virtual IP from time to time on CentOS 7. just take something like eth0 and make eth0:1 put in there the IP and subnet and bring up the new IP and it works.
How do I do that with NetworkManager on the command line (assuming all static IP information) I do something like this from nmcli to set the static address: nmcli connection modify eth0 ipv4.method manual ipv6.method ignore autoconnect yes ipv4.addr 192.168.1.8/24 gw4 192.168.1.1 ipv4.dns 8.8.8.8
How then do I add a virtual IP?
Thanks
Jerry
With nmcli you should use: nmcli con mod eth0 +ipv4.addresses 192.168.1.X/24
This would modify your existing ifcfg-eth0 adding the lines:
IPADDR1=192.168.1.X PREFIX1=24
To have the new setting applied and your new ip alias up and running you can then use
nmcli dev reapply eth0 (supposing the device name bound to the connection is eth0)
You can also manually modify the file adding the two lines above and then run: nmcli con reload nmcli dev reapply eth0
I think you should not lose your connection, but always test on a non production machine with the same os version... just for safety HIH, Gianluca