ubuntu 12.04 使用hostapd共享wifi

这篇博客介绍了如何在Ubuntu 12.04系统中利用hostapd创建并共享WiFi网络。通过配置hostapd.conf文件,设置接口、桥接、SSID、频道等参数,并安装bridge-utils和dnsmasq来实现无线热点功能。然而,配置后可能出现主机无法上网的问题,以及开机连接无线网络时的连接失败问题,这些问题需要通过手动操作共享WiFi后再关闭来解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >




一个简单的配置文件:

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 plain copy
  1. sudo apt-get install bridge-utils  
建立网桥:
[cpp]  view plain copy
  1. sudo brctl addbr br0  
  2. sudo ifconfig br0 192.168.2.236 netmask 255.255.255.0  
  3. #not tested : sudo route add default gw 192.168.2.254  

Note: my eth0 ip=192.168.2.110

连接网桥两端:
[cpp]  view plain copy
  1. sudo brctl addif br0 eth0  
  2. 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可以连上。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值