纸月的爸爸是谁:Linux操作系统的无线网络命令

来源:百度文库 编辑:中财网 时间:2024/04/28 13:05:02
rts:指定RTS/CTS握手方式,使用RTS/CTS握手会增加额外开销,但如果无线网络中有隐藏无线节点或者有很多无线节点时可以提高性能。

  后面的参数指定一个使用该机制的最小包的大小,如果该值等于最大包大小,则相当于禁止使用该机制。可以使用auto/off/fixed

  参数。

  示例:

  #iwconfig eth0 rts 250

  #iwconfig eth0 rts off

  frag:设置发送数据包的分片大小。设置分片会增加额外开销,但在噪声环境下可以提高数据包的到达率。一般情况下该参数小于最大包大小,有些支持Burst模式的无线网卡可以设置大于最大包大小的值来允许Burst模式。还可以使用auto/fixed/off参数。

  示例:

  #iwconfig eth0 frag 512

  #iwconfig eth0 frag off

  key/enc[ryption]:设置无线网卡使用的加密密钥,此处为设置WEP模式的加密key,如果要使用WPA,需要wpa_supplicant工具包。

  密钥参数可以是 XXXX-XXXX-XXXX-XXXX 或者 XXXXXXXX 格式的十六进制数值,也可以是s:xxxxxx的ASCII字符。如果在密钥参数之前加了[index],则只是设置该索引值对应的密钥,并不改变当前的密钥。直接指定[index]值可以设置当前使用哪一个密钥。指定on/off可以控制是否使用加密模式。open/restricted指定加密模式,取决于不同的无线网卡,大多数无线网卡的open模式不使用加密且允许接收没有加密的数据包,restricted模式使用加密。可以使用多个key参数,但只有最后一个生效。

  WEP密钥可以是40bit,用10个十六进制数字或者5个ASCII字符表示,也可以是128bit,用26个十六进制数字或者13个ASCII字符表

  示。

  示例:

  #iwconfig eth0 key 0123-4567-89

  #iwconfig eth0 key [3] 0123-4567-89

  #iwconfig eth0 key s:password [2]

  #iwconfig eth0 key [2]

  #iwconfig eth0 key open

  #iwconfig eth0 key off

  #iwconfig eth0 key restricted [3] 0123456789

  #iwconfig eth0 key 01-23 key 45-67 [4] key [4]

  power:设置无线网卡的电源管理模式。period ‘value’ 指定唤醒的周期,timeout ‘value’指定进入休眠的等待时间,这两个参数之前可以

  加min和max修饰,这些值的单位为秒,可以附加m和u来指定毫秒和微秒。off/on参数指定是否允许电源管理,all/unicast/multicast

  指定允许唤醒的数据包类型。

  示例:

  #iwconfig eth0 power period 2

  #iwconfig eth0 power 500m unicast

  #iwconfig eth0 power timeout 300u all

  #iwconfig eth0 power off

  #iwconfig eth0 power min period 2 power max period 4

  commit:提交所有的参数修改给无线网卡驱动。有些无线网卡驱动会先缓存无线网卡参数修,使用这个命令来让无线网卡的参数修改生效。不过一般不需要使用该命令,因为无线网卡驱动最终都会是参数的修改生效,一般在debug时会用到。

  -----------

  iwlist eth1 scan 搜索无线网络:

  显示搜到的网络(此处只显示一个):

  eth1 Scan completed :

  Cell 01 - Address: 00:04:E2:E3:04:FC

  ESSID:"ap_demo"

  Mode:Managed

  Frequency:2.437 GHz

  Quality:0/0 Signal level=-61 dBm Noise level=-96 dBm

  Encryption key:on

  Bit Rate:1 Mb/s

  Bit Rate:2 Mb/s

  Bit Rate:5.5 Mb/s

  Bit Rate:11 Mb/s

  Bit Rate:6 Mb/s

  Bit Rate:9 Mb/s

  Bit Rate:12 Mb/s

  Bit Rate:18 Mb/s

  Bit Rate:24 Mb/s

  Bit Rate:36 Mb/s

  Bit Rate:48 Mb/s

  Bit Rate:54 Mb/s

  Cell 02 ……

  ---------------

  设置板子的channel

  iwlist eth1 channel 11

  --------------

  设置模式:

  iwconfig eth1 mode managed

  通过MAC 设置AP:

  iwconfig eth1 ap 00:0A:EB:CA:79:B0

  连接到WEP on 的AP:

  iwconfig eth1 key s:12345 等效于 iwconfig eth1 enc 3132333435(12345的hex值) (为什么AP64bit的口令是40bit呢)

  iwconfig eth1 key on

  iwconfig eth1 essid sychip_demo

  断开WEP:

  iwconfig eth1 enc off

  查看IP:

  ifconfig eth1

  设置IP:

  ifconfig eth1 10.3.1.74

  把IP: 129.158.215.204 , netmask: 255.255.255.0分配给rh0,

  # ifconfig rh0 129.158.215.204 netmask 255.255.255.0

  获取IP;

  ifconfig eth1 dhcp start (从eth1走,不需要ip即可dhcp)

  udhcpc -i eth1

  udhcpc --help

  路由处理:

  若要删除以 10. 起始的 IP 路由表中的所有路由,请键入:

  route delete 10.*

  route del default

  route add -net 10.3.0.0 netmask 255.255.0.0 eth1 (eth1获得IP之前,使用此命令显示:No such device)

  编辑特别推荐: