“通用” wifi 适配器的默认网关设置

“通用” wifi 适配器的默认网关设置

数据表IOGear 通用 Wi-Fi N 适配器声明它支持 Linux(Fedora 10(内核:2.6.27.5-117)),但手册中没有说明。

使用 xfce 网络连接 GUI 设置静态 IP 地址时:

在此处输入图片描述

手册第 33 页给出了以下说明(针对 Mac):

在左侧窗格中选择您的以太网连接。接下来将配置更改为手动并输入 IP 地址 192.168.1.100 和子网掩码 255.255.255.0。删除路由器和 DNS 框中的所有条目,然后单击应用。

默认网关应该是 0.0.0.0 吗?或者,它应该是适配器获取互联网连接的路由器的 IP 地址(在本例中为 192.168.0.1)?我对默认网关的维基百科页面意思是可以,但我不太确定。

或者,它应该是适配器本身的 IP 地址?

答案1

网关应该是路由器的 IP,用于连接到互联网。将其设置为 0.0.0.0 不会有任何效果。找出网关的一种方法是使用已连接到互联网的系统,然后按键盘上的Ctrl+ Alt+T打开终端。打开后,运行以下命令:

route

这是输出: 在此处输入图片描述

要添加默认网关,您可以使用问题中的 GUI 实用程序,或者从终端使用。(在您的情况下)

sudo ip route add default via 192.168.0.1

答案2

一个关键步骤是关闭适配器的电源循环(是的,我不得不阅读详细的手册)。(此外,我还重置了适配器。)

复制interfaces.static到之后interfaces,我运行service networking restart并导航到 Firefox 192.168.1.252(如前所述)并配置无线(SSID 和密码)。

关键步骤是关闭适配器电源再打开。然后改回dhcp,重启网络。

thufir@dur:/etc/network$ 
thufir@dur:/etc/network$ ll
total 44
drwxr-xr-x   6 root root  4096 Jun  4 18:42 ./
drwxr-xr-x 166 root root 12288 Jun  9 14:58 ../
drwxr-xr-x   2 root root  4096 May 13 00:59 if-down.d/
drwxr-xr-x   2 root root  4096 May 13 00:50 if-post-down.d/
drwxr-xr-x   2 root root  4096 May 12 21:00 if-pre-up.d/
drwxr-xr-x   2 root root  4096 May 13 01:01 if-up.d/
-rw-r--r--   1 root root   268 Jun  9 15:08 interfaces
-rw-r--r--   1 root root   268 Jun  4 18:42 interfaces.dhcp
-rw-r--r--   1 root root   336 Jun  6 21:26 interfaces.static
lrwxrwxrwx   1 root root    12 May 12 20:17 run -> /run/network/
thufir@dur:/etc/network$ 
thufir@dur:/etc/network$ 
thufir@dur:/etc/network$ nl interfaces.static 
     1  # This file describes the network interfaces available on your system
     2  # and how to activate them. For more information, see interfaces(5).

     3  # The loopback network interface
     4  auto lo
     5  iface lo inet loopback

     6  # The primary network interface
     7  auto eth1
     8  iface eth1 inet static
     9  address 192.168.1.100
    10  netmask 255.255.255.0
    11  gateway 192.168.1.252
thufir@dur:/etc/network$ 
thufir@dur:/etc/network$ nl interfaces.dhcp 
     1  # This file describes the network interfaces available on your system
     2  # and how to activate them. For more information, see interfaces(5).

     3  # The loopback network interface
     4  auto lo
     5  iface lo inet loopback

     6  # The primary network interface
     7  auto eth1
     8  iface eth1 inet dhcp
thufir@dur:/etc/network$ 
thufir@dur:/etc/network$ ping 192.168.1.252
PING 192.168.1.252 (192.168.1.252) 56(84) bytes of data.
^C
--- 192.168.1.252 ping statistics ---
7 packets transmitted, 0 received, 100% packet loss, time 6048ms

thufir@dur:/etc/network$ 
thufir@dur:/etc/network$ ping ie100.net
PING ie100.net (61.147.105.17) 56(84) bytes of data.
64 bytes from 61.147.105.17: icmp_req=1 ttl=112 time=176 ms
64 bytes from 61.147.105.17: icmp_req=2 ttl=112 time=178 ms
64 bytes from 61.147.105.17: icmp_req=3 ttl=112 time=184 ms
64 bytes from 61.147.105.17: icmp_req=4 ttl=112 time=176 ms
64 bytes from 61.147.105.17: icmp_req=5 ttl=112 time=177 ms
64 bytes from 61.147.105.17: icmp_req=6 ttl=112 time=176 ms
^C
--- ie100.net ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5005ms
rtt min/avg/max/mdev = 176.565/178.483/184.375/2.757 ms
thufir@dur:/etc/network$ 
thufir@dur:/etc/network$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth1
link-local      *               255.255.0.0     U     1000   0        0 eth1
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
thufir@dur:/etc/network$ 
thufir@dur:/etc/network$ 

我不清楚的是为什么我无法 ping 通适配器。适配器已连接,192.168.1.252但我似乎无法 ping 通它。事实上,我不明白为什么我必须从静态更改为 dhcp,也不明白为什么我必须关闭路由器。也许路由器只接受来自某些 IP 地址的 ping,而当计算机使用 DHCP 连接时,它不会被分配那个神奇的 IP 地址?

我认为重置适配器并关闭电源循环可以“解决”问题。只是不明白我为什么要这么做。

相关内容