我使用有线网卡和无线网卡设置了一个桥接器,以便将无线网卡作为 Wi-Fi AP 来共享有线互联网访问,设置成功后,Wi-Fi AP 可以正常工作,但我的笔记本电脑无法访问互联网,请帮帮我。谢谢。
我的 hostapd.conf
$ cat hostapd.conf
interface=wlan0
bridge=br0
driver=nl80211
ssid=myAP
hw_mode=g
channel=11
dtim_period=1
rts_threshold=2347
fragm_threshold=2346
macaddr_acl=0
auth_algs=3
ieee80211n=0
wpa=3
wpa_passphrase=PassWord
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
设置步骤:
$ sudo killall hostapd
hostapd: no process found
$ sudo hostapd -B hostapd.conf
Configuration file: hostapd.conf
Using interface wlan0 with hwaddr 00:26:5e:e8:4f:8e and ssid 'myAP'
$ sudo brctl addbr br0
device br0 already exists; can't create bridge with the same name
$ sudo ifconfig eth0 0.0.0.0 up
$ sudo ifconfig wlan0 0.0.0.0 up
$ sudo brctl addif br0 eth0
$ sudo brctl addif br0 wlan0
device wlan0 is already a member of a bridge; can't enslave it to bridge br0.
$ sudo ifconfig br0 192.168.1.110 netmask 255.255.255.0
$ sudo route add default gw 192.168.1.1
chrome 提示:
The server at stackoverflow.com can't be found, because the DNS lookup failed. DNS is the network service that translates a website's name to its Internet address. This error is most often caused by having no connection to the Internet or a misconfigured network. It can also be caused by an unresponsive DNS server or a firewall preventing Google Chrome from accessing the network.
$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
^C
--- 192.168.1.1 ping statistics ---
64 packets transmitted, 0 received, 100% packet loss, time 63456ms
$ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.00265ee84f8e no eth0
wlan0
$ ifconfig
br0 Link encap:Ethernet HWaddr 00:26:5e:e8:4f:8e
inet addr:192.168.1.115 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::226:5eff:fee8:4f8e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25 errors:0 dropped:0 overruns:0 frame:0
TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4038 (4.0 KB) TX bytes:8111 (8.1 KB)
eth0 Link encap:Ethernet HWaddr c8:d6:5e:f8:6a:22
inet6 addr: fe80::cad6:5eff:fef8:6a22/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:384 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:119746 (119.7 KB) TX bytes:37055 (37.0 KB)
Interrupt:46 Base address:0x4000
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:62 errors:0 dropped:0 overruns:0 frame:0
TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4712 (4.7 KB) TX bytes:4712 (4.7 KB)
mon.wlan0 Link encap:UNSPEC HWaddr 00-26-5E-E8-4F-8E-30-30-00-00-00-00-00-00-00-00
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:17 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2514 (2.5 KB) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 00:26:5e:e8:4f:8e
inet6 addr: fe80::226:5eff:fee8:4f8e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:117 errors:0 dropped:0 overruns:0 frame:0
TX packets:187 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12139 (12.1 KB) TX bytes:82155 (82.1 KB)
这看上去像是 iptables 的问题,但事实并非如此。