檢查是否有載入相關模組
# lsmod | grep bcmdhd
bcmdhd 598843 0
如果沒有的話
# echo bcmdhd >> /etc/modules
修改無線網路卡設定檔
# vim /etc/network/interfaces
auto wlan0
iface wlan0 inet dhcp
pre-up ip link set wlan0 up
pre-up iwconfig wlan0 essid “CHTN_T07AW”
wpa-ssid “CHTN_T07AW”
wpa-psk 123456789[@more@]
重新啟動網路
# ifconfig wlan0 down
# ifconfig wlan0 up
# /etc/init.d/networking restart
檢查無線網路組態
# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 98:3b:16:1e:67:d8
inet addr:10.0.1.6 Bcast:10.0.1.255 Mask:255.255.255.0
inet6 addr: fe80::9a3b:16ff:fe1e:67d8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:250 errors:0 dropped:0 overruns:0 frame:0
TX packets:118 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26007 (26.0 KB) TX bytes:15118 (15.1 KB)
測試無線網路,先關閉有線網路
# ifconfig eth0 down
測試網路,發現無法連線
# ping -c 4 140.111.66.1
connect: Network is unreachable
檢查路由
# route -n
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
增加路由
# route add default gw 10.0.1.1
檢查路由
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.0.1.1 0.0.0.0 UG 0 0 0 wlan0
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
測試網路
# ping -c 4 140.111.66.1
PING 140.111.66.1 (140.111.66.1) 56(84) bytes of data.
64 bytes from 140.111.66.1: icmp_seq=1 ttl=53 time=20.1 ms
64 bytes from 140.111.66.1: icmp_seq=2 ttl=53 time=17.7 ms
64 bytes from 140.111.66.1: icmp_seq=3 ttl=53 time=26.6 ms
64 bytes from 140.111.66.1: icmp_seq=4 ttl=53 time=26.0 ms
— 140.111.66.1 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 17.703/22.627/26.661/3.828 ms
啟動原先的 eth0
# ifconfig eth0 up
復原原先路由
# route add default gw 192.168.1.254
# route del default gw 10.0.1.1
檢查路由
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 eth0
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0