User Tools

Site Tools


operating_systems:linux:debian:interface_name

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
operating_systems:linux:debian:interface_name [2017/10/30 13:13] kroduitoperating_systems:linux:debian:interface_name [2022/02/01 13:34] (current) ateixeira
Line 39: Line 39:
 E: USEC_INITIALIZED=4244300 E: USEC_INITIALIZED=4244300
 [...]</code> [...]</code>
-  - Add rules for the interface name.<code>vim /lib/udev/rules.d/70-persistent-net.rules</code>In my case, the file is the following, but you need to adapt to your configuration.\\ = is for matching, == is for assignation.\\ Don't use the format with [Match] & [Link]. It's seem to be out of date and doesn't work with systemd.<code>SUBSYSTEM=="net", KERNELS=="0000:04:00.0", ATTR{address}=="00:08:a2:0c:b2:xx", NAME="eth0+  - Add rules for the interface name.<code>vim /lib/udev/rules.d/70-persistent-net.rules</code>In my case, the file is the following, but you need to adapt to your configuration.\\ = is for matching, == is for assignation.\\ Don't use the format with [Match] & [Link]. It's seem to be out of date and doesn't work with systemd.<code>SUBSYSTEM=="net", KERNELS=="0000:04:00.0", ATTR{address}=="00:08:a2:0c:b2:xx", NAME="lan0
-SUBSYSTEM=="net", KERNELS=="0000:03:00.0", ATTR{address}=="00:08:a2:0c:b2:xx", NAME="eth1+SUBSYSTEM=="net", KERNELS=="0000:03:00.0", ATTR{address}=="00:08:a2:0c:b2:xx", NAME="lan1
-SUBSYSTEM=="net", KERNELS=="0000:00:14.0", ATTR{address}=="00:08:a2:0c:b2:xx", NAME="eth2+SUBSYSTEM=="net", KERNELS=="0000:00:14.0", ATTR{address}=="00:08:a2:0c:b2:xx", NAME="lan2
-SUBSYSTEM=="net", KERNELS=="0000:00:14.1", ATTR{address}=="00:08:a2:0c:b2:xx", NAME="eth3+SUBSYSTEM=="net", KERNELS=="0000:00:14.1", ATTR{address}=="00:08:a2:0c:b2:xx", NAME="lan3
-SUBSYSTEM=="net", KERNELS=="0000:00:14.2", ATTR{address}=="00:08:a2:0c:b2:xx", NAME="eth4+SUBSYSTEM=="net", KERNELS=="0000:00:14.2", ATTR{address}=="00:08:a2:0c:b2:xx", NAME="lan4
-SUBSYSTEM=="net", KERNELS=="0000:00:14.3", ATTR{address}=="00:08:a2:0c:b2:xx", NAME="eth5"</code>+SUBSYSTEM=="net", KERNELS=="0000:00:14.3", ATTR{address}=="00:08:a2:0c:b2:xx", NAME="lan5"</code>
   - **Only for Jessie (and lower?)**: remove the existing udev rules in /etc and prevent the file generation on next reboot.<code>   - **Only for Jessie (and lower?)**: remove the existing udev rules in /etc and prevent the file generation on next reboot.<code>
 echo "# disable net-generator rules in /lib/udev" > /etc/udev/rules.d/75-persistent-net-generator.rules echo "# disable net-generator rules in /lib/udev" > /etc/udev/rules.d/75-persistent-net-generator.rules
Line 50: Line 50:
   - Adapt interfaces list (specific to your installation).<code>vim /etc/network/interfaces</code><code>[...]   - Adapt interfaces list (specific to your installation).<code>vim /etc/network/interfaces</code><code>[...]
 allow-hotplug eth1 allow-hotplug eth1
-iface eth1 inet dhcp+iface lan1 inet dhcp
 [...]</code> [...]</code>
   - Reboot<code>reboot</code>   - Reboot<code>reboot</code>
   - And check results.<code>ip a</code>   - And check results.<code>ip a</code>
   - Check the correspondence between NIC label and physical label.<code>tail -f /var/log/syslog | grep kernel</code>Connect and disconnect (physically) and check the corresponding line.<code>[...]   - Check the correspondence between NIC label and physical label.<code>tail -f /var/log/syslog | grep kernel</code>Connect and disconnect (physically) and check the corresponding line.<code>[...]
