Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Network interface gets a funny name
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
wilsonsamm
Apprentice
Apprentice


Joined: 12 Jul 2008
Posts: 196

PostPosted: Wed Feb 18, 2015 4:20 pm    Post subject: Network interface gets a funny name Reply with quote

It has been a while since I last installed and used gentoo (probably more than six years) and I thought I'd give it another whirl. I did a fresh install according to the gentoo handbook (I like the new design by the way!) but I find that the network interface has a strange name.

It's called enp3s0 instead of eth0.

Why is this happening? Has udev renamed it? Do I need to symlink net.lo to net.enp3s0 and add it to the default runlevel?
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


Joined: 30 Aug 2008
Posts: 1774
Location: United Kingdom

PostPosted: Wed Feb 18, 2015 5:22 pm    Post subject: Reply with quote

Welcome to (un)Predictable Network Interface Names. :roll:

I found that appending the parameter net.ifnames=0 to the kernel boot line is the only sure-fire way of stopping udev renaming my interfaces. Symlinking /etc/udev/rules.d/80-net-setup-link.rules to /dev/null (see below) is supposed to work too, but I found it wasn't reliable for some reason. The kernel boot parameter is solid.

Code:
$ ls -la /etc/udev/rules.d/
total 16
drwxr-xr-x 2 root root 4096 Nov 30 15:25 .
drwxr-xr-x 6 root root 4096 Feb  8 21:22 ..
-rw-r--r-- 1 root root   93 Feb  8 06:53 10-usbprinter.rules
-rw-r--r-- 1 root root  267 Feb  8 07:18 51-android.rules
lrwxrwxrwx 1 root root    9 Nov 30 15:25 80-net-setup-link.rules -> /dev/null

If you find any instances of the (un)predictable network interface name in your various files once you have made the above changes, you'll need to rename them to eth0.
_________________
Clevo W230SS: amd64 nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC eudev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
szczerb
Veteran
Veteran


Joined: 24 Feb 2007
Posts: 1706
Location: Poland => Lodz

PostPosted: Thu Feb 19, 2015 10:41 am    Post subject: Reply with quote

Or you can just use sane eudev instead of the systemd udev. That's what I do on all my boxes and I have classic if names.
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


Joined: 30 Aug 2008
Posts: 1774
Location: United Kingdom

PostPosted: Thu Feb 19, 2015 11:01 am    Post subject: Reply with quote

^Which version of eudev are you using? I'm using eudev-2.1.1 (equivalent to udev-217) and I still do the same as with udev to disable Predictable Network Interface Names. eudev mirrors udev's functionality, as far as I understand it. It's just not part of the systemd package, unlike udev.
_________________
Clevo W230SS: amd64 nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC eudev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
szczerb
Veteran
Veteran


Joined: 24 Feb 2007
Posts: 1706
Location: Poland => Lodz

PostPosted: Thu Feb 19, 2015 2:22 pm    Post subject: Reply with quote

Current stable:
Code:
$ eix eudev
[I] sys-fs/eudev
     Available versions:  *1.3 *1.5.3-r1 1.9-r2 1.10-r2 ~2.1.1 **9999 {doc gudev (+)hwdb introspection (+)keymap (+)kmod +modutils +openrc +rule-generator selinux static-libs test ABI_MIPS="n32 n64 o32" ABI_PPC="32 64" ABI_S390="32 64" ABI_X86="32 64 x32"}
     Installed versions:  1.10-r2(12:04:08 29.10.2014)(gudev hwdb introspection keymap kmod modutils openrc rule-generator -doc -selinux -static-libs -test ABI_MIPS="-n32 -n64 -o32" ABI_PPC="-32 -64" ABI_S390="-32 -64" ABI_X86="64 -32 -x32")
     Homepage:            https://github.com/gentoo/eudev
     Description:         Linux dynamic and persistent device naming support (aka userspace devfs)


With those USE flags (which I think are standard on a desktop profile) I have normal names. Those are from my laptop:
Code:
# ifconfig -a | grep mtu
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
tunl0: flags=128<NOARP>  mtu 1480
wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
wwan0: flags=4226<BROADCAST,NOARP,MULTICAST>  mtu 1500
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


Joined: 30 Aug 2008
Posts: 1774
Location: United Kingdom

PostPosted: Thu Feb 19, 2015 3:03 pm    Post subject: Reply with quote

I'm using latest testing, and I'm not using the legacy rule generator and udev-postmount service. If I understand correctly, rule-generator will be dropped in future (cf. http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-fs/eudev/eudev-9999.ebuild which has no rule-generator flag and always displays the first set of ewarn messages shown further on below).

Code:
$ eix eudev   
[I] sys-fs/eudev
     Available versions:  *1.3 *1.5.3-r1 1.9-r2 1.10-r2 (~)2.1.1 **9999 {doc gudev (+)hwdb introspection (+)keymap (+)kmod +modutils +openrc +rule-generator selinux static-libs test ABI_MIPS="n32 n64 o32" ABI_PPC="32 64" ABI_S390="32 64" ABI_X86="32 64 x32"}
     Installed versions:  2.1.1(09:57:27 07/11/14)(gudev hwdb introspection keymap kmod modutils static-libs -doc -rule-generator -selinux -test ABI_MIPS="-n32 -n64 -o32" ABI_PPC="-32 -64" ABI_S390="-32 -64" ABI_X86="64 -32 -x32")
     Homepage:            https://github.com/gentoo/eudev
     Description:         Linux dynamic and persistent device naming support (aka userspace devfs)

Code:
$ ifconfig -a | grep mtu
eth0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500


From the eudev-2.1.1.ebuild:
Code:

   if ! use rule-generator; then
      ewarn
      ewarn "As of 2013-01-29, ${P} provides the new interface renaming functionality,"
      ewarn "as described in the URL below:"
      ewarn "http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames"
      ewarn
      ewarn "This functionality is enabled BY DEFAULT because eudev has no means of synchronizing"
      ewarn "between the default or user-modified choice of sys-fs/udev.  If you wish to disable"
      ewarn "this new iface naming, please be sure that /etc/udev/rules.d/80-net-name-slot.rules"
      ewarn "exists:"
      ewarn "\ttouch /etc/udev/rules.d/80-net-name-slot.rules"
      ewarn
      ewarn "We are working on a better solution for the next beta release."
      ewarn
   fi

Code:

   if use rule-generator && \
   [[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
      ewarn
      ewarn "Please add the udev-postmount init script to your default runlevel"
      ewarn "to ensure the legacy rule-generator functionality works as reliably"
      ewarn "as possible."
      ewarn "\trc-update add udev-postmount default"
   fi

(The ebuild ewarn messages don't mention net.ifnames=0, but that is what works reliably for me, not messing around with files in /etc/udev/rules.d/).
_________________
Clevo W230SS: amd64 nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC eudev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3258
Location: de

PostPosted: Fri Feb 20, 2015 4:04 pm    Post subject: Reply with quote

szczerb wrote:
Or you can just use sane eudev instead of the systemd udev. That's what I do on all my boxes and I have classic if names.

I switched to Systemd more than one year ago. And I still have the old network device names, e.g. eth0, wlan0
Back to top
View user's profile Send private message
szczerb
Veteran
Veteran


Joined: 24 Feb 2007
Posts: 1706
Location: Poland => Lodz

PostPosted: Fri Feb 20, 2015 4:10 pm    Post subject: Reply with quote

That's interesting. Are you using a current version? Didn't think you can escape the "predictable" names.
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


Joined: 30 Aug 2008
Posts: 1774
Location: United Kingdom

PostPosted: Fri Feb 20, 2015 7:40 pm    Post subject: Reply with quote

szczerb wrote:
That's interesting. Are you using a current version? Didn't think you can escape the "predictable" names.

http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

freedesktop.org wrote:
I don't like this, how do I disable this?

You basically have four options:

1. You disable the assignment of fixed names, so that the unpredictable kernel names are used again. For this, simply mask udev's rule file for the default policy: ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules (since v209: this file was called 80-net-name-slot.rules in release v197 through v208)
2. You create your own manual naming scheme, for example by naming your interfaces "internet0", "dmz0" or "lan0". For that create your own udev rules file and set the NAME property for the devices. Make sure to order it before the default policy file, for example by naming it /etc/udev/rules.d/70-my-net-names.rules
3. You alter the default policy file, for picking a different naming scheme, for example for naming all interface names after their MAC address by default: cp /usr/lib/udev/rules.d/80-net-setup-link.rules /etc/udev/rules.d/80-net-setup-link.rules, then edit the file there and change the lines as necessary.
4. You pass the net.ifnames=0 on the kernel command line (since v199)

_________________
Clevo W230SS: amd64 nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC eudev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
wilsonsamm
Apprentice
Apprentice


Joined: 12 Jul 2008
Posts: 196

PostPosted: Mon Feb 23, 2015 2:10 pm    Post subject: Reply with quote

Thanks for clearing all this up. I ended up just leaving it as it is, because it turns out that it works anyway...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum