1

There have been various questions asked a long time ago about obtaining two IP addresses via DHCP on Linux. Most of those are still relating to old 'alias interfaces', like eth0:0, which has been deprecated for a long time.

As referenced in this question, it should be possible to get multiple IP addresses by using send dhcp-client-identifier with different values, and indeed there is a partial example of this in the manual page for dhclient.conf

But that refers to "you must also provide a separate client script for the pseudo-interface" to configure it. Such a script would presumably need to run ip address add and ip address del for the secondary IP address when the DHCP client reaches the right states.

Is there any example anywhere out there of a working version of such a script? And will it work with the default script for the primary address (which seems to be very enthusiastic in deleting any and all other IP addresses on the interface)

Has anyone ever got such a setup to work?

2
  • The enthusiasm is from the kernel, not a script: git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/…
    – A.B
    Mar 18, 2022 at 23:09
  • 1
    If you are referring to the promote_secondaries flag, then that does the opposite - it retains a secondary IP when the primary is removed. I'm referring to lines like ip -4 addr flush dev ${interface} label ${interface} in /sbin/dhclient-script, which will flush all IP addresses on an interface when the interface gets a BOUND, RENEW, REBIND or REBOOT event in some cases. It may be that the script arguments are always such that the line does not get called, but it is hard to tell. Mar 28, 2022 at 9:26

0

You must log in to answer this question.

Browse other questions tagged .