Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 9950  / 3 Years ago, fri, october 22, 2021, 2:48:41

I am trying to find a way to change the name of my Ralink interface to the usual wlan0.



The application I use is looking for this interface but since we changed our wifi adapter form Intel to ralink we miss the wlan0 because Ralink uses ra0 instead.



On all the forums and blogs I read that you need to change that in /etc/sysconfig/network-scripts/ifcfg-ra0. Ubuntu unfortunately does not have a /etc/sysconfig folder.


More From » wireless

 Answers
7

The device name is set by the kernel and renamed to a human readable value by udev. udev will run the 75-persistent-net-generator.rules script in /lib/udev/rules/ which will generate the rules file 70-persistent-net.rules in /etc/udev/rules.d/



This the generator script will add new rules to the 70-persistent-net.rules file for every network adapter that is recognized by the kernel. When you replace a network card (ruled eth0) the old card will not be deleted form the rules, the new one is added though (eth1).



In my situation the network adapters are continuously changing. The hard disk is copied and placed in another computer with ecxactly the same setup, but the MAC addresses will be different every time. The position (PCIe) in the computer however will be the same every time. I did the following:



I turned off the rules generator by removing it from udev, but moved it for backup purposes:



sudo mv /lib/udev/rules.d/75-persistent-net-generator.rules /home/user/backup/


The rules will not be generated anymore.
Then I edited the udev rules:



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


I removed the rules that were set by the generator and replaced them with:



ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:1c.0", NAME="eth0"
ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:1c.1", NAME="eth1"
ACTION=="add", SUBSYSTEM=="net", ATTR{type}==”1”, KERNEL=="ra*", NAME="wlan0"


Now my two network cards on the PCIe bus are named eth0 and eth1, and when I replace them, they will stay the same.



The last line will answer my question. The adapter passed by the kernel with a ra* name will be renamed to wlan0. In /etc/network/interfaces I can call "iface wlan0 inet dhcp"!



For me this is a working solution. I can copy this hard disk and put it in another machine with the same setup. AND IT WORKS! Now I can


[#33705] Sunday, October 24, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
neasinient

Total Points: 491
Total Questions: 120
Total Answers: 93

Location: The Bahamas
Member since Mon, Aug 2, 2021
3 Years ago
neasinient questions
;