テスト環境を作ろうと Ubuntu 9.10 Server の仮想アプライアンスを取ってきてブートしたら eth0 が up しないという事態が発生。少々ハマりました。
結論は「VMware とかで Debian イメージをコピったら NIC が見えなくなる件」に書いてある通り、新しいMACアドレスで eth1 ができていました。ubuntu の場合は /etc/udev/rules.d/70-persistent-net.rules にMACアドレスと eth* との対応が書いてあります。
1 2 3 4 5 6 7 8 9 10 11 12 | $ sudo cat /etc/udev/rules.d/70-persistent-net.rules # This file was automatically generated by the /lib/udev/write_net_rules # program, run by the persistent-net-generator.rules rules file. # # You can modify it, as long as you keep each rule on a single # line, and change only the value of the NAME= key. # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:1f:93:3e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:1e:58:e2", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1" |
これを編集すればいいわけですが、ちょっと手を抜いて、設定ファイルをリネーム後再起動して解決しました。
1 2 | $ sudo mv /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.old $ sudo shutdown -r now |
自動で 70-persistent-net.rules を作り直してくれますので 新しいMACアドレスで eth0 の設定が作られます。確認してみましょう。
1 2 3 4 5 6 7 | $ sudo ls -l /etc/udev/rules.d/ total 20 -rw-r--r-- 1 root root 595 2009-11-03 22:20 70-persistent-cd.rules -rw-r--r-- 1 root root 443 2010-03-29 23:49 70-persistent-net.rules -rw-r--r-- 1 root root 631 2010-03-29 18:39 70-persistent-net.rules.old -rw-r--r-- 1 root root 813 2009-11-03 22:40 99-vmware-scsi-udev.rules -rw-r--r-- 1 root root 1157 2009-10-15 23:01 README |
できてますね。
1 2 3 4 5 6 7 8 9 | $ sudo cat /etc/udev/rules.d/70-persistent-net.rules # This file was automatically generated by the /lib/udev/write_net_rules # program, run by the persistent-net-generator.rules rules file. # # You can modify it, as long as you keep each rule on a single # line, and change only the value of the NAME= key. # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:1e:58:e2", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" |
大して手間は変わらない気もしますが、ミスはしにくいかも?
Popularity: 46% [?]