我想要华为 E3327 作为 Raspberry Pi 4B 的备用设备。调制解调器显示恒定的青色指示灯,这意味着已建立 4G 连接(我之前使用 Windows 机器配置了 APN)。
我成功地使用 usb_modeswitch 将调制解调器切换到正确的状态,并且eth1
出现了一个新的网络接口。
我配置了静态IP,我的/etc/network/interfaces
样子:
# Drop-in configs
source interfaces.d/*
# Ethernet
allow-hotplug eth0
iface eth0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 192.168.0.1
# WiFi
allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 192.168.0.1
wireless-power off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
# hotspot
iface wlan1 inet static
address 192.168.42.1
netmask 255.255.255.0
gateway 192.168.42.1
dns-nameservers 192.168.42.1
#HUAWEI E3372
allow-hotplug eth1
iface eth1 inet static
address 192.168.8.100
netmask 255.255.255.0
network 192.168.8.0
broadcast 192.168.8.255
还有 RasPi 的内部 WiFi 连接和配置为热点的外部 USB WiFi 适配器,可以正常工作。
问题:我只能ping 8.8.8.8
在有 wifi 连接时才能使用。华为的调制解调器好像不能用。Network is unreachable
当我尝试时没有无线网络连接ping 8.8.8.8
建立 wifi 连接后,ip address
显示:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether d8:3a:dd:01:c0:55 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether d8:3a:dd:01:c0:56 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.136/24 brd 192.168.0.255 scope global dynamic wlan0
valid_lft 603872sec preferred_lft 603872sec
4: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2312 qdisc mq state UP group default qlen 1000
link/ether 34:60:f9:64:4f:98 brd ff:ff:ff:ff:ff:ff
5: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:1e:10:1f:00:00 brd ff:ff:ff:ff:ff:ff
inet 192.168.8.100/24 brd 192.168.8.255 scope global eth1
valid_lft forever preferred_lft forever
当没有 WiFi 连接时,如何使调制解调器工作并充当后备设备?