Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Resolved] Upgrade to Predictable Network Interface

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
User avatar
Soapm
Posts: 603
Joined: 2012-05-22 04:23
Has thanked: 1 time

[Resolved] Upgrade to Predictable Network Interface

#1 Post by Soapm »

I was reading the instructions on upgrading my Stretch server to Buster, and found my network is eth0. Per the instructions, I went to section 5.1.5 but have no idea once it says, "This should give enough information to devise a migration plan." Migration plan, you have to understand what you're migrating to in order to formulate a plan, and I can't find the migration instructions for dummies. Here's what I have;

echo /sys/class/net/[ew]*

Code: Select all

/sys/class/net/eth0
rgrep -w eth0 /etc

Code: Select all

root@lenny:/# rgrep -w eth0 /etc
/etc/udev/rules.d/70-persistent-net.rules:SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="44:8a:5b:9e:2d:57", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
/etc/samba/smb.conf.ucf-dist:;   interfaces = 127.0.0.0/8 eth0
/etc/samba/smb.conf:;   interfaces = 127.0.0.0/8 eth0
/etc/samba/smb-1.conf:;   interfaces = 127.0.0.0/8 eth0
/etc/samba/smb.conf~:;   interfaces = 127.0.0.0/8 eth0
/etc/samba/dhcp.conf:   wins server = eth0:192.168.0.199 eth0:192.168.0.199
/etc/avahi/avahi-daemon.conf~:#allow-interfaces=eth0
/etc/avahi/avahi-daemon.conf.dpkg-dist:#allow-interfaces=eth0
/etc/avahi/avahi-daemon.conf:#allow-interfaces=eth0
/etc/network/interfaces~:allow-hotplug eth0
/etc/network/interfaces~:iface eth0 inet static
/etc/network/interfaces~:iface eth0 inet6 static
/etc/network/interfaces:allow-hotplug eth0
/etc/network/interfaces:iface eth0 inet static
/etc/network/interfaces:iface eth0 inet6 static
/etc/network/if-up.d/upstart:   # Ignoring unknown interface eth0=eth0.
/etc/initramfs-tools/initramfs.conf:# Specify a specific network interface, like eth0
/etc/monit/monitrc:#  check network public with interface eth0
/etc/dhcp/dhclient.conf:#  interface "eth0";
/etc/dhcp/dhclient.conf:#  interface "eth0";
udevadm test-builtin net_id /sys/class/net/eth0 2>/dev/null

Code: Select all

root@lenny:/# udevadm test-builtin net_id /sys/class/net/eth0 2>/dev/null
ID_NET_NAME_MAC=enx448a5b9e2d57
ID_OUI_FROM_DATABASE=Micro-Star INT'L CO., LTD.
ID_NET_NAME_PATH=enp2s0
Can someone please point me to where I go from here to get migrated to the new interface system? All of this seems Greek to me.
Last edited by Soapm on 2019-07-09 04:37, edited 2 times in total.

SneakyLittleman
Posts: 3
Joined: 2019-07-08 08:25

Re: Upgrade to Predictable Network Interface

#2 Post by SneakyLittleman »

