1

I'm configuring a small server installation that I've installed on an external hard drive and which I'd like to be able to move between (real and virtual) machines from time to time.

When I first tried to move the installation to a different computer, the network device didn't configure itself automatically. I figured out this was because the network interface name was different on that device, so the entries in /etc/network/interfaces didn't apply to it.

Is there a nice way of telling an Ubuntu server that it should simply automatically configure all connected network devices on boot?

Possible options:

  1. My current workaround is to use the kernel boot parameter net.ifnames=0 to disable predictable network interface names so that the first network interface appears as the old-fashioned eth0 on both machines and to just change the entries in /etc/network/interfaces to refer to eth0.

  2. I also considered using NetworkManager, which I understand can be set up to do this unconditional autoconfiguration, and has a text-based management interface that's suitable for a server. My only problem with this approach is that its dependencies pull in much of the X11 and GNOME libraries (291 MB of them on my system), which feels like overkill.

  3. Writing a little script to run on boot that will take the devices found in /sys/class/net and spit out a file into /etc/network/interfaces.d to configure them. If that's a good option, where and when would it be appropriate to run that?

  4. Something awesome I haven't thought of? *fingers crossed*

1

I'm not comfortable saying that running a script on boot is the best way to resolve this, BUT if that's what you're thinking about then you'd want to place it in /etc/rc.local. I've had issues with networks failing to configure before and you can place those networking commands in /etc/rc.local to run on boot and configure it for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.