オンボードイーサネットをUSBモデムドングルにバインド

オンボードイーサネットをUSBモデムドングルにバインド

私はRaspbianオペレーティングシステムがインストールされているRaspberryPi 3b +を持っています。

USBモデムドングル(Huawei E3372、HiLink fw)を使用してオンボードイーサネットをバインドしようとしています。

これ質問イーサネットケーブルがオフの場合です。ゲートウェイドングルのパス以外のデフォルトパスは変更されません。

usb_modeswitchを持つドングル自体がeth1インターフェースになります。

構成は次のとおりです。

# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

bonding

# cat /etc/modprobe.d/bonding.conf
options bonding fail_over_mac=active mode=active-backup primary=eth0 primary_reselect=always

# cat /etc/network/interfaces.d/0_lo
auto lo
iface lo inet loopback

# cat /etc/network/interfaces.d/10_eth0
auto eth0
allow-hotplug eth0
iface eth0 inet manual
    bond-master bond0
    bond-primary bond0

# cat /etc/network/interfaces.d/11_eth1
auto eth1
allow-hotplug eth1
iface eth1 inet manual
    bond-master bond0
    pre-up sleep 15 #it needs time for raspi to obtain an IP from the dongle

# cat /etc/network/interfaces.d/20_bond0
auto bond0
iface bond0 inet manual
    bond-slaves           none
    bond-miimon           200
    bond-updelay          200
    bond-downdelay        200
    dns-nameservers       8.8.8.8
    dns-nameservers       8.8.4.4

# cat /etc/dhcpcd.conf
...
denyinterfaces eth0 eth1
...

# ifconfig
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>  mtu 1500
        inet 192.168.1.103  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 aaaa::aaaa:aaaa:aaaa:aaaa  prefixlen 64  scopeid 0x20<link>
        ether XX:XX:XX:XX:XX:XX  txqueuelen 1000  (Ethernet)
        RX packets 82  bytes 17140 (16.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 91  bytes 13715 (13.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether XX:XX:XX:XX:XX:XX  txqueuelen 1000  (Ethernet)
        RX packets 58  bytes 8247 (8.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 91  bytes 13715 (13.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether YY:YY:YY:YY:YY:YY  txqueuelen 1000  (Ethernet)
        RX packets 24  bytes 8893 (8.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 8  bytes 600 (600.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 600 (600.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.253.1  netmask 255.255.255.0  broadcast 192.168.253.255
        inet6 ssss::ssss:ssss:ssss:ssss  prefixlen 64  scopeid 0x20<link>
        ether ZZ:ZZ:ZZ:ZZ:ZZ:ZZ  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 29  bytes 4600 (4.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.254   0.0.0.0         UG    202    0        0 bond0
192.168.1.0     0.0.0.0         255.255.255.0   U     202    0        0 bond0
192.168.253.0   0.0.0.0         255.255.255.0   U     304    0        0 wlan0

# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup) (fail_over_mac active)
Primary Slave: eth0 (primary_reselect always)
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 200
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: eth1
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: YY:YY:YY:YY:YY:YY
Slave queue ID: 0

# dmesg | grep bond
[    4.686567] IPv6: ADDRCONF(NETDEV_UP): bond0: link is not ready
[    4.735082] bond0: making interface eth0 the new active one
[    4.736341] bond0: Enslaving eth0 as an active interface with an up link
[    4.737083] IPv6: ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
[   20.709485] bond0: Enslaving eth1 as a backup interface with an up link

シナリオ 1.イーサネットケーブル存在する、USBドングル入力。

両方の ethX インターフェイスが動作しており、デフォルトのルーティングゲートウェイは 192.168.1.254 です。ネットワークがうまく動作しています!

ケース 2.イーサネットケーブル出る、USBドングル入力。

eth0 インターフェイスは停止し、eth1 は動作し、デフォルトのルーティングゲートウェイは同じに 192.168.1.254 のままです。インターネットいいえ布材。

/etc/dhcpcd.confに入れると、denyinterfaces bond0利用可能なデフォルトパスがまったくなく、インターフェイスがIPを取得できません。

問題はゲートウェイにあると思います。なぜこれが起こるのか知っている人はいますか?よろしくお願いします!

ベストアンサー1

おすすめ記事