无线网卡的安装

madwifi-ng需要进行内核编译。
需要yum list kernel,列出当前的内核相关包,然后下载kernel与kernel-devel,就可以重新编译内核于相关包了。


下面的文章属于转载。

偶的ibook G4支持无线局域网 IEEE 802.11b/g,但是另外要买无线路由器才能体验
无线移动的乐趣。最便宜的也要300多人民币,太贵了。为了省钱,想自己用台式
机加装无线局域网网卡,自己做一个无线AP。于是买了TP-LINK的TP-WN550G, 54M
速率,支持IEEE 802.11 b/g协议。
我发现它是使用Atheros芯片,这样的话,就可以使用 http://madwifi.org 站点
上的驱动程序。这是一个开源项目,专门用于Atheros芯片无线局域网网卡的Linux
驱动程序 (2.4或2 .6内核)

操作系统:CentOS 4.2(已经安装了开发工具: gcc, make)
必须安装的软件包:sharutils(归档工具), subversion(cvs客户端,在
CentOS已经安装)
安装 sharutils 过程 (安装subversion类似):
tar zxvf sharutils-4.6.tar.gz
cd ./sharutils-4.6
make
make install

准备工作完成,开始安装。
下载源代码: svn checkout http://svn.madwifi.org/trunk madwifi-ng
下载完毕后, /root目录下会生成 madwifi-ng 的目录,
假如先前安装过旧的madwifi程序,要先清除(第一次安装可以跳过)
cd ./madwifi-ng/scripts
./madwifi-unload.bash
./find-madwifi-modules.sh /lib/modules/

在madwifi的主目录,开始编译:make
然后执行安装: make intsall

我的系统没有提示出现错误安装,安装成功 !
加载驱动模块: modprobe ath_pci ( 我是做AP,希望无线信号,如无线频率,
频道,速率等 自动设置, 要加参数:modprobe ath_pci autocreate=ap ,也可以
用 iwconfig 命令自行设置)
系统会出现以下提示:
ath_hal: module license 'Proprietary' taints kernel.
ath_hal: 0.9.16.16 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413)
wlan: 0.8.4.2 (svn 1460)
ath_rate_sample: 1.2 (svn 1460)
ath_pci: 0.9.4.5 (svn 1460)
PCI interrupt 0000:02:02.0[A] -> GSI 7 (level, low) -> IRQ 7
11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
wifi0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps
24Mbps 36Mbps 48Mbps 54Mbps
wifi0: H/W encryption support: WEP AES AES_CCM TKIP
wifi0: mac 7.8 phy 4.5 radio 5.6
wifi0: Use hw queue 1 for WME_AC_BE traffic
wifi0: Use hw queue 0 for WME_AC_BK traffic
wifi0: Use hw queue 2 for WME_AC_VI traffic
wifi0: Use hw queue 3 for WME_AC_VO traffic
wifi0: Use hw queue 8 for CAB traffic
wifi0: Use hw queue 9 for beacons
wifi0: Atheros 5212: mem=0xd9000000, irq=7


madwifi使用的是 VAP的概念,既是station mode ,也是master AP mode 。这时会
有2个wireless interface:wifi0,ath0
要给wireless interface 设置 ip, 必须在ath0接口 进行:
ifconfig ath0 192.168.0.1 netmask 255.255.255.0

现在无线AP设置好了,此时打开小白的airport ,可以自动检测到信号。再手动分
配小白无线接口的 IP 192.168.0.2/255.255.255.0(GUI设置).
从 AP上尝试 ping 小白
[root@Jack ~]# ping 192.168.0.2
PING 192.168.0.2 (192.168.0.2) 56(84) bytes of data.
64 bytes from 192.168.0.2: icmp_seq=0 ttl=64 time=0.391 ms
64 bytes from 192.168.0.2: icmp_seq=1 ttl=64 time=0.399 ms
64 bytes from 192.168.0.2: icmp_seq=2 ttl=64 time=0.513 ms
64 bytes from 192.168.0.2: icmp_seq=3 ttl=64 time=0.495 ms
64 bytes from 192.168.0.2: icmp_seq=4 ttl=64 time=0.501 ms

--- 192.168.0.2 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
rtt min/avg/max/mdev = 0.391/0.459/0.513/0.059 ms, pipe 2
ping的通了,爽。


说明一下我的无线AP的网络接口情况:
eth0 : 接公网,有线通cable, ISP使用dhcp分配ip
ath0: 接无线局域网,

