在通过 wifi 网卡连接到本地网络的 Debian 服务器上,我遇到以下问题
服务器WiFi ip:wlan0 192.168.1.117 服务器网线ip:eth0 192.168.1.100
来自服务器
我可以 ping -I wlan0 192.168.1.1 (默认网关)
我可以 ping -I wlan0 8.8.8.8
来自客户
当我 ping 192.168.1.117 上的服务器时,出现连接超时
当我浏览服务器上托管的网页 192.168.1.117 时,出现超时
如果我通过电缆将服务器连接到网络,我就可以通过 192.168.1.117 ping 服务器
/etc/network/interfaces 内容
# Wired adapter #1
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
# Wireless adapter #1
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.117
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8
broadcast 192.168.1.255
network 192.168.1.0
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
auto lo
iface lo inet loopback
/etc/wpa_supplicant/wpa_supplicant.conf 内容
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="DDkn1sS"
psk="KASOS123456"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}
ifconfig 结果
eth0 Link encap:Ethernet HWaddr 96:87:5f:a4:dd:b6
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::9487:5fff:fea4:ddb6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:297 errors:0 dropped:0 overruns:0 frame:0
TX packets:711 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26448 (25.8 KiB) TX bytes:91643 (89.4 KiB)
Interrupt:114
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:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 00:c0:ca:82:d5:01
inet addr:192.168.1.117 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::2c0:caff:fe82:d501/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:40 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13721 (13.3 KiB) TX bytes:828 (828.0 B)
客户端电脑尝试连接服务器时,arp -a 的结果
Interface: 192.168.1.5 --- 0x2
Internet Address Physical Address Type
192.168.1.1 6c-2e-85-16-4c-f0 dynamic
192.168.1.100 96-87-5f-a4-dd-b6 dynamic
192.168.1.117 96-87-5f-a4-dd-b6 dynamic
192.168.1.255 ff-ff-ff-ff-ff-ff static
224.0.0.22 01-00-5e-00-00-16 static
224.0.0.252 01-00-5e-00-00-fc static
239.255.255.250 01-00-5e-7f-ff-fa static
255.255.255.255 ff-ff-ff-ff-ff-ff static
编辑1
服务器上 ip 路由的结果
ip route
default via 192.168.1.1 dev eth0
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.117
如果我查看路由器设置,我可以在关联表中看到 WiFi 网卡的 mac 地址
我用了
route del -net 0.0.0.0 gw 192.168.1.1 netmask 0.0.0.0 dev eth0
在服务器上,但无济于事。