使用 Ubuntu 19.04,我尝试使用 Wi-Fi 卡 (wlo1) 连接到临时网络,并使用以太网 (eno2) 访问互联网。以太网互联网连接本身工作正常。为了连接到临时网络,我的/etc/网络/接口文件如下:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto wlo1
iface wlo1 inet static
wireless-mode ad-hoc
wireless-channel 1
wireless-essid AdhocSSID
address 192.168.1.2
netmask 255.255.255.0
现在,有了这样的接口文件,我可以正确访问 Ad-Hoc 网络,但我无法再通过以太网访问互联网。这是ifconfig
上述接口文件的输出,它向我表明以太网连接仍然有效:
eno2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.129 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::9035:712a:baa8:687f prefixlen 64 scopeid 0x20<link>
ether b4:2e:99:39:dc:57 txqueuelen 1000 (Ethernet)
RX packets 30 bytes 7760 (7.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 51 bytes 6147 (6.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0x55300000-55320000
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 174 bytes 14210 (14.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 174 bytes 14210 (14.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlo1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::aa6d:aaff:fefd:661e prefixlen 64 scopeid 0x20<link>
ether a8:6d:aa:fd:66:1e txqueuelen 1000 (Ethernet)
RX packets 8 bytes 336 (336.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 53 bytes 6469 (6.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
有什么建议么?
编辑:我通过使用 169.254.xx 范围内的 Ad-Hoc IP 地址(而不是 192.168.1.x)解决了我的问题