分类: WINDOWS
2011-05-12 16:45:56
1. 配置POS的linux系统中的网络来测试WiFi(USI, 88W8686) 网卡速度
先来个拓扑图,不然都不知道说啥。。。哈哈。。。
//查当前路由表
//当前POS中的linux系统只有ETH网络,当使用ifconfig ethx 192.168.xx.xx时就
//自动的添加相应的路由到路由表中。
#
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.56.0 * 255.255.254.0 U 0 0 0 eth0
//使用netstat -nr命令也可以查阅路由表信息
#
# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.56.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
//配置WiFi网卡(eth1)的IP地址和掩码信息
#
# ifconfig eth1 192.168.56.200 netmask 255.255.254.0
#
//查看所有网卡,因为注册的wifi网卡如果没参数"-a"就查看不到,所以要加上"-a"。
# ifconfig -a
eth0-ETH Link encap:Ethernet HWaddr 00:17:6F:99:99:A9
inet addr:192.168.56.199 Bcast:192.168.57.255 Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4574 errors:0 dropped:0 overruns:0 frame:0
TX packets:2355 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4947297 (4.7 MiB) TX bytes:389310 (380.1 KiB)
Interrupt:65 Base address:0xc000
eth1-WiFi Link encap:Ethernet HWaddr 00:24:7E:66:EF:56
inet addr:192.168.56.200 Bcast:192.168.57.255 Mask:255.255.254.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:94
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
//扫描AP点
# iwlist eth1 scanning
eth1 Scan completed :
Cell 01 - Address: F4:EC:38:3B:02:A0
ESSID:"XXX_NO773"
Mode:Managed
Frequency:2.427 GHz (Channel 4)
Quality:0/100 Signal level=-26 dBm Noise level=-96 dBm
Encryption key:off
Bit Rates:54 Mb/s
Extra:
Cell 02 - Address: 00:19:E0:B8:74:8E
ESSID:"XXX-2" [2]
Mode:Managed
Frequency:2.437 GHz (Channel 6)
Quality:0/100 Signal level=-66 dBm Noise level=-96 dBm
Encryption key:on
Bit Rates:54 Mb/s
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : TKIP CCMP
Authentication Suites (1) : PSK
Preauthentication Supported
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : TKIP CCMP
Authentication Suites (1) : PSK
Cell 03 - Address: F4:EC:38:29:39:70
ESSID:"MERCURY_293970" [3]
Mode:Managed
Frequency:2.452 GHz (Channel 9)
Quality:0/100 Signal level=-64 dBm Noise level=-96 dBm
Encryption key:off
Bit Rates:54 Mb/s
Extra:
//指定AP点为我桌面的那个300M TP-Link的路由器,SSID:XXX_NO773
# iwconfig eth1 essid "XXX_NO773"
//因为POS机是有2张网卡, eth0是NFS文件系统使用,eth1是WiFi连接外网,由于本人
//不想跟公司的网络(192.168.0.xx)冲突,就是用WiFi路由器自己组织了一个(192.168.56.xx)
//的网段,所以这时可以ping通局域网。
//ping我主机上的ubuntu虚拟机(VirtualBox, IP:192.168.56.101, 通过bridged方式,这个主要
//是用来作为NFS文件系统的主机和使用交叉编译器编译linux源码的主机,这网卡我没设
//定网关-- 192.168.56.1和DNS地址192.168.0.111, 所以不能上网,还有一张网卡是我用来
//上网的,就是使用NAT方式)
# ping -I eth1 192.168.56.101
PING 192.168.56.101 (192.168.56.101): 56 data bytes
64 bytes from 192.168.56.101: seq=0 ttl=64 time=30.000 ms
64 bytes from 192.168.56.101: seq=1 ttl=64 time=10.000 ms
64 bytes from 192.168.56.101: seq=2 ttl=64 time=10.000 ms
//我需要在POS机的linux下ping通公司网段地址,我必须设定好网关,我WiFi路由器的
//网关是192.168.56.1,所以设定一下就可以啦。
#
# route add default gw 192.168.56.1 eth1
#
# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.56.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
192.168.56.0 0.0.0.0 255.255.254.0 U 0 0 0 eth1
0.0.0.0 192.168.56.1 0.0.0.0 UG 0 0 0 eth1
//设定好网关后,就可以ping通局域网和外网的IP地址,不包括域名,因为没配置DNS
#
# ping -I eth1 192.168.0.133 (公司内部网某某某的地址)
PING 192.168.0.133 (192.168.0.133): 56 data bytes
64 bytes from 192.168.0.133: seq=0 ttl=63 time=30.000 ms
64 bytes from 192.168.0.133: seq=1 ttl=63 time=10.000 ms
//找个外网地址来尝试一下,就吧,先在可以用可以上网的ping
//然后查看IP地址:58.63.236.33
#
# ping -I eth1 58.63.236.33
PING 58.63.236.33 (58.63.236.33): 56 data bytes
64 bytes from 58.63.236.33: seq=0 ttl=55 time=20.000 ms
64 bytes from 58.63.236.33: seq=1 ttl=55 time=20.000 ms
64 bytes from 58.63.236.33: seq=2 ttl=55 time=30.000 ms
64 bytes from 58.63.236.33: seq=3 ttl=55 time=20.000 ms
64 bytes from 58.63.236.33: seq=4 ttl=55 time=20.000 ms
//现在可以ping通IP地址啦,那还有一个就是网络域名解释问题,也同时加上,
//公司的网络域名服务器是:192.168.0.126 和 192.168.0.111
//POS机的linux系统下的/etc/resolv.conf就是域名解释服务器设定文件
//查看当前域名信息
# cat /etc/resolv.conf
nameserver 192.128.0.111
nameserver 192.168.1.1
//修改为公司域名服务器地址
# cat /etc/resolv.conf
nameserver 192.168.0.111
nameserver 192.168.0.126
#
//现在就可以ping 通域名服务器啦,尝试一下ping 新浪网
# ping -I eth1
PING (58.63.236.38): 56 data bytes
64 bytes from 58.63.236.38: seq=0 ttl=55 time=20.000 ms
64 bytes from 58.63.236.38: seq=1 ttl=55 time=20.000 ms
64 bytes from 58.63.236.38: seq=2 ttl=55 time=20.000 ms
64 bytes from 58.63.236.38: seq=3 ttl=55 time=20.000 ms
//下一步就是使用netperf测试一下WiFi网卡的网络性能
//在测试性能问题之前,因为有两张网卡,eth0, eth1,在netperf通信时,会先查看路由表信
//息,因为路由表的第一个位置已经匹配我netserver服务器的IP地址(同个局域网),所以
//IP包会路由到eth0网卡,然后跟我主机(192.168.56.137)的真实网卡进行测试,所以要先设
//置好POS机linux中的路由表第一项为eth1,操作如下:
#
# route add -net 192.168.56.0 netmask 255.255.254.0 dev eth1
#
# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.56.0 0.0.0.0 255.255.254.0 U 0 0 0 eth1
192.168.56.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
192.168.56.0 0.0.0.0 255.255.254.0 U 0 0 0 eth1
0.0.0.0 192.168.56.1 0.0.0.0 UG 0 0 0 eth1
#
//你可以使用删除路由信息指令去删除某一项
#
# route del default gw 192.168.56.1
#
#
# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.56.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
192.168.56.0 0.0.0.0 255.255.254.0 U 0 0 0 eth1
//设定好IP路由表后,可以在我的主机(windows: 192.168.56.137)开启netperf的服务器:
C:\XXX\NetPerf-2.4.5-w32>netserver -L 192.168.56.137 -p 8887 -4
//然后在POS机的linux系统中使用netperf来发起测试行为:
# netperf -p 8887 -H 192.168.56.137
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.56.137 (192.168.56.137) port 0 AF_INET
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec
8192 16384 16384 10.11 1.72
#
//以太网卡跟wifi卡的吞吐量比较
//下面是对WiFi网卡比较全面的各种类型测试数据
==================================================================
#
# netperf -t TCP_STREAM -p 8880 -H 192.168.56.137 -- -m 1024
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.56.137 (192.168.56.137) port 0 AF_INET
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec
8192 16384 1024 10.12 1.15
#
# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.56.0 0.0.0.0 255.255.254.0 U 0 0 0 eth1
192.168.56.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
0.0.0.0 192.168.56.1 0.0.0.0 UG 0 0 0 eth1
#
# netperf -t UDP_STREAM -p 8880 -H 192.168.56.137 -- -m 1024
UDP UNIDIRECTIONAL SEND TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.56.137 (192.168.56.137) port 0 AF_INET
Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec
32767 1024 10.01 2048 0 1.68
8192 10.01 2048 1.68
#
# netperf -t TCP_RR -p 8880 -H 192.168.56.137
TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.56.137 (192.168.56.137) port 0 AF_INET
Local /Remote
Socket Size Request Resp. Elapsed Trans.
Send Recv Size Size Time Rate
bytes Bytes bytes bytes secs. per sec
16384 87380 1 1 10.01 89.21
8192 8192
#
# netperf -t TCP_CRR -p 8880 -H 192.168.56.137
TCP Connect/Request/Response TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.56.137 (192.168.56.137) port 0 AF_INET
Local /Remote
Socket Size Request Resp. Elapsed Trans.
Send Recv Size Size Time Rate
bytes Bytes bytes bytes secs. per sec
16384 87380 1 1 10.01 20.28
8192 8192
#
# netperf -t UDP_RR -p 8880 -H 192.168.56.137
UDP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.56.137 (192.168.56.137) port 0 AF_INET
Local /Remote
Socket Size Request Resp. Elapsed Trans.
Send Recv Size Size Time Rate
bytes Bytes bytes bytes secs. per sec
32767 32767 1 1 10.01 85.61
8192 8192
#
==================================================================
//结果发现不如eth0网卡,郁闷ing....