Linux Mint 中的 eth0 和 wlan0 设置问题

Linux Mint 中的 eth0 和 wlan0 设置问题

我的 Mint-KDE PC 上的 Wi-Fi 连接运行良好。最近,我带来了一台 Synology NAS,经过一番研究后发现我需要将 eth0 设置为静态 IP,以便它通过以太网线连接到 NAS。所以,我将这一行添加到我的/etc/network/interfaces文件中:

auto eth0
iface eth0 inet static
address 192.168.1.99
netmask 255.255.255.0
gateway 192.168.1.100

现在,在我重新启动电脑后,我的以太网连接到 Synology 正常,但我遇到了一个新问题,我的互联网连接消失了。它说连接“my_wifi_name”已连接,但我没有互联网,即使ping google.com在终端中也没有响应。 ( ping: unknown host google.com)

这是我在更改/etc/network/interfaces文件之前的 ifconfig 响应:(使用此设置,LAN 无法连接到 NAS,它给了我Connection 'Wired Connection 1' deactivated。)

$ ifconfig
eth0      Link encap:Ethernet  HWaddr c8:60:00:de:b7:da  
          inet6 addr: fe80::ca60:ff:fede:b7da/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:63 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3540 (3.5 KB)  TX bytes:12967 (12.9 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:651 errors:0 dropped:0 overruns:0 frame:0
          TX packets:651 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:85658 (85.6 KB)  TX bytes:85658 (85.6 KB)

vmnet1    Link encap:Ethernet  HWaddr 00:50:56:c0:00:01  
          inet addr:172.16.82.1  Bcast:172.16.82.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:104 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

vmnet8    Link encap:Ethernet  HWaddr 00:50:56:c0:00:08  
          inet addr:192.168.156.1  Bcast:192.168.156.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:105 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 64:70:02:f0:b9:7f  
          inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::6670:2ff:fef0:b97f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:627 errors:0 dropped:0 overruns:0 frame:0
          TX packets:626 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:395824 (395.8 KB)  TX bytes:110123 (110.1 KB)

这是我更改/etc/network/interfaces文件后的 ifconfig 响应:(使用此设置,wi-fi 和 LAN 都连接到 NAS,但尽管 wi-fi 连接状态成功,但互联网不可用。)

$ ifconfig
eth0      Link encap:Ethernet  HWaddr c8:60:00:de:b7:da  
          inet addr:192.168.1.99  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::ca60:ff:fede:b7da/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:140 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3540 (3.5 KB)  TX bytes:17523 (17.5 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:894 errors:0 dropped:0 overruns:0 frame:0
          TX packets:894 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:88248 (88.2 KB)  TX bytes:88248 (88.2 KB)

vmnet1    Link encap:Ethernet  HWaddr 00:50:56:c0:00:01  
          inet addr:172.16.82.1  Bcast:172.16.82.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

vmnet8    Link encap:Ethernet  HWaddr 00:50:56:c0:00:08  
          inet addr:192.168.156.1  Bcast:192.168.156.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 64:70:02:f0:b9:7f  
          inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::6670:2ff:fef0:b97f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:60 errors:0 dropped:0 overruns:0 frame:0
          TX packets:59 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3465 (3.4 KB)  TX bytes:11879 (11.8 KB)

我在这里做错了什么?我不知道,谷歌搜索也没有帮助。谢谢。

编辑:这是我的 ip 路由命令输出:

$ ip route
default via 192.168.1.1 dev wlan0  proto static 
172.16.82.0/24 dev vmnet1  proto kernel  scope link  src 172.16.82.1 
192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.4  metric 9 
192.168.156.0/24 dev vmnet8  proto kernel  scope link  src 192.168.156.1 

另外,我随机选择了地址和网关/etc/network/interfaces,一开始我将其更改为原始问题中所示的另一个值,希望它能够正常工作。我显然不知道这些值意味着什么,我认为这些是将与 eth0 关联的静态 IP,我的 Synology 将读取它并锁定到该静态地址。

第一次尝试使用的“/etc/network/interfaces”文件:

auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1

相关内容