Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Unable to rename ethernet device to a specific name.

  1. #1
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,161

    Default Unable to rename ethernet device to a specific name.

    Hello.

    Config :
    leap_15.2 beta
    laptop asus rog strix
    test running on a virtualbox vm Version 6.1.8 r137981 (Qt5.9.7) but should be also use on real system.
    Using NetworkManager

    I want to change the interface name of the Ethernet card to a name of my choice.
    I have written a script to do that but that failed.
    I have read a lot of things on internet but nothing help me very much.

    List of things I have tried :
    1-)
    Create a /etc/udev/rules.d/99-persistent-net.rules with :
    Code:
    # PCI device 0x8086:0x100e (e1000)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:27:8c:4d:4b:a4", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="my_name"
    2-)
    or as suggested by deano_ferrari in https://forums.opensuse.org/showthre...rnet-card-name

    Code:
    ATTR{address}=="08:27:8c:4d:4b:a4", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="my_name"
    Note : Assigning a name 'eth0' to a mac address works but not assigning 'my_name'
    3-)
    as suggested by Sauerland in the same thread and reading
    https://www.freedesktop.org/wiki/Sof...nterfaceNames/
    and
    https://www.freedesktop.org/software...temd.link.html

    I try a link like example 2 in /etc/systemd/network/10-my_name.link
    Code:
    [Match] MACAddress=08:27:8c:4d:4b:a4
    
    [Link]
    Name=my_name
    4-)
    or as suggested by deano_ferrari in https://forums.opensuse.org/showthre...rned-to-ethX-!
    post #2 (concern leap 42.3)
    Code:
    /usr/lib/udev/write_net_rules -v -c my_name -n my_name -o /etc/udev/rules.d/70-persistent-net.rules
    but got an error :
    Code:
    missing $INTERFACE
    note :
    --------
    During my test i have tried to remove any reference to eth0 by removing any config files ( /etc/sysconfig/network, /etc/NetworkManager, /etc/udev/rules.d/99-persistent-net.rules )
    typing
    Code:
    nmcli con show
    always return a reference to eth0

    Any help is welcome.
    Thanks for helping. JCD
    __________
    server leap 15.0 -- ASUS g75vw KDE leap 15.0 -- ASUS G731GV KDE leap 15.1 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    12,417
    Blog Entries
    2

    Default Re: Unable to rename ethernet device to a specific name.

    I'm pretty sure you can't actually specify a custom network interface name and certainly not for the network device... Too many system functions depend on the standard naming conventions which would be broken if the name changed.

    But,
    It's possible to create a symbolic link (ie an alias but is not the same as "ip aliasing") so you can refer to the interface by some custom name.
    Note that if you do this, you should be able to use the custom name for your own purposes, but if you want to run common network utilities like ip tools, you'd still have to use the real names.
    Since you don't describe how you want to use this custom name, I can't say if this will work but AFAIK it's the only approximate solution to your post.

    Although you can read the MAN page for ip-link,
    Looks like the following top answer is very nice, the author extracted only what is essential to provide a distilled answer

    https://unix.stackexchange.com/quest...-the-interface

    HTH,
    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  3. #3
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,161

    Default Re: Unable to rename ethernet device to a specific name.

    Quote Originally Posted by tsu2 View Post
    I'm pretty sure you can't actually specify a custom network interface name and certainly not for the network device... Too many system functions depend on the standard naming conventions which would be broken if the name changed.
    .........
    ........
    HTH,
    TSU
    I am very surprise that any computer running any linux distro will fail into problem if an Ethernet card is named "my_lovely_card" rather than "eth0"
    From my great ignorance the string naming a device has nothing to do with the device itself.

    If all computer and/or network software are now based only on name 'eth0' or 'wlan0' then I can assure you that we will run into disaster.

    That said I will read your link.
    Thank you for your comments.
    Thanks for helping. JCD
    __________
    server leap 15.0 -- ASUS g75vw KDE leap 15.0 -- ASUS G731GV KDE leap 15.1 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

  4. #4
    Join Date
    Sep 2012
    Posts
    5,736

    Default Re: Unable to rename ethernet device to a specific name.

    Quote Originally Posted by jcdole View Post
    Create a /etc/udev/rules.d/99-persistent-net.rules with :
    Code:
    # PCI device 0x8086:0x100e (e1000)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:27:8c:4d:4b:a4", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="my_name"
    Works here (both with PCI address and MAC):
    Code:
    bor@10:~> ip l
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: my_net: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
        link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
    3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
        link/ether de:ad:be:ef:01:03 brd ff:ff:ff:ff:ff:ff
    bor@10:~> cat /etc/udev/rules.d/99-my-net.rules 
    #SUBSYSTEM=="net", ACTION=="add", DRIVERS=="virtio-pci", ATTR{dev_id}=="0x0", KERNELS=="0000:00:03.0", ATTR{type}=="1", KERNEL=="eth*", NAME="my_net"
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="virtio-pci", ATTR{dev_id}=="0x0", ATTR{address}=="52:54:00:12:34:56", ATTR{type}=="1", KERNEL=="eth*", NAME="my_net"
    bor@10:~>
    When is driver for your ethernet controller loaded? If in initrd, you need to recreate initrd so it includes your rule.

    Quote Originally Posted by jcdole View Post
    I am very surprise that any computer running any linux distro will fail into problem if an Ethernet card is named "my_lovely_card" rather than "eth0"
    "my_lovely_card" is at the limit of allowed name length so it will certainly be an issue if you try e.g. create VLAN on top of it.

  5. #5
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,161

    Default Re: Unable to rename ethernet device to a specific name.

    Quote Originally Posted by arvidjaar View Post
    Works here (both with PCI address and MAC):
    Code:
    bor@10:~> ip l
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: my_net: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
        link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
    3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
        link/ether de:ad:be:ef:01:03 brd ff:ff:ff:ff:ff:ff
    bor@10:~> cat /etc/udev/rules.d/99-my-net.rules 
    #SUBSYSTEM=="net", ACTION=="add", DRIVERS=="virtio-pci", ATTR{dev_id}=="0x0", KERNELS=="0000:00:03.0", ATTR{type}=="1", KERNEL=="eth*", NAME="my_net"
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="virtio-pci", ATTR{dev_id}=="0x0", ATTR{address}=="52:54:00:12:34:56", ATTR{type}=="1", KERNEL=="eth*", NAME="my_net"
    bor@10:~>
    When is driver for your ethernet controller loaded? If in initrd, you need to recreate initrd so it includes your rule.


    "my_lovely_card" is at the limit of allowed name length so it will certainly be an issue if you try e.g. create VLAN on top of it.
    I will try this quickly.

    ps : "my_lovely_card" is just a wink.
    Thanks for helping. JCD
    __________
    server leap 15.0 -- ASUS g75vw KDE leap 15.0 -- ASUS G731GV KDE leap 15.1 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

  6. #6
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    12,417
    Blog Entries
    2

    Default Re: Unable to rename ethernet device to a specific name.

    Quote Originally Posted by jcdole View Post
    I am very surprise that any computer running any linux distro will fail into problem if an Ethernet card is named "my_lovely_card" rather than "eth0"
    From my great ignorance the string naming a device has nothing to do with the device itself.

    If all computer and/or network software are now based only on name 'eth0' or 'wlan0' then I can assure you that we will run into disaster.

    That said I will read your link.
    Thank you for your comments.
    Maybe renaming will work OK for someone,
    But maybe you're confusing what is a device, what is an interface and the names that can be associated with the device or interface?
    Each are different, and are hooked into different parts of the system, some not easy to modify.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  7. #7
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,161

    Default Re: Unable to rename ethernet device to a specific name.

    Quote Originally Posted by arvidjaar View Post
    Works here (both with PCI address and MAC):
    Code:
    bor@10:~> ip l
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: my_net: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
        link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
    3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
        link/ether de:ad:be:ef:01:03 brd ff:ff:ff:ff:ff:ff
    bor@10:~> cat /etc/udev/rules.d/99-my-net.rules 
    #SUBSYSTEM=="net", ACTION=="add", DRIVERS=="virtio-pci", ATTR{dev_id}=="0x0", KERNELS=="0000:00:03.0", ATTR{type}=="1", KERNEL=="eth*", NAME="my_net"
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="virtio-pci", ATTR{dev_id}=="0x0", ATTR{address}=="52:54:00:12:34:56", ATTR{type}=="1", KERNEL=="eth*", NAME="my_net"
    bor@10:~>
    When is driver for your ethernet controller loaded? If in initrd, you need to recreate initrd so it includes your rule.
    Recreating initrd do the job.

    Great help
    Thanks for helping. JCD
    __________
    server leap 15.0 -- ASUS g75vw KDE leap 15.0 -- ASUS G731GV KDE leap 15.1 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

  8. #8
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,161

    Default Re: Unable to rename ethernet device to a specific name.

    Quote Originally Posted by arvidjaar View Post

    When is driver for your ethernet controller loaded? If in initrd, you need to recreate initrd so it includes your rule.
    How to find this info ?

    Looking at journald I found that the driver seems loaded by kernel.
    But how to know if it is loaded by initrd mechanism ? or something else ?.

    I have read opensuse doc "9 Introduction to the Boot Process" but that don't help me.
    Thanks for helping. JCD
    __________
    server leap 15.0 -- ASUS g75vw KDE leap 15.0 -- ASUS G731GV KDE leap 15.1 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

  9. #9
    Join Date
    Sep 2012
    Posts
    5,736

    Default Re: Unable to rename ethernet device to a specific name.

    Quote Originally Posted by jcdole View Post
    Looking at journald I found that the driver seems loaded by kernel.
    But how to know if it is loaded by initrd mechanism ?
    Is your driver module or built into kernel?
    If it is module - "lsinitrd /boot/initrd" - is your driver listed?

  10. #10
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,161

    Default Re: Unable to rename ethernet device to a specific name.

    Quote Originally Posted by arvidjaar View Post
    Is your driver module or built into kernel?
    If it is module - "lsinitrd /boot/initrd" - is your driver listed?
    No and I have found nothing that look likes 'e1000' or '82540'

    But lspci -v show :
    Code:
    00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
            Subsystem: Intel Corporation PRO/1000 MT Desktop Adapter
            Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 19
            Memory at e8600000 (32-bit, non-prefetchable) [size=128K]
            I/O ports at c1a0 [size=8]
            Capabilities: [dc] Power Management version 2
            Capabilities: [e4] PCI-X non-bridge device
            Kernel driver in use: e1000
            Kernel modules: e1000
    Yast hardware graphical show the same
    Code:
            Driver : e1000
                      Kernel Driver: e1000
    Thanks for helping. JCD
    __________
    server leap 15.0 -- ASUS g75vw KDE leap 15.0 -- ASUS G731GV KDE leap 15.1 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •