一、增加wwan網絡接口
vim /etc/config/network
config interface 'wwan'
option proto 'dhcp'
二、設置wwan到防火牆
vim /etc/config/firewall
option network 'wan ppp0 wwan'
三、新建wifi-iface匿名節點
1、先搜索你要中繼的另外一個無線,確定能否搜索到:
iwinfo wlan0 scan
2、vim /etc/config/wireless
config wifi-iface
option device radio0
option network wwan
option mode sta
option ssid PHS-NET-PUB001
option bssid EC:17:2F:84:EB:CC
option encryption 'psk-mixed'
option key 'PHS-NET-0810'
四、測試
1、重新啓動無線
wifi
2、ifconfig
wlan0 Link encap:Ethernet HWaddr 00:0C:43:76:20:29
inet addr:192.168.100.117 Bcast:192.168.100.255 Mask:255.255.255.0
inet6 addr: fe80::20c:43ff:fe76:2029/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:147 errors:0 dropped:0 overruns:0 frame:0
TX packets:117 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:173536 (169.4 KiB) TX bytes:12022 (11.7 KiB)
wlan0-1 Link encap:Ethernet HWaddr 00:0C:43:76:20:28
inet6 addr: fe80::20c:43ff:fe76:2028/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:189 errors:0 dropped:0 overruns:0 frame:0
TX packets:251 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15454 (15.0 KiB) TX bytes:187203 (182.8 KiB)
ifconfig命令可以看到一個是wlan0另外一個wlan0-1,其中有一個帶IP地址,那個帶IP地址的就是無線中繼。若沒有看到帶IP的,請仔細檢查配置。
3、root@M201:~# ping www.baidu.com
PING www.baidu.com (180.97.33.108): 56 data bytes
64 bytes from 180.97.33.108: seq=0 ttl=53 time=31.309 ms
64 bytes from 180.97.33.108: seq=1 ttl=53 time=35.055 ms
64 bytes from 180.97.33.108: seq=2 ttl=53 time=62.829 ms
^C
--- www.baidu.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 31.309/43.064/62.829 ms