-Oct 30 10:11:50 3540 kernel: [  129.120407] igb 0000:04:00.0 eth0: igb: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX +Oct 30 10:11:50 3540 kernel: [  129.120407] igb 0000:04:00.0 lan0: igb: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX 
-Oct 30 10:11:52 3540 kernel: [  131.774607] igb 0000:04:00.0 eth0: igb: eth0 NIC Link is Down+Oct 30 10:11:52 3540 kernel: [  131.774607] igb 0000:04:00.0 lan0: igb: eth0 NIC Link is Down
 [...]</code> [...]</code>
   - If you have some trouble, you can add log.<code>vim /etc/udev/udev.conf</code><code>udev_log="debug"</code>But don't forget to remove after your fixing.   - If you have some trouble, you can add log.<code>vim /etc/udev/udev.conf</code><code>udev_log="debug"</code>But don't forget to remove after your fixing.
 +
 +<note tip>Why interface name suggested are lanX instead of ethX?</note>
 +I've made some tests with debian 8 and i encounter this problem:\\ 
 +If i comment 1 line in udev rules (for example eth4), eth4 retrieve his old default name (eth2) and eth2 get the name "rename". In this case, eth2 physical become eth4 and this is unsafe. For preventing this (and preventing a wrong naming when an interface is out of order), interface name is lanX.\\ 
 +If i comment the lan4 line in udev rules, lan4 (eth4 physical) become eth2, but lan2 stay lan2 and eth4 physical simply doesn't work because /etc/network/interfaces doesn't content ethX declarations.
 +
 + ====== Changing raspbian 9.9 (stretch) interface name ======
 +[[https://askubuntu.com/questions/947519/ubuntu-17-04-how-to-rename-a-usb-network-interface-based-on-path-not-based-on|source]]
 +
 +found Path and MAC address
 +<code>
 +ifconfig
 +udevadm info -e | grep -A 5 -B 18 "INTERFACE=eth"
 +</code>
 +
 +add files like 1x-lanx.link in /etc/systemd/network/ with rules like :
 +<code>
 +[Match]
 +Path=<id_path>
 +MACAddress=00:e0:4c:36:01:6b
 +
 +[Link]
 +Name=lan0
 +</code>
 +
 +
 +<note important>To get the id_path type: udevadm info /sys/class/net/<network interface name></note>
 +
 +add file 99-default.link in /etc/systemd/network/ with rules like :
 +<code>
 +[Link]
 +NamePolicy=kernel database onboard slot path
 +MACAddressPolicy=persistent
 +</code>
 +
 +to permit user-defined name of USB network interfaces, it's necessary to enable the 80-net-setup-link.rules rule with this command : 
 +<code>
 +sudo ln -s /lib/udev/rules.d/80-net-setup-link.rules /etc/udev/rules.d/80-net-setup-link.rules
 +</code>
 +
 + ====== Changing debian 11.1 (bullseye) interface name ======
 +
 +found ID_PATH and MAC address
 +<code>
 +udevadm info -e | grep -A 5 -B 18 "INTERFACE=<interface name>"
 +ip a
 +</code>
 +
 +edit files like 1x-lanx.link in /etc/systemd/network/ with rules like :
 +<code>
 +[Match]
 +Path=<id_path>
 +MACAddress=00:e0:4c:36:01:6b
 +
 +[Link]
 +Name=lan0
 +</code>
 +
 +make sure file 99-default.link is present in /etc/systemd/network/ with rules like :
 +<code>
 +[Link]
 +NamePolicy=kernel database onboard slot path
 +MACAddressPolicy=persistent
 +</code>
 +
 +to permit user-defined name of USB network interfaces, it's necessary to enable the 80-net-setup-link.rules rule with this command : 
 +<code>
 +sudo ln -s /lib/udev/rules.d/80-net-setup-link.rules /etc/udev/rules.d/80-net-setup-link.rules
 +</code>
operating_systems/linux/debian/interface_name.1509369200.txt.gz · Last modified: 2017/10/30 13:13 by kroduit