有一张威盛无线网卡,闲着蛋疼,挂载了一下。
具体方法如下:
1、网上找到无线网卡驱动:vntwusb.ko;
2、加载无线网卡驱动:insmod vntwusb.ko;
[root@FriendlyARM plg]# insmod vntwusb.ko
VIA Networking Wireless LAN USB Driver Ver. 1.20.03
VIA Networking Wireless LAN USB Driver Ver. 1.20.03
Copyright (c) 2004 VIA Networking Technologies, Inc.
usb 1-1: reset full speed USB device using s3c2410-ohci and address 2
usbcore: registered new interface driver vntwusb
3、查看无线网卡: iwconfig
[root@FriendlyARM plg]# iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
eth1 802.11-a/b/g ESSID:""
Mode:Managed Frequency=2.412 GHz Access Point: Not-Associated
Bit Rate:1 Mb/s Sensitivity=0/255
Retry min limit:8 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
vntwpa no wireless extensions.
4、打开网卡: ifconfig eth1 up
[root@FriendlyARM plg]# ifconfig eth1 up
Config_FileOperation file Not exist
Zone=[2][E][U]!!
Antenna MAIN available!
5、扫描无线网络:iwlist eth1 scanning
[root@FriendlyARM plg]# iwlist eth1 scanning
eth1 Scan completed :
Cell 01 - Address: 00:23:CD:15:60:40
ESSID:"TP-LINK"
Mode:Managed
Channel:1
Frequency:2.412 GHz (Channel 1)
Quality=50/100 Signal level=-70 dBm Noise level=0 dBm
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
Cell 02 - Address: 00:23:89:97:BC:10
ESSID:"H3C"
Mode:Managed
Channel:1
Frequency:2.412 GHz (Channel 1)
Quality=65/100 Signal level=-64 dBm Noise level=0 dBm
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
11 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
Cell 03 - Address: 00:23:89:97:BC:11
ESSID:"touzi-net"
Mode:Managed
Channel:1
Frequency:2.412 GHz (Channel 1)
Quality=65/100 Signal level=-64 dBm Noise level=0 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
11 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
Cell 04 - Address: F4:EC:38:7B:5F:FE
ESSID:"chengang"
Mode:Managed
Channel:6
Frequency:2.437 GHz (Channel 6)
Quality=100/100 Signal level=-40 dBm Noise level=0 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
6、扫描到无线网络后(这里是H3C),连接无密钥无线网络:iwconfig eth1 essid H3C
[root@FriendlyARM plg]# iwconfig eth1 essid H3C
[root@FriendlyARM plg]# AP(BSS) finding:Found a AP(BSS)..
802.11 Authen (OPEN) Successful.
Association Successful, AID=6.
Link with AP(SSID): H3C
7、连接好后,可以查看下无线网络:iwconfig eth1
[root@FriendlyARM plg]# iwconfig eth1
eth1 802.11-a/b/g ESSID:"H3C"
Mode:Managed Frequency=2.412 GHz Access Point: 00:23:89:97:BC:10
Bit Rate=1 Mb/s Sensitivity=-60 dBm
Retry min limit:8 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=88/100 Signal level:-60 dBm Noise level:0 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
8、设置eth1的ip地址,网关,DNS(H3C的网关为192.168.254.1,DNS为202.96.134.133)
[root@FriendlyARM plg]# ifconfig eth1 192.168.254.245 netmask 255.255.255.0
[root@FriendlyARM plg]# route add default gw 192.168.254.1
[root@FriendlyARM plg]# echo "nameserver 202.96.134.133">> /etc/resolv.conf
注意:这里修改的值,在下次reboot后就没有了,如果要彻底修改的话,在linux系统中,可以用vi修改:vi /etc/sysconfig/network-scripts/ifcfg-eth0(修改这个在下次reboot后生效)。但是 嵌入式linux下面没有sysconfig这个目录,因此,具体方法看12。
9、修改完成后,就可以ping下网关了:
[root@FriendlyARM plg]# ping 192.168.254.1 -I eth1
PING 192.168.254.1 (192.168.254.1): 56 data bytes
64 bytes from 192.168.254.1: seq=0 ttl=128 time=10.732 ms
64 bytes from 192.168.254.1: seq=1 ttl=128 time=3.418 ms
64 bytes from 192.168.254.1: seq=2 ttl=128 time=4.078 ms
64 bytes from 192.168.254.1: seq=3 ttl=128 time=4.095 ms
64 bytes from 192.168.254.1: seq=4 ttl=128 time=10.198 ms
10、然后ping下外网看看,这里ping下google:
[root@FriendlyARM plg]# ping www.google.com -I eth1
PING www.google.com (74.125.71.105): 56 data bytes
64 bytes from 74.125.71.105: seq=0 ttl=51 time=16.472 ms
64 bytes from 74.125.71.105: seq=1 ttl=51 time=18.067 ms
64 bytes from 74.125.71.105: seq=3 ttl=51 time=14.123 ms
64 bytes from 74.125.71.105: seq=4 ttl=51 time=13.120 ms
64 bytes from 74.125.71.105: seq=5 ttl=51 time=14.130 ms
11、上面是加载无密钥的ap,那么如果ap有密钥应该怎么办呢?这就要在linux下面查看下iwconfig这个命令的用法了。用man查看下这个命令。
[root@localhost ~]# man iwconfig
可以知道,这个命令加载有密钥(密钥为ccavccav)的方式如下:
[root@FriendlyARM plg]# iwconfig eth1 essid chengang key ccavccav
但是,iwconfig只能加载密钥为wep的ap点,不能加载密钥为wpa的ap点。如果要加载wpa的ap点,就得用wpa_supplicant这个工具了。
12、关于嵌入式linux开机加载驱动和修改ip的方法:
可以修改/etc/init.d/rcS这个开机启动脚本,将上面这些命令加载到这些脚本里面。就不用每次开机都要配置了。