1

I build a VM image for different visualiser types, and I would like it to use dhcp on all available network interfaces (wired only).

I'm using Ubuntu server.

Pre-creating /etc/network/interfaces is not an option since I can't predict the number of network interfaces, nor their names.

I tried to use network-manager, it works fine (you just need to install it and it will try to connect via any network interface, using DHCP), but will bring 200MB of dependencies on a headless Ubuntu server.

2 Answers 2

2

Use dhcpcd; depending on Ubuntu version, it may be called dhcpcd5. It installs as a convenient systemd service, and by default it listens on all interfaces. In fact, it has a -z option to limit the interfaces it listens on, but if you do not use the option you get the default behavior.

0

As discussed in this posting https://unix.stackexchange.com/questions/164660/why-are-post-up-commands-in-etc-network-interfaces-ran-multiple-times-at-boot

Add a script to /etc/network/if-up.d which uses $IFACE to run dhclient the whenever an interface (any interface) comes up?

I'm working on a similar issue right now if anyone has a better idea I'll vote for theirs :^)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .