Linux下驱动我得无线网卡TL-510G(1)
时间:2007-05-04 来源:powerguan
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
-
background
I have a AP which is accessed with a hex key(66AA54A4BA) and IP is 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 http://madwifi.org/wiki/UserDocs/FirstTimeHowTo
AP info:
IP: 192.168.0.250
Essid: homenet
Mode: Managed
Security mode: open
Key(Hex): 66AA54A4BA
-
Get RPM package
Action on the doc of 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:
http://download.fedora.redhat.com/pub/fedora/linux/core/updates/5/i386
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: http://atrpms.net/dist/fc5/madwifi/
madwifi-devel-0.9.3-34.fc5.at.i386.rpm
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
mkdir madwifi
copy the four RPM files into madvifi folder.
-
Install kernel
execute this command with root user
rpm -ihv kernel-2.6.20-1.2312.fc5.i686.rpm
after it , restart computer and select new kernel in loged interface.
-
Install Madwifi
with this command:
cd madwifi
rpm -ihv madwifi*.rpm //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:
ifconfig ath0 down ifconfig wifi0 down #Repeat these 2 ifconfig lines for every MadWifi device you have. Use 'ifconfig' list all Ethernet info. Loading the Madwifi Module modprobe ath_pci Now, if you type iwconfig, you should see a list like the following: lo no wireless extensions. eth0 no wireless extensions. wifi0 no wireless extensions. Warning: Driver for device ath0 has been compiled with version 21 of Wireless Extension, while this program supports up to version 19. Some things may be broken... ath0 IEEE 802.11g ESSID:"homenet" Nickname:"" Mode:Managed Channel:0 Access Point: Not-Associated Bit Rate:0 kb/s Tx-Power:18 dBm Sensitivity=0/3 Retry:off RTS thr:off Fragment thr:off Encryption key:off Power Management:off Link Quality=0/94 Signal level=-84 dBm Noise level=-84 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0 # Don't care the warning info. Then we need to bring up the wireless interface. This is done by typing (as root): ifconfig ath0 up Scanning for Access Points The first step is to insert the scanning module. Type (as root): modprobe wlan_scan_sta This is done by issuing the command (again, as root): wlanconfig ath0 list scan This should give you a list that looks something like this: SSID BSSID CHAN RATE S:N INT CAPS homenet 00:0c:41:89:8e:98 11 11M 43:0 100 EcP Set essid with following command: iwconfig ath0 essid "homenet" If you are in an environment that requires a shared encryption key, try running: iwconfig ath0 key open 66AA54A4BA # 66AA54A4BA is a key set in AP; open means security mode. If without DHCP let's set IP address and netmask ath0 192.168.0.107 netmask 255.255.255.0 up Add route address and gatway route add default gw 192.168.0.250 Ok, now you can test it with ping command. I type ping 192.168.0.250 and get results [root@power Madvifi]# ping 192.168.0.250 PING 192.168.0.250 (192.168.0.250) 56(84) bytes of data. 64 bytes from 192.168.0.250: icmp_seq=1 ttl=150 time=1.72 ms 64 bytes from 192.168.0.250: icmp_seq=2 ttl=150 time=1.67 ms 64 bytes from 192.168.0.250: icmp_seq=3 ttl=150 time=1.68 ms 64 bytes from 192.168.0.250: icmp_seq=4 ttl=150 time=1.68 ms 64 bytes from 192.168.0.250: icmp_seq=5 ttl=150 time=1.87 ms 64 bytes from 192.168.0.250: icmp_seq=6 ttl=150 time=4.06 ms 64 bytes from 192.168.0.250: icmp_seq=7 ttl=150 time=1.66 ms 64 bytes from 192.168.0.250: icmp_seq=8 ttl=150 time=1.67 ms Yes, we are successful. We type ifconfig to review info: [root@power Madvifi]# ifconfig ath0 Link encap:Ethernet HWaddr 00:14:78:71:38:33 inet addr:192.168.0.107 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::214:78ff:fe71:3833/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:33 errors:0 dropped:0 overruns:0 frame:0 TX packets:31 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:3074 (3.0 KiB) TX bytes:2982 (2.9 KiB) 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:2273 errors:0 dropped:0 overruns:0 frame:0 TX packets:2273 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:3206491 (3.0 MiB) TX bytes:3206491 (3.0 MiB) wifi0 Link encap:UNSPEC HWaddr 00-14-78-71-38-33-88-6E-00-00-00-00-00-00-00-00 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:19495 errors:0 dropped:0 overruns:0 frame:27107 TX packets:42049 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:199 RX bytes:1345767 (1.2 MiB) TX bytes:2083789 (1.9 MiB) Interrupt:11 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:
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
Create a new file named ifcfg-ath0 in /etc/sysconfig/network-scripts folder. Insert configure items in ifcfg-ath0 file like this:500)this.width=500;" border="0">
# Please read /usr/share/doc/initscripts-*/sysconfig.txt
# TP link TL-510G wireless card.
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes
GATEWAY=192.168.0.250
TYPE=Wireless
DEVICE=ath0
HWADDR=00:14:78:71:38:33
BOOTPROTO=none
NETMASK=255.255.255.0
NETWORK=192.168.0.0
DHCP_HOSTNAME=
IPADDR=192.168.0.155
DOMAIN=
ESSID=homenet
CHANNEL=1
MODE=Managed
RATE=Auto
comments:
ONBOOT=yes : auto initiate during boot;
GATEWAY=192.168.0.250 : 192.168.0.250 is my gateway address;
TYPE=Wireless : must be wireless;
DEVICE=ath0 : must be ath0;
HWADDR=00:14:78:71:38:33 : it's a option item, you can get it by ifconfig command ;
IPADDR=192.168.0.155 : 192.168.0.155 is my IP ;
ESSID=homenet : homenet is my AP parameter;
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:
KEY=66AA54A4BA
** my key is hex value, if your key is decimal the format should be:
KEY=s:XXXXXXXX
Now let's go to 'Network Configure' UI