온보드 이더넷을 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를 얻을 수 없습니다.

문제는 게이트웨이에 있다고 생각합니다. 왜 이런 일이 일어나는지 아는 사람이 있습니까? 미리 감사드립니다!

관련 정보