![如何设置 14.04 以使用两个独立的网络?](https://linux22.com/image/1005118/%E5%A6%82%E4%BD%95%E8%AE%BE%E7%BD%AE%2014.04%20%E4%BB%A5%E4%BD%BF%E7%94%A8%E4%B8%A4%E4%B8%AA%E7%8B%AC%E7%AB%8B%E7%9A%84%E7%BD%91%E7%BB%9C%EF%BC%9F.png)
我如何设置 14.04 使用两个独立的网络?
/etc/network/interfaces
auto lo
iface lo inet loopback
# purpose of eth0 is private lan
iface eth0 inet static
address 192.168.2.44
gateway 192.168.2.1
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
# wlan2 or wlan0
# purpose of wlanx is internet access
iface wlan2 inet static
address 192.168.1.44
gateway 192.168.1.1
netmast 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
然后
sudo ifconfig eth0 down (and up)
sudo ifconfig wlan2 down (and up)
sudo /etc/init.d/networking restart
当我 ping 8.8.8.8 时,它说网络不可达
请指教。
注意:我没有安装 wpa_supplicant,也没有 /etc/wpa_supplicant.conf 文件。我想我需要安装 wpa_supplicant。
谢谢你,鲍勃
答案1
您的文件有点忙,缺少一些关键细节。我建议您尝试:
auto lo
iface lo inet loopback
# purpose of eth0 is private lan
auto eth0
iface eth0 inet static
address 192.168.2.44
netmask 255.255.255.0
gateway 192.168.2.1
# wlan2 or wlan0
# purpose of wlanx is internet access
auto wlan2
iface wlan2 inet static
address 192.168.1.44
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1 8.8.8.8
wpa-ssid your_network_name
wpa-psk your_secret_key
然后重新启动或者:
sudo ifdown eth0 && sudo ifup eth0
sudo ifdown wlan2 && sudo ifup -v wlan2