Re: DHCP and static IP configuration hangs when no DHCP



Hi Francesco,

Thank you for your answer. I can indeed do that to keep DHCP trying forever or nearly, that's a good idea. But my problem is that the static IP is not created at all until there's an answer from a DHCP server. I was expecting that the static IP would be created then the dynamic IP would appear whenever the DHCP answers. But they both appear only when the DHCP answers. i'm unable to create a static IP first, then start DHCP. Any idea?

Thanks,
David

On Wed, Jun 12, 2019 at 10:26 AM Francesco Giudici <fgiudici redhat com> wrote:
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]