Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a wireless USB dongle connected to my computer, but which my system always labels as wlan1. What I would really like to do is rename the interface based on which slot ttyUSB0 or ttyUSB1 it is plugged into. Is this possible on Ubuntu?

share|improve this question
add comment

1 Answer

I have found out that I could achieve a similar thing by editing

nano /etc/udev/rules.d/70-persistent-net.rules

I had the following two lines:

# USB device 0x:0x (rtl8192cu)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="80:1f:02:a1:ae:3c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

# USB device 0x:0x (rtl8192cu)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="80:1f:02:a1:ae:4d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"

I have two USB ports. I have only one dongle. I found that by plugging in the dongle to the 1st port, it was named wlan0, and to the second port wlan1. For the lines above it looks like the same physical hardware was assigned a different MAC address depending on which USB port it was plugged into. I chose my own ordering by changing the lines to read the following way:

# USB device 0x:0x (rtl8192cu)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="80:1f:02:a1:ae:3c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

# USB device 0x:0x (rtl8192cu)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="80:1f:02:a1:ae:4d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.