Default network interface name

Kernels & Hardware, configuring network, installing services

Default network interface name

Postby L_V » 2017-11-30 18:54

Hello,

After reading this interesting network investigation, I wonder what is the origin of the default network name created during installation (eth0 / wlan0 / enp2s0 etc etc....).

It seems that the root is file /usr/lib/systemd/network/99-default.link which contains:

Code: Select all
[Link]
NamePolicy=kernel database onboard slot path
MACAddressPolicy=persistent

The network name should come from kernel or udev.

Is there a command to generate this default network name ?
L_V
 
Posts: 717
Joined: 2007-03-19 09:04

Re: Default network interface name

Postby Head_on_a_Stick » 2017-11-30 19:14

"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 6810
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Default network interface name

Postby L_V » 2017-11-30 19:17

This does not answer the question, but thank you anyway.

The question is: Is there a command to generate this default network name ?
L_V
 
Posts: 717
Joined: 2007-03-19 09:04

Re: Default network interface name

Postby Head_on_a_Stick » 2017-11-30 19:18

I do not understand your question then, sorry.

The old naming scheme is enforced by 70-local-persistent-net.rules in jessie, is that what you mean?
"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 6810
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Default network interface name

Postby Head_on_a_Stick » 2017-11-30 19:19

L_V wrote:Is there a command to generate this default network name ?

Code: Select all
ip link

EDIT: also, you can work out what the name will be from the location of the PCI slot on the motherboard before even connecting a card.
"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 6810
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Default network interface name

Postby L_V » 2017-11-30 19:22

No. ip link will give you the name of your already configured network interface.

Before creating any connection, the system creates a default network name.
The question is: how the system creates and decides this name, ie, with which command.
Last edited by L_V on 2017-11-30 19:35, edited 1 time in total.
L_V
 
Posts: 717
Joined: 2007-03-19 09:04

Re: Default network interface name

Postby Head_on_a_Stick » 2017-11-30 19:26

L_V wrote:how the system creates and decides this name

My Debian wiki link states that:
it relies on the BIOS enumeration

But I really don't know, sorry.
"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 6810
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Default network interface name

Postby shep » 2017-11-30 20:55

Debian 8 used wireless tools while Debian 9 uses iw. See this Arch Linux wiki
https://wiki.archlinux.org/index.php/Wireless_network_configuration#Get_the_name_of_the_interface
Last edited by shep on 2017-11-30 23:10, edited 1 time in total.
shep
 
Posts: 137
Joined: 2011-03-15 15:22

Re: Default network interface name

Postby wizard10000 » 2017-11-30 21:09

we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1224
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Re: Default network interface name

Postby L_V » 2017-11-30 21:24

Instead of reporting links (that I know, but did not help to come to conclusion), can you summarize in one line which command creates the default system network name, before being able to configure this network interface ?

I am afraid I will not find the answer, but anyway, I can try an easier question.
If you read this interesting investigation [ here ], you will read that the first command used is "ifconfig wlan0 up".
This was relevant in 2012, when there was no real question on network name (usually eth0 for Debian).

But now you don't know which default network name will be created, "ifconfig wlan0 up" is now "ifconfig xxxx up", and you first need to replace xxxx by something the system will understand.
How xxxx can be known, before configuring anything ?
L_V
 
Posts: 717
Joined: 2007-03-19 09:04

Re: Default network interface name

Postby Head_on_a_Stick » 2017-11-30 21:35

L_V wrote:How xxxx can be known, before configuring anything ?

The interface name is set by the kernel during the boot process before any configuration is done.

Check the output of `journalctl -b` (as root) to see it happen.

The "manual" instructions in your link will work just fine if you replace "wlan0" with "wlp2s0" (or whatever).
"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 6810
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Default network interface name

Postby L_V » 2017-11-30 21:45

Although I did not find the command which creates this default name, I think at least the result can be found here:
Code: Select all
 ls /sys/class/net/

which will give lo and xxx , xxx being this default network name.
L_V
 
Posts: 717
Joined: 2007-03-19 09:04

Re: Default network interface name

Postby shep » 2017-11-30 23:16

L_V wrote:Instead of reporting links (that I know, but did not help to come to conclusion), can you summarize in one line which command creates the default system network name, before being able to configure this network interface ?


The commands changed between Debian 8 and Debian 9 and I cannot tell from your prior posts which version you are using.

Spoon feed:

"ifconfig/iwconfig" for Debian 8
"iw dev/ls /sys/class/net/ip link" for Debian 9.

Each of these commands has a manual page and the Arch Wiki link has the command spelled out for you.
shep
 
Posts: 137
Joined: 2011-03-15 15:22

Re: Default network interface name

Postby L_V » 2017-12-01 08:38

shep wrote:"iw dev/ls /sys/class/net/ip link" for Debian 9.
I use Debian 9, but sorry to say I am quite sure you are probably wrong for a simple reason: iw is not installed during a netinstall, and the network always works fine after reboot, based on /etc/network/interfaces configuration and ifupdown tool (this is true for Debian, but not for all....).
And iw is only for wireless configuration !

An other assumption is that the Debian installation script is creating this default network name, bounded to the MAC address of the network card and PCI position.
example:
Code: Select all
ls -l /sys/class/net/
/sys/class/net/enp2s0 -> ../../devices/pci0000:00/0000:00:05.0/0000:02:00.0/net/enp2s0


To be noted that Debian 9 still installs ifconfig (from net-tools package) + ifupdown tools as default network configuration tools, but systemd is able to configure by itself the network starting from /usr/lib/systemd/network/99-default.link which is likely parameters used by a script to create the default network name.
see man { systemd.network, systemd.link, systemd-networkd.service, systemd.netdev, systemd-resolved.service }

ifupdown is not necessary anymore in Debian 9, and I investigate what can be cleaned up to avoid redundancy/conflict of network tools which is quite hard to understand (DNS / resolv / symlinks between network configuration tools..... ).
Last edited by L_V on 2017-12-01 09:04, edited 1 time in total.
L_V
 
Posts: 717
Joined: 2007-03-19 09:04

Re: Default network interface name

Postby wizard10000 » 2017-12-01 09:04

L_V wrote:Instead of reporting links (that I know, but did not help to come to conclusion), can you summarize in one line which command creates the default system network name, before being able to configure this network interface ?


I could, but since the link I shared provided the answer to your question I decided not to expand on it. I would suggest you give the article another look.
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1224
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Next

Return to System configuration

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable