我想将我的Raspberry Pi设置为静态IP设备,它通过以太网进行通信(通过类似192.168.20.X的IP),同时它应该通过WLAN(192.168)连接到互联网。 1.1)。但是,当我允许'auto eth0'时,它不会配置wlan0。我希望他们两个都能工作。我目前的配置如下:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.20.40
netmask 255.255.255.0
network 192.168.20.1
gateway 192.168.20.1
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
我错过了什么?任何帮助,将不胜感激。提前谢谢。
解决:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.20.45
netmask 255.255.255.0
network 192.168.20.1
gateway 192.168.1.1 # Changing this worked
dns-nameservers 8.8.8.8 8.8.4.4
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
答案 0 :(得分:0)
<强>解决:强>
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.20.45
netmask 255.255.255.0
network 192.168.20.1
gateway 192.168.1.1 # Changing this worked
dns-nameservers 8.8.8.8 8.8.4.4
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
答案 1 :(得分:-1)
使用静态IP配置&#34; wlan0&#34;
它会正常工作