Network naming on Arch Linux

7,984

Solution 1

From systemd v197 predictable network names were introduced.

With systemd 197 we have added native support for a number of different naming policies into systemd/udevd proper and made a scheme similar to biosdevname's (but generally more powerful, and closer to kernel-internal device identification schemes) the default.1

You can use ip link to show all of your devices.

You then have the choice of renaming any or all of those devices or continuing to use the ones that systemd/udev provide.

Should you wish to rename it/them to something that you feel more comfortable with, you can place a udev rule in /etc/udev/rules.d/ called 10-net-naming.rules, for example:

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="20:a7:d3:68:50:g8", NAME="ether"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="a8:c7:43:1d:f4:53", NAME="wifi"

would rename wireless and ethernet to, imaginatively, wifi and ether. You then need to update your network manager to use the new names.

There is a very detailed post on the Arch Mailing Lists announcing the change.


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

Solution 2

I don't have a wireless card on my Arch box, but I can do what you require using ip on a spare ethernet device eth1, like this:

# view network devices and addresses
$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether __MAC_ADDRESS__ brd __IPv6_BROADCAST__
    inet __IP_ADDRESS__/24 brd __BROADCAST__ scope global eth0
    inet6 __IPv6 ADDRESS__/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether __MAC_ADDRESS__ brd __IPv6_BROADCAST__

$ # must bring down eth1 before renaming it.
$ sudo ip link set dev eth1 down

$ # rename eth1 to ethfoo
$ sudo ip link set dev eth1 name ethfoo

$ # show 'ethfoo' device status
$ ip addr show dev ethfoo
3: ethfoo: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether 48:5b:39:5d:89:2c brd ff:ff:ff:ff:ff:ff

$ # bring ethfoo back up
$ sudo ip link set dev ethfoo up

I imagine ip should also work identically with a wireless device, and if not, iw would hopefully provide the same functionality..

Share:
7,984

Related videos on Youtube

Mitro
Author by

Mitro

I used computer for the first time when I was 10 and now it's my primary occupation. I like looking at the things I use daily and ask myself questions such as “How it is made?”, “How does it work?”, or "Could I do it better?". Something that "just works" isn't good enough for me. I always want to do the best with everything I use or develop. I like learning and love coding.

Updated on September 18, 2022

Comments

  • Mitro
    Mitro over 1 year

    I've just installed Arch Linux on my old PC, to do the installation I used wifi-menu wlan0, now I've reboot but if I type:

    ifconfig wlan0 up
    

    I have as a result:

    wlan0: ERROR while getting interface flag: no such device
    

    I read that after the installation Arch changes the name of wlan, how can I find the new name and how could I change it?

    • Admin
      Admin about 11 years
      Run iwconfig, it should tell you the names of the detected interfaces.
    • Admin
      Admin about 11 years
      ifconfig and iwconfig are deprecated in favour of the ip and iw utilities. I can't find anything official atm to support this, but I know they're not installed on a base Arch linux system. See here for a map of the old nettools family of commands to their newer counterparts from the iproute2 package.
    • Admin
      Admin about 11 years
      'iw' and 'iwconfig' give me as result -bash: iw: command not found
    • Admin
      Admin about 11 years
      Ok well, I type in the terminal dmesg and in the last lines I found the new name of my wireless (wlp0s19f5u4 WTF??) How can I change?
    • Admin
      Admin about 11 years
      Read my answer...
    • Admin
      Admin about 10 years
      @Braiam The tags I added were (a) relevant, and (b) exclusively so. What is your justification for removing them?
    • Admin
      Admin about 10 years
      @jasonwryan I don't see where OP mentioned any of those terms, and only see them in your answer. Tags are not supposed to reflect the kind of answers OP expects, but the kind of question they ask. Alex answer didn't have anything to do with systemd or hal, for example.
    • Admin
      Admin about 10 years
      @Braiam systemd and udev are how Arch does networking: OP may not be aware of that, but that is the reality. People wanting to understand how this works would benefit from more context, not an arbitrarily limited view imposed by the ignorance of the questioner.
  • cinelli
    cinelli about 11 years
  • jasonwryan
    jasonwryan about 11 years
    Isn't that the link I included in my final sentence? :)
  • cinelli
    cinelli about 11 years
    You're a tricky man. You little trickster.