Last Update: 2014/10/14
久しぶりにやって大ハマりしたので、メモ。
XenServer等の仮想システムで、GuestOSにCentOS6を利用している場合に、NICの割当がうまく行かなくなる事がある。 この原因を明確にすべく実験してみた。
仮想システム上に作成したCentOSを用いて、以下の試験を行う
試験環境は以下の通り。
まず、思い通りにNICにeth番号を割り当てる方法を以下に記載する
# udevadm info -a -p /sys/class/net/eth0/ Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device. looking at device '/devices/vif-0/net/eth0': KERNEL=="eth0" ← 見ている疑似NIC SUBSYSTEM=="net" DRIVER=="" ATTR{addr_assign_type}=="0" ATTR{addr_len}=="6" ATTR{dev_id}=="0x0" ATTR{ifalias}=="" ATTR{iflink}=="6" ATTR{ifindex}=="6" ATTR{features}=="0x50803" ATTR{type}=="1" ← 意味は(現時点で)不明だが、必須情報 ATTR{link_mode}=="0" ATTR{address}=="00:00:00:00:00:01" ATTR{broadcast}=="ff:ff:ff:ff:ff:ff" ATTR{operstate}=="down" ATTR{mtu}=="1500" ATTR{flags}=="0x1002" ATTR{tx_queue_len}=="1000" ATTR{rxbuf_min}=="64" ATTR{rxbuf_max}=="256" ATTR{rxbuf_cur}=="128" looking at parent device '/devices/vif-0': KERNELS=="vif-0" ← Kernel内部のDevice名 SUBSYSTEMS=="xen" ← Kernel内部で上記Deviceが生えているSubsystem名 DRIVERS=="vif" ← Kernel内部のDevice Driver ATTRS{nodename}=="device/vif/0" ATTRS{devtype}=="vif" ATTRS{modalias}=="xen:vif"
ACTION=="add", SUBSYSTEMS=="xen", KERNELS=="vif-0", DRIVERS=="?*", NAME="eth0", OPTIONS="last_rule" ACTION=="add", SUBSYSTEMS=="xen", KERNELS=="vif-1", DRIVERS=="?*", NAME="eth1", OPTIONS="last_rule" ACTION=="add", SUBSYSTEMS=="xen", KERNELS=="vif-2", DRIVERS=="?*", NAME="eth2", OPTIONS="last_rule" ACTION=="add", SUBSYSTEMS=="xen", KERNELS=="vif-3", DRIVERS=="?*", NAME="eth3", OPTIONS="last_rule" ACTION=="add", SUBSYSTEMS=="xen", KERNELS=="vif-4", DRIVERS=="?*", NAME="eth4", OPTIONS="last_rule"
ということになる。