# いや、onboard NIC が壊れると言う事態は
製品 : ELECOM LD-CBK/TX
interface : PCMCIA TypeII 32bit CardBus
速度 : 100BASE-TX
NIC chip : RTL8169sb/8110sb
今の linux は eth1 と言う interface名が勝手に改称されてしまう もの らしい# dmesg [ 23.420620] r8169 0000:16:00.0 eth1: RTL8169sb/8110sb at 0xf82de000, xx:xx:xx:xx:xx:xx, XID 10000000 IRQ 16 [ 23.420623] r8169 0000:16:00.0 eth1: jumbo features [frames: 7152 bytes, tx checksumming: ok] [ 23.483176] r8169 0000:16:00.0 enp22s0: renamed from eth1 [ 25.303865] r8169 0000:16:00.0 enp22s0: link up
どうやら動作している らしい# lsmod |grep 8169 r8169 73728 0 mii 16384 1 r8169
# これに該当する firmware が含まれなければ別の package を探す事に なるが、大体は これに含まれる
そして install# deb http://ftp.jp.debian.org/debian/ stretch main contrib non-free deb http://ftp.jp.debian.org/debian stretch-updates main contrib non-free deb http://security.debian.org/ stretch/updates main contrib non-free
# apt-get install firmware-misc-nonfree
# 実は他の周辺機器で既に firmware-misc-nonfree を導入していたので、今回の NIC で firmware-misc-nonfree が必要で あったのか どうかは良く分からない
# apt-get install ifenslave-2.6
bonding module が読み込まれた事を確認して おく# modprobe bonding mode=1
指定された bonding mode が有効化されている事を確認# lsmod | grep bonding bonding 110909 0
bond0 が存在している事を確認# cat /sys/class/net/bond0/bonding/mode
active-backup 1
interface を落とす# ifconfig bond0
eth0 を後回し に した方が良い らしい# ifconfig enp22s0 down
# ifconfig eth0 down
仮に bond0 に IP address を割り当てつつ 有効化し動作を試す[3132220.502529] bonding: bond0: Warning: the permanent HWaddr of eth0 - xx:xx:xx:xx:xx:xx - is still in use by bond0 - set the HWaddr of eth0 to a different address to avoid conflicts
bond0 に対象 interface を編入# ifconfig bond0 192.168.0.11 netmask 255.255.255.0 up
編入した interface を起こす# ifenslave bond0 eth0 enp22s0
interface 状態が bond0:MASTER, eth0:SLAVE, enp22s0:SLAVE で ある事を確認して おく# ifconfig eth0 up
# ifconfig enp22s0 up
bonding 状態を確認# ifconfig bond0 bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500 inet 192.168.0.11 netmask 255.255.255.0 broadcast 192.168.0.255 # ifconfig eth0 eth0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500 # ifconfig enp22s0 enp22s0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
経路を追加する# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: xx:xx:xx:xx:xx:xx
Slave queue ID: 0
Slave Interface: enp22s0
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: xx:xx:xx:xx:xx:xx
Slave queue ID: 0
IP packet を送受信可能か試す# route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.0.1
ここまで正常に進めば、手作業での bonding 動作は成功している と見て良い# ping 192.168.0.1
# ping www.ocn.co.jp
# cd /etc/modprobe.d/
# vi bonding.conf
自動読み込み module に bonding を登録alias bond0 bonding options bonding mode=1 miimon=100
# cd /etc
# cp -p modules modules.org
# vi modules
interface 設定を編集bonding
# cd /etc/network
# vi interfaces
上記では bond-primary enp22s0 と しているが、通常は bond-primary eth0 を指定するか# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet manual bond-master bond0 bond-primary enp22s0 allow-hotplug enp22s0 iface enp22s0 inet manual bond-master bond0 bond-primary enp22s0 auto bond0 iface bond0 inet static address 192.168.0.11 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1 # dns-* options are implemented by the resolvconf package, if installed # dns-nameservers xxx.xxx.xxx.xxx # dns-search xxx.xxx.xx bond_downdelay 200 bond_updelay 200
手動で ifconfig eth up すれば UP するので、OS 起動時の interface up script で bonding slave 制御を行って おり、明示的に記載してしまうと interface up script と conflict してしまう ので あろうと思うauto bond0 iface bond0 inet static slaves eth0 enp22s0 bond_downdelay 200 bond_updelay 200
OS 起動後、bonding 状態が Primary Slave: enp2s10 に変更されている事を確認# shutdown -r now
どうやら正常に完了した らしい# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: enp2s10 (primary_reselect always)
Currently Active Slave: enp2s10
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: xx:xx:xx:xx:xx:xx
Slave queue ID: 0
Slave Interface: enp22s0
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: xx:xx:xx:xx:xx:xx
Slave queue ID: 0
# ifenslave -d bond0 enp2s10
# どう言った状況で使用するのか? 動作検証時?