Re: DHCP and static IP configuration hangs when no DHCP



Hi David,

On 6/11/19 12:24 AM, David Bourgeois wrote:
Hi,

I can't find the proper configuration to have an always enabled static IP address and an optional DHCP address when connected to a network that has a DHCP server. My use case is a portable device that connects to local embedded devices using a private local LAN so the static IP should always be there. When we need to connect on the internet, I would like to plug a DHCP enabled connection to the switch and receive a second IP automatically from DHCP for this.

I can setup both DHCP and static using this configuration:
[ipv4]
address1=10.192.11.10/16 <http://10.192.11.10/16>
method=auto

The problem is that the whole connection profile will fail if no DHCP server is found, the static IP will never be set. As soon as I plug the DHCP network, both IP will appear. But I would need the static IP to be available from the beginning. I have the same problem if I try the ifupdown configuration through /etc/network/interfaces. I had gentoo in the past and could achieve this using their RC system, DHCP would be assigned to eth0:0 and a static IP to eth0:1. I just can't find a way to do this with Network Manager.

Any idea if that's possible with the profile configuration, or if I need to use 2 configurations or play with some scripts?

I think you can achieve your desired configuration by setting the dhcp timeout value to something really big.
As easy as:

$ nmcli connection modify $YOUR_CONNECTION_NAME ipv4.dhcp-timeout infinity

This way, the connection will keep trying getting an ip from time to time, and will never be teared down.

Francesco


Thank you,
David

_______________________________________________
networkmanager-list mailing list
networkmanager-list gnome org
https://mail.gnome.org/mailman/listinfo/networkmanager-list



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