Freebsd中拿无线网卡当AP 用

2009-05-13 13:01:05来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折


zmoon
买来一块108M的PCI无线网卡 型号为D-LINK DWLG520 , 是属于被Freebsd6.0支持的无线网卡,使用的是Atheros 5212芯片,支持HOSTAP模式(能让你的网卡作为AP使用的关键).
第一步,安装无线网卡硬件, 系统中已原有一块8139网卡
第二步,开机进入Freebsd 用Root登陆
#dmesg | more 没有发现任何无线设备,这这时想起没有把驱动编译到内核中当然不会发现这个设备啦
于是执行(注:ath为被Freebsd定义的网卡驱动名字):
#kldload if_ath ;
当然 要开机自动加载的话,请修改 /boot/loader.conf 加上
if_ath_load="YES"
系统自动把另外两个ath的.ko模块也加载到内核中了
再执行ifconfig命令,发现多了一个ath0的设备
ath0: flags=8943 mtu 1500
ether 00:03:2f:12:34:56
于是运行
#ifconfig ath0 inet ssid 108m mode 11g mediaopt hostap up
如果要让设置开机自动生效 编辑/etc/rc.conf文件 加入
ifconfig_ath0="inet ssid 108m mode 11g mediaopt hostap"
这样就起用了网卡的ap模式
这时ifconfig ath0 看看
ath0: flags=8943 mtu 1500
ether 00:03:2f:12:34:56
media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
status: associated
ssid 108m channel 1 bssid 00:03:2f:12:34:56
authmode OPEN privacy OFF txpowmax 36 protmode CTS dtimperiod 1
bintval 100
此时用一台笔记本电脑的无线网卡就能发现一个108M的无线网络接入点了,但是只能还连接到AP自身而已,
如果笔记本电脑需要访问有线以太网络,还是把ath0 和另外的一块8139网卡桥接起来方便
如何桥接??
Freebsd的网桥实现有两种完全不同的方式
一种是传统的实现 freebsd 很早的版本就有的.
#kldload bridge
#sysctl net.link.ether.bridge.enable=1
#sysctl net.link.ether.bridge.config=rl0,ath0
这时提示:
rl0: promiscuous mode enabled
ath0: promiscuous mode enabled
如果要开机自动生效 请修改 /boot/loader.conf
bridge_load="YES"
然后在 /etc/sysctl.conf 中设置
net.link.ether.bridge.enable=1
net.link.ether.bridge.config=rl0,ath0
第二种网桥是Freebsd6.0 新从netbsd中引入的 if_bridge ;
Freebsd官方说以后的版本中要用if_bridge淘汰上面的bridge方式.
为了方便, 干脆把 ath驱动和 if_bridge 都编译到内核中, 这样就不用 kldload,也不用修改loader.conf了
内核中要有
device if_bridge
device wlan
device ath
device ath_hal
device ath_rate_onoe
然后重新编译,安装内核 后reboot 系统中就多了一个ath0的设备
# dmesg | grep ath
ath_hal: 0.9.14.9 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413)
npx0: on motherboard
ath0: mem 0xec000000-0xec00ffff irq 11 at device 10.0 on pci1
ath0: Ethernet address: 00:03:2f:12:34:56
ath0: mac 5.6 phy 4.1 radio 1.7
然后开始使用桥
#ifconfig bridge0 create
#ifconfig bridge0
bridge0: flags=8041 mtu 1500
ether ac:de:48:0f:a6:16
priority 32768 hellotime 2 fwddelay 15 maxage 20
(注:删除bridge0接口 用 #ifconfig bridge0 destroy)
然后加入网桥的成员
#ifconfig bridge0 addm rl0 addm ath0
(注:删除网桥成员rl0用 #ifconfig bridge0 deletem rl0)
同样提示:
rl0: promiscuous mode enabled

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:postfix+courier-authlib+courier-imap+cyrus-sasl2+T

下一篇:从硬盘安装NetBSD2.0/3.0