您的位置:首页 > 其它

ubuntu 12.04 使用hostapd共享wifi

2013-09-29 18:00 405 查看
一个简单的配置文件:

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

[cpp] view
pla

搭建网桥:

[cpp] view
plaincopy

sudo apt-get install bridge-utils  

建立网桥:

[cpp] view
plaincopy

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

连接网桥两端:

[cpp] view
plaincopy

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可以连上。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  hostapd