Re: How to do virtual IP on NetworkManager

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



> On Mon, Jan 18, 2021 at 2:56 PM Jerry Geis <jerry.geis@xxxxxxxxx> 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

Hi Gianluca,

Am I right that what you describe doesn't add an alias device like eth0:1
but adds the additional IP address to the eth0 device?

Apart from that, when running with NetworkManager, can one still add a
temporary eth0:1 alias (with ifconfig/ip), use it and remove it again, or
does NM somehow prevent this?

Regards,
Simon

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux