查看自己的无线网卡信息:
wsn@wsn-laptop:~$ hwinfo --netcard ... 28: PCI e00.0: 0282 WLAN controller [Created at pci.318] UDI: /org/freedesktop/Hal/devices/pci_14e4_4315 Unique ID: y9sn.reAAs+k0MA5 Parent ID: hoOk.F8Gordq8HH2 SysFS ID: /devices/pci0000:00/0000:00:1c.2/0000:0e:00.0 SysFS BusID: 0000:0e:00.0 Hardware Class: network Model: "Dell Wireless 1397 WLAN Mini-Card" Vendor: pci 0x14e4 "Broadcom" Device: pci 0x4315 "BCM4312 802.11b/g" SubVendor: pci 0x1028 "Dell" SubDevice: pci 0x000c "Wireless 1397 WLAN Mini-Card" Revision: 0x01 Driver: "b43-pci-bridge" Driver Modules: "ssb" Device File: wlan0 Features: WLAN Memory Range: 0xf3000000-0xf3003fff (rw,non-prefetchable) IRQ: 18 (557260 events) HW Address: 00:22:5f:85:e7:a7 Link detected: yes WLAN channels: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 WLAN frequencies: 2.412 2.417 2.422 2.427 2.432 2.437 2.442 2.447 2.452 2.457 2.462 2.467 2.472 2.484 WLAN encryption modes: WEP40 WEP104 TKIP CCMP WLAN authentication modes: open sharedkey wpa-psk wpa-eap Module Alias: "pci:v000014E4d00004315sv00001028sd0000000Cbc02sc80i00" Driver Info #0: Driver Status: ssb is active Driver Activation Cmd: "modprobe ssb" Config Status: cfg=new, avail=yes, need=no, active=unknown Attached to: #16 (PCI bridge)
sudo apt-get install hostapd2. 最新版本可以通过git命令
sudo apt-get install git-core git clone git://w1.fi/srv/git/hostap.git3. 选择自己所需版本
http://w1.fi/hostapd/
tar xzvf hostapd-x.y.z.tar.gz cd hostapd-x.y.z/hostapd复制一份默认的配置文件
cp defconfig .config编辑.config文件,找到
http://www.infradead.org/~tgr/libnl/如果还出错,那么需要安装libssl-dev:
sudo apt-get install libssl-dev编译好后,得到hostapd执行文件
http://linuxwireless.org/en/users/Documentation/hostap一个简单的配置文件:
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 adbr br0 sudo ifconfig br0 192.168.2.236 netmask 255.255.255.0 sudo route add default gw 192.168.2.254连接网桥两端:
sudo brctl addif br0 eth0 sudo brctl addif br0 wlan0最后:
sudo ./hostapd hostapd.conf如果一切顺利,将在终端看到一下类似字样:
root@wsn-laptop:/home/wsn/Desktop/hostapd-0.7.3/hostapd# ./hostapd hostapd.conf Configuration file: hostapd.conf Using interface wlan0 with hwaddr 00:22:5f:85:e7:a7 and ssid 'ubuntu-502d'android手机打开wifi并且设置静态ip