Article 5HH3Q nmcli and secondary ip address on demand.

nmcli and secondary ip address on demand.

by
Pigi_102
from LinuxQuestions.org on (#5HH3Q)
Hi all,
I'm struggling to find a way to get two ip addresses on a single interface, but the secondary one only when I issue a command.

I explain better: I have a machine with a single interface ( eth0 ) configured for, say, 192.168.1.15/24
In the old days I usually use to create a virtual interface on it, say
ifconfig eth0:1 inet 192.168.1.30/24 and after that I could do the ifconfig eth0:1 up of ifconfig eth0:1 down whenever I would.

I could easly do the same thing with /etc/sysconfig/network-scripts/ifcfg-eth0 an ifcfg-eth0:1 and then using ifup and ifdown start or stop the interface ( eventually forcing some state with ONBOOT or ONPARENT stuffs in cfg files ).

Same goes by using ip addr commands. A couple of line in a script and you're done.

Nowadays it seems that I can't get the same thing using nmcli ( or the like ) as I can have as many "secondary" ip addresses, but I can't find a way to activate them "on demand".
if I reboot my machine, configured with a secondary ip address from nmcli/nmtui, this second ip comes up at boot whatever I do, if the primary goes up.

So my question is: is there some way to get the "old" behavior using NetworkManager stuff or I do need to disable it and goes the "old" way ?

Thanks in advance.

Pierluigilatest?d=yIl2AUoC8zA latest?i=-FDNTVNqzfs:H9-CxOBGDwg:F7zBnMy latest?i=-FDNTVNqzfs:H9-CxOBGDwg:V_sGLiP latest?d=qj6IDK7rITs latest?i=-FDNTVNqzfs:H9-CxOBGDwg:gIN9vFw-FDNTVNqzfs
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments