You are not logged in.

#1 2014-03-05 07:33:40

aichingm
Member
Registered: 2011-10-13
Posts: 25

"Random" network interface names

Hi,

I'm using me nexus 4 for usb tethering and it works without problems except that every time I plug it in and the switch it to usb tethering the "phone's" network interface gets a new name for example: enp0s4f1u1, enp0s4f1u2, enp0s4f1u8, enp0s6f1u1 and so on...

now my question: how can i stop this? I'd like to have a "static" name which is the same every time I plug the phone in.

Greetings from Vienna
Mario

Offline

#2 2014-03-05 07:43:19

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: "Random" network interface names

Always check the wiki before asking - in this case, you want the Network configuration page, section 4.1 Device names.

Offline

#3 2014-03-05 08:27:30

aichingm
Member
Registered: 2011-10-13
Posts: 25

Re: "Random" network interface names

Thx, I was just searching the wrong thing. I thought it was a problem with the nexus 4. sorry for creating another "check the wiki" post...

Just another quick question:

Why is this just happening with the phone and not with my the other interfaces?

I checked http://www.freedesktop.org/wiki/Softwar … faceNames/ and under "Come again, what good does this do?" it says:
* Stable interface names across reboots

I tried it but the interface names for my phone are not stable across reboots.

So is the more I should do before just forcing a stable name by using a udev rule?

Mario

Offline

#4 2014-03-05 16:11:34

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,354

Re: "Random" network interface names

Because the phone is being enumerated[1] when it connects to the USB bus and is not always given the same address. I did not decode those addresses, but are you plugging it to the same port every time?  After connection, look at the output of lsusb to see which bus and address the device is assigned.

[1] USB ennumeration is the process by which a device is recognized, a bus address assigned, the capabilities discovered, endpoints are instantiated, and drivers for each endpoint in the device are loaded.  It is like DHCP for Ethernet -- on steroids.

Last edited by ewaller (2014-03-05 16:12:13)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#5 2014-03-05 16:51:27

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: "Random" network interface names

I don't think using the same port will help. This is me plugging a flash device into the same port three times in succession:

Mar 05 16:40:35 tk-r4k kernel: usb 1-5: new high-speed USB device number 101 using ehci-pci
Mar 05 16:40:52 tk-r4k kernel: usb 1-5: USB disconnect, device number 101
Mar 05 16:42:07 tk-r4k kernel: usb 1-5: new high-speed USB device number 102 using ehci-pci
Mar 05 16:42:22 tk-r4k kernel: usb 1-5: USB disconnect, device number 102
Mar 05 16:43:16 tk-r4k kernel: usb 1-5: new high-speed USB device number 103 using ehci-pci
Mar 05 16:43:34 tk-r4k kernel: usb 1-5: USB disconnect, device number 103

Note the incrementing device number, which I suspect is the number after the u in your examples above.

Offline

#6 2014-03-05 19:16:29

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,354

Re: "Random" network interface names

tomk wrote:

I don't think using the same port will help..

Oh, I agree completely.   My point was that plugging into a different port is guaranteed to produce a different name.
Plugging into the same port over and over is likely to create a different bus address, and will also produce a different name.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#7 2014-03-05 19:37:36

progandy
Member
Registered: 2012-05-17
Posts: 5,280

Re: "Random" network interface names

systemd-udev has a new scheme to define custom interface names. Add e.g. a file /etc/systemd/network/100-netusb.link

[Match]
Driver=usb

[Link]
NamePolicy=database mac slot path
MACAddressPolicy=persistent

I think then all usb network devices will get interface names derived from their mac addresss instead of a changing device numbers.
http://www.freedesktop.org/software/sys … figuration

Edit: Maybe you have to order it before 99-default.link, so try it with e.g. 70- if 100- does not work.

Last edited by progandy (2014-03-05 19:39:20)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

Board footer

Powered by FluxBB