Gentoo 安装TL-WN321G 无线网卡 (AMD64)

做了一个wiki

http://gentoo-wiki.com/Howto_wirelss_RT73_USB#extracting_the_file_and_compile_the_driver

因为家里面的种种原因,我不得不买个无限的网卡,本来想要买个PCI的内置。但是考虑到小巧灵便的USB比PCI这种大型货色要轻便多,所以决定了还是USB吧!
去了一个PC store人家推荐给我一个(可以说不是推荐,因为他们只有这么一款)TL-WN321G,看了看价格45刀,还可以。就买了,挂在WINXP上一些OKEY.
然后马上搞在Gentoo上运行。
lsusb
Bus 001 Device 004: ID 148f:2573 Ralink Technology, Corp.

portage里面的是RT61,所以不能用,我的是RT73的chipset

首先把Kernel 配置好 (参考 Hardware Wirless)

 Networking  —>
   [*] Networking support
   Wireless  —>
     <*> Improved wireless configuration API

The following is only used by very old drivers:

     — Wireless extensions

The selection between the following two depends on the driver being used. The first is the new stack, the second is the old:

     < > Generic IEEE 802.11 Networking Stack (mac80211)
     <*> Generic IEEE 802.11 Networking Stack

     [ ]   Enable full debugging output
     —   IEEE 802.11 WEP encryption (802.1x)
     <*>   IEEE 802.11i CCMP support
     <*>   IEEE 802.11i TKIP encryption
     <*>   Software MAC add-on to the IEEE 802.11 networking stack
     [ ]     Enable full debugging output
     [*]   Enable RAIODTAP headers for capibilities that can support it.

Turn on the following even if not using any of the drivers in the kernel:

 Device Drivers  —>
   Network device support  —>
     Wireless LAN  —>
       [*] Wireless LAN (IEEE 802.11)
       … Select driver as needed if it’s in the kernel source …

The following should be on automatically by dependencies, but if not, turn it on:

 Cryptographic options  —>
   [*] Cryptographic API

下载官方网站,支持AMd64 (不要下载 rt2×00.serialmonkey.com,不好用)

下载: RT2501USB(RT73:RT2571W/RT2573/RT2671)

# cp RT73_Linux_STA_Drv1.0.4.0.tar.gz /tmp/
# cd /tmp/
# tar
zxvf RT73_Linux_STA_Drv1.0.4.0.tar.gz
# cd /tmp/RT73_Linux_STA_Drv1.0.4.0/Module/
# cp Makefile.6 ./Makefile

注意这里跟Fedora 8不一样。

#sudo -i
#chmod 755 Makefile
#vi Makefile

进入vim以后,
输入:%s/rausb0/wlan0/gc #把所有的rausb0更换成wlan0
:wq! #保存退出

同一个目录下
#mv ifcfg-rausb0 ifcfg-wlan0

————————————————————-
#make && make install

make -C /lib/modules/2.6.23.9/build
        INSTALL_MOD_DIR=extra SUBDIRS=/tmp/RT73_Linux_STA_Drv1.0.4.0/Module
        modules_install
make[1]: Entering directory `/usr/src/linux-2.6.23.9′
  INSTALL /tmp/RT73_Linux_STA_Drv1.0.4.0/Module/rt73.ko
  DEPMOD  2.6.23.9
make[1]: Leaving directory `/usr/src/linux-2.6.23.9′
Network device directory /etc/sysconfig/network-scripts
Module configuration file /etc/modprobe.conf
append ‘alias wlan0 rt73′ to /etc/modprobe.conf

————————————————————-
然后
# modprobe rt73

# mkdir /etc/Wireless

# mkdir /etc/Wireless/RT73STA/

# cp rt73.bin /etc/Wireless/RT73STA/

# dos2unix rt73sta.dat

# cp rt73sta.dat /etc/Wireless/RT73STA/rt73sta.dat

# vi /etc/Wireless/RT73STA/rt73sta.dat

[Default]
CountryRegion=0
CountryRegionABand=7
WirelessMode=0
SSID=Your_Wireless Name
NetworkType=Infra
Channel=6
AuthMode=WPAPSK
EncrypType=TKIP
DefaultKeyID=1
Key1Type=0
Key1Str=Your Password
Key2Type=0
Key2Str=
Key3Type=0
Key3Str=
Key4Type=0
Key4Str=
WPAPSK=
the WPAPSK Passworkd
TxBurst=0
PktAggregate=0
TurboRate=0
WmmCapable=0
AckPolicy=0;0;0;0
BGProtection=0
IEEE80211H=0
TxRate=12
RTSThreshold=2347
FragThreshold=2346
PSMode=CAM
TxPreamble=0
AdhocOfdm=0
FastRoaming=0
RoamThreshold=70

if u r unsure how to edit this section, u need to read here
/tmp/RT73_Linux_STA_Drv1.0.4.0/Module/README

————————————————————-

然后
#sudo emerge wireless-tools
#sudo emerge net-wireless/wpa_supplicant

(如何配置wireless 参考Wireless Networking)

据说这样就对了。

#ifconfig

wlan0     Link encap:Ethernet  HWaddr 00:19:E0:18:8C:32 
          inet addr:10.1.1.15  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::219:e0ff:fe18:8c32/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:976 errors:0 dropped:0 overruns:0 frame:0
          TX packets:139 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:867094 (846.7 Kb)  TX bytes:201182 (196.4 Kb)

# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

sit0      no wireless extensions.

wlan0  RT73 WLAN  ESSID:"" 
          Mode:Managed  Frequency=2.412 GHz  Bit Rate=54 Mb/s  
          RTS thr:off   Fragment thr:off
          Encryption key:xxxx-xxx-xxx-xxxx
          Link Quality=0/100  Signal level:-121 dBm  Noise level:-115 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

# iwlist wlan0 scan (area for router ESSIDS) (非官方版的驱动可以scan)
wlan0     Scan completed :
          Cell 01 – Address: 00:1B:11:15:01:73
                    ESSID:
"MY_WIRELESS"
                    Mode:Managed
                    Channel:6
                    Encryption key:on
                    Bit Rates:0 kb/s

# iwlist wlan0 scan (官方版的驱动不能scan)
wlan0     Interface doesn’t support scanning.

————————————————————
编辑一下文件

#vi /etc/conf.d/net

modules=("wpa_supplicant")
wpa_supplicant_wlan0=
"-Dwext"
config_wlan0=("10.1.1.15 netmask 255.0.0.0")
routes_wlan0=("default via 10.1.1.1"


#vi /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant

network={
  ssid="MY_WIRELESS_NAME"
  mode=1
  proto=WPA
  key_mgmt=WPA-NONE
  pairwise=NONE
  group=TKIP
  psk="MY_PASSWORD"
}

——————————————————

好了基本上到最后了
#cd /etc/init.d
#rc-update del  net.eth0
 * ‘net.eth0′ removed from the following runlevels: default

#ln -s net.lo net.wlan0

#rc-update add net.wlan0 default
 * net.wlan0 added to runlevel default

# /etc/init.d/net.wlan0 restart
 * Unmounting network filesystems …               [ ok ]
 * Stopping sshd …                                         [ ok ]
 * Stopping wlan0
 *   Bringing down wlan0
 *     Stopping dhcpcd on wlan0 …                    [ ok ]
 *     Shutting down wlan0 …                           [ ok ]
 * Starting wlan0
 *   Bringing up wlan0
 *     10.1.1.15                                               [ ok ]
 *   Adding routes
 *     default via 10.1.1.1 …                              [ ok ]
 * Mounting network filesystems …                    [ ok ]
 * Starting sshd …                                           [ ok ]

# ping 10.1.1.1
PING 10.1.1.1 (10.1.1.1) 56(84) bytes of data.
64 bytes from 10.1.1.1: icmp_seq=1 ttl=255 time=1014 ms
64 bytes from 10.1.1.1: icmp_seq=2 ttl=255 time=4.61 ms
64 bytes from 10.1.1.1: icmp_seq=3 ttl=255 time=2.59 ms
64 bytes from 10.1.1.1: icmp_seq=4 ttl=255 time=2.70 ms
64 bytes from 10.1.1.1: icmp_seq=5 ttl=255 time=3.26 ms
64 bytes from 10.1.1.1: icmp_seq=6 ttl=255 time=2.68 ms

— 10.1.1.1 ping statistics —
6 packets transmitted, 6 received, 0% packet loss, time 5034ms
rtt min/avg/max/mdev = 2.591/171.648/1014.025/376.723 ms, pipe 2

———————-
DONE

———————–
如果rc-update 没有起作用。还是自己启动net.eth0的话
按下面修改
# vi /etc/conf.d/rc
# RC_PLUG_SERVICES="!net.*"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s