1

I have a domestic headless server that boots from (and has the root filesystem in) a removable USB stick. I install it from my laptop (following this nice checklist) and edit the configuration files as required. Ideally I'd like to be able to fully configure the system while the USB stick is plugged into my laptop, so that once I plug it into the server, it'll boot straight to multi-user level with network up and SSH daemon running. My desired network configuration is very simple: it has a single integrated MOBO NIC which I want to configure statically.

The main problem I've found is that I don't (reliably) know what interface name my NIC will get assigned. Up 'till now blindly using eth0 in /etc/network/interfaces has done the job, however last time I re-installed it switched to the Predictable Network Interface Names scheme, and I had to lug over the monitor & keyboard to log-in locally and troubleshoot the system.

So how can I avoid myself such pain in the future?

migrated from serverfault.com Jun 23 '16 at 12:48

This question came from our site for system and network administrators.

4

I think the easiest, practical solution is to revert to classical behavior.

  1. In the USB stick's bootloader config (so, in the grub2 config, for example), add the paramater net.ifnames=0 to the kernel command line.
  2. Continue using eth0 in /etc/network/interfaces.

Given the situation you've described and the emphasis you placed on keeping things simple, this seems appropriate. Just note, ifupdown may get deprecated and you'll find /etc/network/interfaces will stop working in the future if you are too hasty with an update/upgrade.

  • I'll do that, if only because it's a really simple setup and I kinda prefer eth0 over enp3s1. Thanks! – Nubarke Jun 23 '16 at 17:19
2

If you're modernist, you can switch to using systemd-networkd instead of the usual static configuration method. See man systemd.network; the basic idea is removing /etc/network/interfaces and creating instead /etc/systemd/network/static.network like

[Network]
Address=1.2.3.4/26
Gateway=1.2.3.3

Don't forget to systemctl enable systemd-networkd as well.

  • Didn't know about that feature, I'll sure look into it. Many thanks! – Nubarke Jun 24 '16 at 18:47
  • @etherfish: thanks for pointing out the misleading example file name, fixed. Concerning the matching, I really intended to match every network interface. And the Device= key isn't even mentioned in my manuals. – Ferenc Wágner Jun 26 '16 at 10:57
0

The predictable network interface naming scheme is made to solve exactly this problem of getting different names for an interface at different times. This means that with this change your problem should be gone (until the next change of interface naming in systemd 😉)

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.