최근 VirtualBox를 가지고 놀고 있는데, 너무 자주 설치하는 것 같아서 기본 시스템을 만들어 놓고 거기서 복제하는 방식으로 가려고 했다.
그런데 복제를 하면 eth0가 사라지고 eth1이 생기는 것 아닌가? 이러니 dhcp로 설정을 하더라도 제대로 네트웍 카드를 못찾는 문제가 발생한다.
수동으로 이 문제를 해결하려면 lshw 명령으로 네트웍 카드의를 확인하고 /etc/network/interface 파일을 수정하면 된다.
$ lshw -class network
/etc/network/interface:
auto eth0
iface eth0 inet static
address 115.68.55.200
netmask 255.255.255.0
network 115.68.55.0
broadcast 115.68.55.255
gateway 115.68.55.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers ?
우선 수동으로 해결하고 문제가 뭔지 잠깐 구글링 해보니 역시나 문제는 우분투 시스템이었다.
Duplicated Virtual Machines Have Same IP Address
Ok, that Ubuntu issue is a known problem. It saves the assignment of MAC <==> ethX using an udev rule. Have a look at /etc/udev/rules.d and you will find a file 70-persistent-net.rules there. You can savely remove this file. This file is auto-generated by /lib/udev/rules.d/75-persistent-net-generator.rules. You can remove that file as well. From now on, the guest will no longer store the assignment between the MAC and ethX interface.
정리하자면 우분투는 MAC 주소화 ethX를 mapping하고 있고, 그 데이터는 /etc/udev/rules.d/70-persistent-net.rules에 있는 것이구나.
잠깐 더 조사해보니 그냥 /etc/udev/rules.d/70-persistent-net.rules를 지워버리는 건 의미 없다. 어짜피 그 파일은 현재 상태를 NIC와 ethX를 지정해 놓는 파일이고, 실제로 이 짓을 하는 것은 /lib/udev/write_net_rules 다.
$ chmod -x /lib/udev/write_net_rules
근데 잠깐 더 생각해보니, 이 기능이 있는건 NIC가 막 바뀌는 경우는 해당 디바이스와 네트웍 설정을 기억하게 해서 괜찮은 기능이겠다. 없다면 물리적 순서에 의해서 eth0부터 정해질 것이고, 이 순서가 바뀔 가능성이 있는 시스템이면 네트웍 잡기가 혼란스럽겠다.
결국 실행권한을 주는 것 보다는, 네트웍 환경이 바뀌면 저 파일을 지워버리자~