现在我配制了无线网络脚本 wireless, iptables脚本fwsh, 以及 dhcpd 服务器
开机时在 /etc/rc.d/rc.local执行
(说明:wireless, fwsh 这2 个shell脚本都事先 chmod 0755 XXXX , 成为可执
行的程序)
[root@Jack ~]# cat /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
echo '1'>/proc/sys/net/ipv4/ip_forward
echo '1'>/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo '1'>/proc/sys/net/ipv4/tcp_syncookies
/usr/local/bin/wireless
/usr/local/bin/fwsh
/etc/init.d/dhcpd start


以下是无线网络脚本,防火墙脚本fwsh, DHCP的配制文件 :
[root@Jack ~]# cat /usr/local/bin/wireless
echo " Starting Wireless Lan Enviroment ......"
modprobe ath_pci autocreate=ap
iwconfig ath0 essid Jack
ifconfig ath0 192.168.0.1 netmask 255.255.255.0
iwconfig ath0 key DEAD-BEEF-AA


[root@Jack ~]# cat /usr/local/bin/fwsh
echo " Starting firewall now ......"
iptables -t filter -F
iptables -t nat -F
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

iptables -A INPUT -p tcp --destination-port 22 -i eth0 -j REJECT
--reject-with tcp-reset
iptables -A INPUT -p tcp --destination-port 6000:6010 -i eth0 -j REJECT
--reject-with tcp-reset
iptables -A INPUT -p icmp -f -j DROP

iptables -A FORWARD -p icmp -f -j DROP

iptables -A FORWARD -p tcp -s 0/0 -d 192.168.0.0/24 --syn -i eth0 -j
REJECT --reject-with tcp-reset
iptables -A FORWARD -p tcp -s 0/0 -d 192.168.0.0/24 -m state --state
NEW,INVALID -i eth0 -j REJECT --reject-with tcp-reset

iptables -A FORWARD -p udp -s 0/0 -d 192.168.0.0/24 -m multiport
--destination-port 137,138,139,445,1023 -i eth0 -j REJECT --reject-with
icmp-port-unreachable


[root@Jack ~]# cat /etc/dhcpd.conf
DHCPDARGS=ath0;
option routers 192.168.0.1;
option broadcast-address 192.168.0.255;
option subnet-mask 255.255.255.0;

option domain-name "kernel.org";
option domain-name-servers 211.167.97.67, 211.167.97.68;
ddns-update-style ad-hoc;


default-lease-time 21600;
max-lease-time 43200;

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.60 192.168.0.90;
}

由于我没有在 /etc/sysconfig/networking 和 /etc/sysconfig/network-scripts
添加 wirleless interface 的信息,而 ath0,wifi0 的interface都是系统加载
ath_pci模块后自动生成,而dhcpd是监听 ath0 的,所以dhcpd必须在这个模块加
载后再执行,否则dhcpd会提示出错。


这样台式机开机后,小白就可以自动无线接入了(要输入16进制的WEP密码:
DEAD-BEEF-AA)。

此时 AP 的网络接口状况:
[root@Jack ~]# ifconfig
ath0 Link encap:Ethernet HWaddr 00:14:78:74:48:37
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::214:78ff:fe74:4837/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1100 errors:0 dropped:0 overruns:0 frame:0
TX packets:1071 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:222531 (217.3 KiB) TX bytes:578201 (564.6 KiB)

eth0 Link encap:Ethernet HWaddr 00:0F:3D:82:BF:7F
inet addr:221.137.213.78 Bcast:255.255.255.255 Mask:255.255.252.0
inet6 addr: fe80::20f:3dff:fe82:bf7f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:41690 errors:0 dropped:0 overruns:0 frame:0
TX packets:854 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3010242 (2.8 MiB) TX bytes:198431 (193.7 KiB)
Interrupt:11 Base address:0x2000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:948 (948.0 b) TX bytes:948 (948.0 b)

wifi0 Link encap:Ethernet HWaddr 00:14:78:74:48:37
inet6 addr: fe80::214:78ff:fe74:4837/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1389 errors:0 dropped:0 overruns:0 frame:4931
TX packets:1290 errors:136 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:199
RX bytes:268359 (262.0 KiB) TX bytes:634590 (619.7 KiB)
Interrupt:7 Memory:d8980000-d8990000



你可能感兴趣的:(无线网卡的安装)