Hey there, I agree with the above poster. Instructions are sketchy...
I hate to have to upgrade my interface name...the fresh Debian 9 that my VPS host installed (Contabo) did NOT use the modern names it seems :(
VPS means I can't afford to lose network access to the server when I reboot. This needs to be fools-proof.
Any clarifications appreciated.

reinob
Posts: 1196
Joined: 2014-06-30 11:42
Has thanked: 99 times
Been thanked: 47 times

Re: Upgrade to Predictable Network Interface

#3 Post by reinob »

SneakyLittleman wrote:Hey there, I agree with the above poster. Instructions are sketchy...
I hate to have to upgrade my interface name...the fresh Debian 9 that my VPS host installed (Contabo) did NOT use the modern names it seems :(
VPS means I can't afford to lose network access to the server when I reboot. This needs to be fools-proof.
Any clarifications appreciated.
(Contabo VPS [*] user here, but still on stretch :)

A server (virtual or not) normally doesn't change network interfaces, so at least I don't see the need for the predictable (but unpronounceable :) naming.

I have "net.ifname=0" in my kernel cmdline, so I get a (sufficiently predictable) eth0 interface..

[*] Note that Contabo provides VNC access to the VM, so you can edit stuff with GRUB and watch it while booting, login (at the virtual console) etc, even if the underlying Linux is offline or fubar.

SneakyLittleman
Posts: 3
Joined: 2019-07-08 08:25

Re: Upgrade to Predictable Network Interface

#4 Post by SneakyLittleman »

reinob wrote: (Contabo VPS [*] user here, but still on stretch :)
A server (virtual or not) normally doesn't change network interfaces, so at least I don't see the need for the predictable (but unpronounceable :) naming.
I have "net.ifname=0" in my kernel cmdline, so I get a (sufficiently predictable) eth0 interface..
[*] Note that Contabo provides VNC access to the VM, so you can edit stuff with GRUB and watch it while booting, login (at the virtual console) etc, even if the underlying Linux is offline or fubar.
Very interesting, thanks! Do you intend on upgrading? What I don't understand is whether NOT changing my ETH0 will break anything when upgrading...

reinob
Posts: 1196
Joined: 2014-06-30 11:42
Has thanked: 99 times
Been thanked: 47 times

Re: Upgrade to Predictable Network Interface

#5 Post by reinob »

SneakyLittleman wrote:
reinob wrote: (Contabo VPS [*] user here, but still on stretch :)
A server (virtual or not) normally doesn't change network interfaces, so at least I don't see the need for the predictable (but unpronounceable :) naming.
I have "net.ifname=0" in my kernel cmdline, so I get a (sufficiently predictable) eth0 interface..
[*] Note that Contabo provides VNC access to the VM, so you can edit stuff with GRUB and watch it while booting, login (at the virtual console) etc, even if the underlying Linux is offline or fubar.
Very interesting, thanks! Do you intend on upgrading? What I don't understand is whether NOT changing my ETH0 will break anything when upgrading...
Probably buster brings a new (or deletes an old) udev rule. With net.ifname=0 whatever rule udev applies should be ignored so that the kernel naming (eth0, ...) should continue to be used. But I cannot promise that this will be the case.

I do plan on upgrading, but will wait a few weeks. I have php7.2 and postresql from other repositories, so I have to plan how I want to deal with that (either replace with buster packages, or continue with external ones), etc. If I have some interesting experience I will report here :)

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Upgrade to Predictable Network Interface

#6 Post by Head_on_a_Stick »

@OP: your current eth0 interface will be renamed to enp2s0 so you should either change all the instances of eth0 in your various configuration files to enp2s0 then disable /etc/udev/rules.d/70-persistent-net.rules, rebuild the initramfs and reboot before upgrading or ensure that the traditional names are kept.

To maintain the traditional nomenclature either pass net.ifnames=0 as a kernel command line parameter (which should work for your hardware) or create a file at /etc/systemd/network/10-ethernet.link with the following content:

Code: Select all

[Match]
MACAddress=44:8a:5b:9e:2d:57

[Link]
NamePolicy=kernel
Another alternative is to mask udev's .link file:

Code: Select all

# ln -s /dev/null /etc/systemd/network/99-default.link
The 10-ethernet.link file will only apply to your current hardware (as defined by the MAC address) but the other methods will be universal.
deadbang

User avatar
Soapm
Posts: 603
Joined: 2012-05-22 04:23
Has thanked: 1 time

Re: Upgrade to Predictable Network Interface

#7 Post by Soapm »

Head_on_a_Stick wrote:@OP: your current eth0 interface will be renamed to enp2s0 so you should either change all the instances of eth0 in your various configuration files to enp2s0 then disable /etc/udev/rules.d/70-persistent-net.rules, rebuild the initramfs and reboot before upgrading or ensure that the traditional names are kept..
Thanks head_on_a_stick, I have a standard installation on a headless server that I remotely administer via ssh so I'm hoping not to loose ip connectivity, is "/etc/network/interfaces" the only place I need to make this change? You said, "changed all the instances of eth0", can you give examples of where that might be?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Upgrade to Predictable Network Interface

#8 Post by Head_on_a_Stick »

Soapm wrote:is "/etc/network/interfaces" the only place I need to make this change? You said, "changed all the instances of eth0", can you give examples of where that might be?
You have already posted the names of all the files that need to be changed: look at the rgrep output in your OP.

I think it would be simpler to just mask the udev .link file and continue with the traditional naming scheme though.
deadbang

User avatar
Soapm
Posts: 603
Joined: 2012-05-22 04:23
Has thanked: 1 time

Re: Upgrade to Predictable Network Interface

#9 Post by Soapm »

Head_on_a_Stick wrote:
Soapm wrote:is "/etc/network/interfaces" the only place I need to make this change? You said, "changed all the instances of eth0", can you give examples of where that might be?
You have already posted the names of all the files that need to be changed: look at the rgrep output in your OP.

I think it would be simpler to just mask the udev .link file and continue with the traditional naming scheme though.
Thanks again, I figured that but wanted to be sure I can get back in...

I wanted to keep it standard and for the sake of future help and learn the new naming scheme, how do I, "disable /etc/udev/rules.d/70-persistent-net.rules"? What command would I enter to make this happen?

Rebuilding initrd I assume is update-initramfs -u

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Upgrade to Predictable Network Interface

#10 Post by Head_on_a_Stick »

Soapm wrote:how do I, "disable /etc/udev/rules.d/70-persistent-net.rules"? What command would I enter to make this happen?
Follow the instructions in the Release Notes:
disable 70-persistent-net.rules either by renaming it or by commenting out individual lines
Soapm wrote:Rebuilding initrd I assume is update-initramfs -u
That's what the Release Notes say :)

I would use

Code: Select all

# update-initramfs -u -k all
deadbang

User avatar
Soapm
Posts: 603
Joined: 2012-05-22 04:23
Has thanked: 1 time

Re: Upgrade to Predictable Network Interface

#11 Post by Soapm »

Thanks again Head_on_a_Stick, looks like I'm all set and ready for upgrade thanks to you.

I think had they explained that the new network name was at the end of the "udevadm test-builtin net_id /sys/class/net/eth0 2>/dev/null" command and the rgrep command showed where it needed to be changed them I may have got it. As it was, those commands meant nothing to me since it wasn't explained why I was doing them.

To say thanks, I'd like to send you my fat and lazy firstborn, please send me your address... He's a real chip off the old block...

SneakyLittleman
Posts: 3
Joined: 2019-07-08 08:25

Re: Upgrade to Predictable Network Interface

#12 Post by SneakyLittleman »

reinob wrote:I do plan on upgrading, but will wait a few weeks. I have php7.2 and postresql from other repositories, so I have to plan how I want to deal with that (either replace with buster packages, or continue with external ones), etc. If I have some interesting experience I will report here :)
So do I...

Update report: it all went smoothly. Buster & my VPS didn't really care about my old eth0 interface name after all. I just edited all my sources.list to buster and everything upgraded flawlessly. Phew...was a bit stressed :)

Post Reply