- 论坛徽章:
- 0
|
Drive
Wireless Card with Madwifi
As
you know there is not driver in Linux for most of wireless network
card. There are two ways to drive wireless card in Linux. Fist is
using Madwifi( Multiband Atheros Driver for WiFi) for Linux driver
for 802.11a; the other tool is ndiswrapper. Now I will introduce them
to you
With
DadWifi
[color="#000000"]background
I
have a AP which is accessed with a hex key([color="#0000ff"]66AA54A4BA)
and IP is [color="#0000ff"]192.168.0.250
. My kernel version is 'Linux version 2.6.20-1.2312.fc5' and type of
card is 'TP-Link TL-WN510G'. The important steps please reference
[color="#0000ff"]http://madwifi.org/wiki/UserDocs/FirstTimeHowTo
AP
info:
IP:
192.168.0.250
Essid:
homenet
Mode:
Managed
Security
mode: open
Key(Hex):
[color="#333366"]66AA54A4BA
Get
RPM package
Action
on the doc of
[color="#0000ff"]http://madwifi.org/wiki/UserDocs/FirstTimeHowTo
, we should rebuild and install kernel. But it will eat too much disk
space and spend more time. In order to save time I download RPM
package directly.
Download
kernel RPM which version is 2.6.20-1.2312 from:
[color="#000000"]http://download.fedora.redhat.com/pub/fedora/linux/core/updates/5/i386
[color="#000000"] [color="#0000ff"]kernel-2.6.20-1.2312.fc5.i686.rpm
Download
4 Madwifi RPM which is the same version with kernel(2.6.20-1.2312)
from:
[color="#000000"]http://atrpms.net/dist/fc5/madwifi/
[color="#000000"] [color="#0000ff"]madwifi-devel-0.9.3-34.fc5.at.i386.rpm
[color="#0000ff"] madwifi-0.9.3-34.fc5.at.i386.rpm
madwifi-hal-kmdl-2.6.20-1.2312.fc5-0.9.3-34.fc5.at.i686.rpm
madwifi-kmdl-2.6.20-1.2312.fc5-0.9.3-34.fc5.at.i686.rpm
[color="#000000"] mkdir
madwifi
copy
the four RPM files into madvifi folder.
Install
kernel
execute
this command with root user
[color="#000000"] rpm
-ihv kernel-2.6.20-1.2312.fc5.i686[color="#000000"].rpm
after
it , restart computer and select new kernel in loged interface.
Install
Madwifi
with
this command:
[color="#000000"] cd
madwifi
rpm
-ihv madwifi*.rpm[color="#000000"] //install Dadwifi
Configure
net card
Removing
old modules
For
this step you must be logged on as root. First, set all your madwifi
devices down:
[color="#000000"] [color="#0000ff"]ifconfig ath0 down
[color="#0000ff"] ifconfig wifi0 down
[color="#000000"] #Repeat these 2 ifconfig lines for every MadWifi device you have. Use 'ifconfig' list all Ethernet info.
[color="#000000"] Loading the Madwifi Module
[color="#000000"] [color="#0000ff"]modprobe ath_pci
[color="#0000ff"] [color="#000000"]Now, if you type [color="#0000ff"]iwconfig[color="#000000"], you should see a list like the following:
[color="#0000ff"] [color="#280099"]lo no wireless extensions.
[color="#280099"] eth0 no wireless extensions.
[color="#280099"] wifi0 no wireless extensions.
[color="#280099"] Warning: Driver for device ath0 has been compiled with version 21
[color="#280099"] of Wireless Extension, while this program supports up to version 19.
[color="#280099"] Some things may be broken...
[color="#280099"] ath0 IEEE 802.11g ESSID:"homenet" Nickname:""
[color="#280099"] Mode:Managed Channel:0 Access Point: Not-Associated
[color="#280099"] Bit Rate:0 kb/s Tx-Power:18 dBm Sensitivity=0/3
[color="#280099"] Retry:off RTS thr:off Fragment thr:off
[color="#280099"] Encryption key:off
[color="#280099"] Power Management:off
[color="#280099"] Link Quality=0/94 Signal level=-84 dBm Noise level=-84 dBm
[color="#280099"] Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
[color="#280099"] Tx excessive retries:0 Invalid misc:0 Missed beacon:0
[color="#280099"] [color="#333366"]# Don't care the warning info.
[color="#333366"] [color="#000000"]Then we need to bring up the wireless interface. This is done by typing (as root):
[color="#000000"] [color="#0000ff"]ifconfig ath0 up
[color="#333366"] [color="#000000"]Scanning for Access Points
[color="#333366"] [color="#000000"]The first step is to insert the scanning module. Type (as root):
[color="#000000"] [color="#0000ff"]modprobe wlan_scan_sta
[color="#333366"] [color="#000000"]This is done by issuing the command (again, as root):
[color="#000000"] [color="#0000ff"]wlanconfig ath0 list scan
[color="#0000ff"] [color="#000000"]This should give you a list that looks something like this:
[color="#333366"] SSID BSSID CHAN RATE S:N INT CAPS
[color="#333366"] homenet 00:0c:41:89:8e:98 11 11M 43:0 100 EcP
[color="#333366"] [color="#000000"]Set essid with following command:
[color="#333366"] [color="#0000ff"]iwconfig ath0 essid "homenet"
[color="#333366"] If [color="#000000"]you are in an environment that requires a shared encryption key, try running:
[color="#333366"] [color="#0000ff"]iwconfig ath0 key open 66AA54A4BA
[color="#0000ff"] [color="#000000"]# 66AA54A4BA is a key set in AP; open means security mode.
[color="#000000"] If without DHCP let's set IP address and netmask
[color="#333366"] [color="#0000ff"] ath0 192.168.0.107 netmask 255.255.255.0 up
[color="#0000ff"] [color="#000000"]Add route address and gatway
[color="#0000ff"] route add default gw 192.168.0.250
[color="#0000ff"] [color="#000000"]Ok, now you can test it with ping command. I type ping 192.168.0.250 and get results
[color="#0000ff"][root@power Madvifi]# ping 192.168.0.250
[color="#0000ff"]PING 192.168.0.250 (192.168.0.250) 56(84) bytes of data.
[color="#0000ff"]64 bytes from 192.168.0.250: icmp_seq=1 ttl=150 time=1.72 ms
[color="#0000ff"]64 bytes from 192.168.0.250: icmp_seq=2 ttl=150 time=1.67 ms
[color="#0000ff"]64 bytes from 192.168.0.250: icmp_seq=3 ttl=150 time=1.68 ms
[color="#0000ff"]64 bytes from 192.168.0.250: icmp_seq=4 ttl=150 time=1.68 ms
[color="#0000ff"]64 bytes from 192.168.0.250: icmp_seq=5 ttl=150 time=1.87 ms
[color="#0000ff"]64 bytes from 192.168.0.250: icmp_seq=6 ttl=150 time=4.06 ms
[color="#0000ff"]64 bytes from 192.168.0.250: icmp_seq=7 ttl=150 time=1.66 ms
[color="#0000ff"]64 bytes from 192.168.0.250: icmp_seq=8 ttl=150 time=1.67 ms
[color="#000000"]Yes, we are successful. We type ifconfig to review info:
[color="#0000ff"][root@power Madvifi]# ifconfig
[color="#0000ff"]ath0 Link encap:Ethernet HWaddr 00:14:78:71:38:33
[color="#0000ff"] inet addr:192.168.0.107 Bcast:192.168.0.255 Mask:255.255.255.0
[color="#0000ff"] inet6 addr: fe80::214:78ff:fe71:3833/64 Scope:Link
[color="#0000ff"] UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
[color="#0000ff"] RX packets:33 errors:0 dropped:0 overruns:0 frame:0
[color="#0000ff"] TX packets:31 errors:0 dropped:0 overruns:0 carrier:0
[color="#0000ff"] collisions:0 txqueuelen:0
[color="#0000ff"] RX bytes:3074 (3.0 KiB) TX bytes:2982 (2.9 KiB)
[color="#0000ff"]lo Link encap:Local Loopback
[color="#0000ff"] inet addr:127.0.0.1 Mask:255.0.0.0
[color="#0000ff"] inet6 addr: ::1/128 Scope:Host
[color="#0000ff"] UP LOOPBACK RUNNING MTU:16436 Metric:1
[color="#0000ff"] RX packets:2273 errors:0 dropped:0 overruns:0 frame:0
[color="#0000ff"] TX packets:2273 errors:0 dropped:0 overruns:0 carrier:0
[color="#0000ff"] collisions:0 txqueuelen:0
[color="#0000ff"] RX bytes:3206491 (3.0 MiB) TX bytes:3206491 (3.0 MiB)
[color="#0000ff"]wifi0 Link encap:UNSPEC HWaddr 00-14-78-71-38-33-88-6E-00-00-00-00-00-00-00-00
[color="#0000ff"] UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
[color="#0000ff"] RX packets:19495 errors:0 dropped:0 overruns:0 frame:27107
[color="#0000ff"] TX packets:42049 errors:0 dropped:0 overruns:0 carrier:0
[color="#0000ff"] collisions:0 txqueuelen:199
[color="#0000ff"] RX bytes:1345767 (1.2 MiB) TX bytes:2083789 (1.9 MiB)
[color="#0000ff"] Interrupt:11
[color="#0000ff"] [color="#000000"]Now it's time to enjoy Internet for us. But until now our card can not run at boot time, I must configure network to launch the driver once OS is up.
6.
Add configure info to system
edit
/etc/modprobe.conf file
add following line in the
top
alias
ath0 ath_pci
my
modprobe.conf file is:
[color="#000000"] alias
ath0 ath_pci
alias
eth0 sis900
alias
snd-card-0 snd-intel8x0
options
snd-card-0 index=0
options
snd-intel8x0 index=0
remove
snd-intel8x0 { /usr/sbin/alsactl store 0 >/dev/null 2>&1 ||
: ; }; /sbin/modprobe -r --ignore-remove snd-intel8x0
[color="#0000ff"] [color="#000000"]Create a new file named ifcfg-ath0 in /etc/sysconfig/network-scripts folder. Insert configure items in ifcfg-ath0 file like this:
[color="#0000ff"]# Please read /usr/share/doc/initscripts-*/sysconfig.txt
[color="#0000ff"]# TP link TL-510G wireless card.
[color="#0000ff"]ONBOOT=yes
[color="#0000ff"]USERCTL=no
[color="#0000ff"]IPV6INIT=no
[color="#0000ff"]PEERDNS=yes
[color="#0000ff"]GATEWAY=192.168.0.250
[color="#0000ff"]TYPE=Wireless
[color="#0000ff"]DEVICE=ath0
[color="#0000ff"]HWADDR=00:14:78:71:38:33
[color="#0000ff"]BOOTPROTO=none
[color="#0000ff"]NETMASK=255.255.255.0
[color="#0000ff"]NETWORK=192.168.0.0
[color="#0000ff"]DHCP_HOSTNAME=
[color="#0000ff"]IPADDR=192.168.0.155
[color="#0000ff"]DOMAIN=
[color="#0000ff"]ESSID=homenet
[color="#0000ff"]CHANNEL=1
[color="#0000ff"]MODE=Managed
[color="#0000ff"]RATE=Auto
[color="#000000"]comments:
[color="#000000"]ONBOOT=yes : auto initiate during boot;
[color="#000000"]GATEWAY=192.168.0.250 : 192.168.0.250 is my gateway address;
[color="#000000"]TYPE=Wireless : must be wireless;
[color="#000000"]DEVICE=ath0 : must be ath0;
[color="#000000"]HWADDR=00:14:78:71:38:33 : it's a option item, you can get it by ifconfig command ;
[color="#000000"]IPADDR=192.168.0.155 : 192.168.0.155 is my IP ;
[color="#000000"]ESSID=homenet : homenet is my AP parameter;
[color="#000000"] now let's create Key file named keys-ath0 if there is Key in AP or it's not necessary. My keys-ath0 contain AP key value[color="#0000ff"]:
[color="#0000ff"] KEY=66AA54A4BA
[color="#0000ff"] [color="#000000"]** my key is hex value, if your key is decimal the format should be:
[color="#000000"] KEY=s:XXXXXXXX
[color="#0000ff"] Now let's go to 'Network Configure' UI
![]()
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/37775/showart_291350.html |
|