一个简单的配置文件:
interface=wlan0
bridge=br0
driver=nl80211
ssid=ssa
hw_mode=g
channel=11
dtim_period=1
rts_threshold=2347
fragm_threshold=2346
auth_algs=3
wpa=1
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
- sudo apt-get install bridge-utils
- sudo brctl addbr br0
- sudo ifconfig br0 192.168.2.236 netmask 255.255.255.0
- #not tested : sudo route add default gw 192.168.2.254
Note: my eth0 ip=192.168.2.110
连接网桥两端:- sudo brctl addif br0 eth0
- sudo brctl addif br0 wlan0
hostapd -d /etc/hostapd/hostapd.conf
安装配置dhcp,此处直接使用dnsmasq进行
/usr/sbin/dnsmasq --conf-file --no-hosts --keep-in-foreground --bind-interfaces --except-interface=lo --clear-on-reload --strict-order --listen-address=10.10.10.1 --dhcp-range=10.10.10.10,10.10.10.100,60m --dhcp-option=option:router,10.10.10.1 --dhcp-lease-max=50 --pid-file=/var/run/nm-dnsmasq-wlan0.pid
remain problems:
PC can't use network anymore, reason not clear.
当开机连接到无线网络时,可能连接失败,
解决:开一下共享wifi再关闭共享wifi,再连接无线wifi可以连上。