[CentOS] How to do virtual IP on NetworkManager

Mon Jan 18 18:03:05 UTC 2021
Gianluca Cecchi <gianluca.cecchi at gmail.com>

On Mon, Jan 18, 2021 at 6:51 PM Simon Matter <simon.matter at invoca.ch> wrote:

>
> 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?
>

Yes, in fact after adding it I see this kind of thing (with my ip test
addressing on eth1):

# ip a
. . .
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UP group default qlen 1000
    link/ether 52:54:00:61:73:d4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.124.102/24 brd 192.168.124.255 scope global noprefixroute
eth1
       valid_lft forever preferred_lft forever
    inet 192.168.124.152/24 brd 192.168.124.255 scope global secondary
noprefixroute eth1
       valid_lft forever preferred_lft forever



> 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
>
>
>
I think it is not managed by NM. I didn't find anything in its documentation
Probably to have it configured you need to setup the desired
interfaces/connections using
NM_CONTROLLED=no
in its configuration and use the classic network service
Also because the eth0:1 ip aliasing way is deprecated
https://www.kernel.org/doc/html/latest/networking/alias.html
and perhaps NM uses only iproute2...

Gianluca