我刚刚用 Debian 7 双启动了 Windows 7,在安装过程中它说缺少 wifi 固件,所以我在没有互联网连接的情况下安装,安装后我用 LAN 电缆来安装各种程序,但现在我在配置时遇到问题wifi连接,在windows分区上wifi工作正常。
所以我做的第一件事就是为我的 wifi 卡安装模块,即:
Intel Centrino Advanced-N 6205
我通过安装做到了无线网络在 apt-get 上。之后它识别了我的卡,我想,因为我可以扫描网络:
root@debian:/home/user# iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 7A:B6:86:83:0A:08
Channel:1
Frequency:2.412 GHz (Channel 1)
Quality=48/70 Signal level=-62 dBm
Encryption key:on
ESSID:"NETWORK"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 9 Mb/s
18 Mb/s; 36 Mb/s; 54 Mb/s
Bit Rates:6 Mb/s; 12 Mb/s; 24 Mb/s; 48 Mb/s
Mode:Master
Extra:tsf=00000008c098b443
Extra: Last beacon: 2952ms ago
IE: Unknown: 00074E4554574F524B
IE: Unknown: 010882848B961224486C
IE: Unknown: 030101
IE: Unknown: 2A0100
IE: Unknown: 32040C183060
IE: Unknown: DD180050F2020101000003A4000027A4000042435E0062322F00
IE: Unknown: 0B05010045127A
IE: Unknown: DD07000C4304000000
IE: Unknown: 0706434120010D10
然后我安装了 iw 来尝试连接到网络:
root@debian:/home/user# iw dev wlan0 link
Connected to 7a:b6:86:83:0a:08 (on wlan0)
SSID: NETWORK
freq: 2412
RX: 33045 bytes (536 packets)
TX: 1232 bytes (17 packets)
signal: -59 dBm
tx bitrate: 1.0 MBit/s
bss flags: short-preamble short-slot-time
dtim period: 0
beacon int: 100
它说我已连接到路由器,但我仍然无法访问互联网。
更多输出:
如果配置:
root@debian:/home/user# ifconfig
eth0 Link encap:Ethernet HWaddr 3c:d9:2b:25:51:cb
inet addr:192.168.1.72 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::3ed9:2bff:fe25:51cb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:101484 errors:0 dropped:0 overruns:0 frame:0
TX packets:59551 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:139315514 (132.8 MiB) TX bytes:5061083 (4.8 MiB)
Interrupt:20 Memory:d1500000-d1520000
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:343 errors:0 dropped:0 overruns:0 frame:0
TX packets:343 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:30800 (30.0 KiB) TX bytes:30800 (30.0 KiB)
wlan0 Link encap:Ethernet HWaddr a0:88:b4:85:f5:cc
inet addr:192.168.1.74 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a288:b4ff:fe85:f5cc/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:297 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:26754 (26.1 KiB)
编辑:
root@debian:/home/user# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_req=1 ttl=64 time=1884 ms
64 bytes from 192.168.1.1: icmp_req=2 ttl=64 time=876 ms
64 bytes from 192.168.1.1: icmp_req=3 ttl=64 time=0.813 ms
64 bytes from 192.168.1.1: icmp_req=4 ttl=64 time=0.814 ms
64 bytes from 192.168.1.1: icmp_req=5 ttl=64 time=0.845 ms
64 bytes from 192.168.1.1: icmp_req=6 ttl=64 time=0.738 ms
64 bytes from 192.168.1.1: icmp_req=7 ttl=64 time=0.737 ms
64 bytes from 192.168.1.1: icmp_req=8 ttl=64 time=0.752 ms
64 bytes from 192.168.1.1: icmp_req=9 ttl=64 time=0.830 ms
64 bytes from 192.168.1.1: icmp_req=10 ttl=64 time=0.762 ms
64 bytes from 192.168.1.1: icmp_req=11 ttl=64 time=0.768 ms
64 bytes from 192.168.1.1: icmp_req=12 ttl=64 time=0.748 ms
64 bytes from 192.168.1.1: icmp_req=13 ttl=64 time=0.784 ms
64 bytes from 192.168.1.1: icmp_req=14 ttl=64 time=0.743 ms
^C
--- 192.168.1.1 ping statistics ---
14 packets transmitted, 14 received, 0% packet loss, time 13006ms
rtt min/avg/max/mdev = 0.737/197.826/1884.227/518.915 ms, pipe 2
root@debian:/home/user# ping 8.8.8.8
connect: Network is unreachable
我还注意到,当我连接到路由器时,只有在输入 dhclient wlan0 后才获得 inet 地址:
root@debian:/home/user# dhclient wlan0
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
--- 192.168.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.984/0.984/0.984/0.000 ms
我确实得到了一个 inet 地址。但仍然没有互联网,而且,在获取inet地址后ping路由器会输出错误:
root@debian:/home/user# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.74 icmp_seq=2 Destination Host Unreachable
From 192.168.1.74 icmp_seq=5 Destination Host Unreachable
From 192.168.1.74 icmp_seq=8 Destination Host Unreachable
From 192.168.1.74 icmp_seq=17 Destination Host Unreachable
^C
--- 192.168.1.1 ping statistics ---
20 packets transmitted, 0 received, +4 errors, 100% packet loss, time 19120ms
编辑2:
root@debian:/home/user# ip route
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.72
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.74
root@debian:/home/user# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 wlan0
编辑3:
目前根本无法连接到网络:
root@debian:/home/user# ifconfig wlan0 up
root@debian:/home/user# iw dev wlan0 connect NETWORK keys 1:password
root@debian:/home/user# iw dev wlan0 link
Not connected.
不过我仍然可以扫描网络。
答案1
您需要为您的网络添加默认路由。这是在没有更好的路线时使用的“包罗万象”的路线。
添加默认路由的命令是:
route add default gw 192.168.1.1
或者:
ip route add default via 192.168.1.1
但上述情况不会是永久性的。
要使其永久存在,请将其添加到网络脚本中/etc/network/interfaces
或使用NetworkManager
.