Tying Device Name in Linux Using ‘udev’

랩탑에서 윈도우즈를 사용해 왔었는데, 얼마 전부터 SVN 저장소 체크아웃이 파일명 길이 제한 때문에 실패해 작업에 어려움을 겪어 왔습니다. 궁여지책으로 리눅스를 설치하고 WiFi Radarxsupplicant로 무선랜도 성공적으로 설정했습니다만, 부팅할 때마다 이더넷 디바이스 이름이 eth0 가 되었다가 eth1 이 되었다가 하여서 매번 설정 파일을 손으로 수정해야 했습니다. 오늘 결국 참지 못하고 검색하여 udev rules 파일을 작성하면 해결할 수 있음을 알게 되었습니다. 다음은 udev rules 파일의 예입니다.

I’ve been using Windows on my laptop, but it started to fail to ‘svn co’ thanks to the infamous path length limitation. That’s why I’m on Linux now. It was really easy to configure sophisticated wireless network with WiFi Radar and xsupplicant. Only one problem was that the order that ethernet devices are detected is somewhat random. My Intel PRO/Wireless 2100 NIC is usually named as ‘eth0′, but sometimes as ‘eth1′. I had to modify the configuration files whenever the name changes since the last boot. Today, I googled about this issue and found that I can resolve it using a udev rules file. Following is the example of udev rules file:

KERNEL=”eth*”, SYSFS{address}=”<the lower-cased MAC address>”, NAME=”ethwireless”
KERNEL=”eth*”, SYSFS{address}=”<the lower-cased MAC address>”, NAME=”ethwired”
KERNEL=”eth*”, SYSFS{address}=”<the lower-cased MAC address>”, NAME=”ethfirewire”

이제 ethernet.rules 파일을 가리키는 심볼릭 링크를 /etc/udev/rules.d/ 디렉토리에 생성해 새 설정이 다음 부팅때부터 적용되도록 해야 합니다:

Now, we have to create a symbolic link to this file at /etc/udev/rules.d/ directory so the new settings get into action from the next boot:

# cd /etc/udev/rules.d
# ln -s ../ethernet.rules 030_ethernet.rules

재부팅하기 전 /etc/network/interfaces 나 /etc/wifi-radar.conf 같은 네트워크 설정 관련 파일의 인터페이스 이름을 적절히 변경하는 것을 잊지 마세요.

Please don’t forget to rename network interface names in configuration files such as /etc/network/interfaces and /etc/wifi-radar.conf.