Http://blog.sina.com.cn/s/blog_478ef86301007z2m.html
-----------------------------------------------------------------------
********************* ***************
-----------------------------------------------------------------------
1. iwconfig
Iwconfig is Linux Wireless
One of the User-layer configuration tools of extensions (LWE. LWE is a tool for configuring wireless networks in Linux,
It includes Kernel support, user-layer configuration tools, and Driver Interface Support. At present, many wireless network cards support LWE, and mainstream Linux versions, such as RedHat
This configuration tool is already included in Linux and Ubuntu Linux.
Usage: iwconfig interface [Essid {NN | on | off}]
[Nwid {NN | on | off}]
[Mode {managed | ad-hoc | ...}
[Freq N. NNNN [k | M | G]
[Channel N]
[AP {n | off | auto}]
[Sens N]
[Nick N]
[Rate {n | auto | fixed}]
[RTS {n | auto | fixed | off}]
[Frag {n | auto | fixed | off}]
[ENC {NNNN-NNNN | off}]
[Power {period N | timeout n}]
[Retry {limit n | lifetime n}]
[Txpower n {MW | dBm}]
[Commit]
Note: iwconfig is the most important tool for LWE. You can configure most parameters of the wireless network card.
Parameters:
Essid: Set the Essid (Extension Service Set
ID ). Essid is used to distinguish different wireless networks. Normally, only wireless sites with the same Essid are available.
Can communicate with each other, unless you want to listen to the wireless network. The following parameter is an Essid string enclosed by double quotation marks, or any/ON/OFF. If the Essid string contains
Any/no/off, you need to add "--" in front "--".
Example:
# Iwconfig eth0 Essid
Any
Any Essid is allowed, that is, the hybrid mode.
# Iwconfig eth0 Essid "My
Network"
Set Essid to "my network"
# Iwconfig eth0 Essid --
"Any"
Set Essid to "any"
Nwid: Network
ID, used only for wireless NICs of the pre-802.11, 802.11 Nic uses Essid and MAC address of AP to replace nwid, basically do not need to set now.
Example:
# Iwconfig eth0 nwid ab34
# Iwconfig eth0 nwid off
NICK:
This parameter is required for some NICs. However, this parameter is not used for both the 802.11 protocol stack and Mac, and is generally not required.
Example:
# Iwconfig eth0 nickname "My Linux node"
Mode: Set the working mode of the wireless network card. It can be
Ad-hoc: point-to-point wireless network without AP
Managed: a network composed of multiple APs, which allows wireless devices to roam.
MASTER: sets the wireless network card as an AP
Repeater: set as a wireless network relay device to forward network packets.
Secondary: set as the backup AP/Repeater
Monitor: listening mode
Auto: the working mode is automatically selected by the wireless network adapter.
Example:
# Iwconfig eth0 mode managed
# Iwconfig eth0 mode ad-hoc
Freq/channel: set the frequency or channel of the wireless network adapter. A parameter smaller than 1000 is considered as a channel, and a parameter greater than 10000 is considered as a frequency. Frequency Unit: Hz,
K, M,
G to change the order of magnitude, such as 2.4g. The channel starts from 1. You can use the lwlist tool to view the frequency supported by wireless network interfaces.
And channels. The off/auto parameter indicates the automatic selection frequency of the wireless network.
Note: In managed mode, the AP indicates the working frequency of the wireless network adapter. Therefore, the parameters set in this mode are ignored. In ad-hoc mode, only the specified frequency is used for the initial wireless network. If an existing ad-hoc network is added, the configured frequency parameter is ignored.
Example:
# Iwconfig eth0 freq2422000000
# Iwconfig eth0 freq 2.422g
# Iwconfig eth0 Channel 3
# Iwconfig eth0 Channel Auto
AP: connect to the specified AP or wireless network. The following parameter can be the MAC address or iwlist of the AP.
The identifier of the scan. If it is ad-hoc, it is connected to an existing ad-hoc network. Use the off parameter to enable the wireless network adapter to enter the automatic mode without changing the connected AP. Any/auto parameter. The wireless network card automatically selects the best AP.
Note: If the wireless signal is low to a certain extent, the wireless network will automatically select the AP mode.
Example:
# Iwconfig eth0 AP 00: 60: 1D: 01: 23: 45
# Iwconfig eth0 AP any
# Iwconfig eth0 AP off
Rate/bit: If the wireless network card supports multiple rates, you can use this command to set the working rate. A parameter smaller than 1000 is defined by a specific wireless network card driver. It is generally the index value of the transmission rate. If it is greater than 1000, the speed is measured in BPS. K, M, and,
G to specify the order of magnitude. Auto parameter enables the wireless network card to automatically select a rate
The fixed parameter prevents the wireless network adapter from using the automatic rate mode.
Example:
# Iwconfig eth0 rate 11 m
# Iwconfig eth0 rate auto
# Iwconfig eth0 rate 5.5 m
Auto
// Automatically select a rate of less than 5 MB
Txpower: If the wireless network card supports multiple transmit power settings, use this parameter to set the transmit unit to dBm. If it is specified as W (MW), only the conversion formula is as follows:
DBM = 30 + Log (W ). The on/off parameter can be used to enable or disable the transmitting unit. Auto and fixed specify whether the transmitting power is automatically selected for the wireless device.
Example:
# Iwconfig eth0 txpower 15
# Iwconfig eth0 txpower 30 MW
# Iwconfig eth0 txpower auto
# Iwconfig eth0 txpower off
SENS: Set the lower limit of the receiver sensitivity. Under this lower limit, the wireless network adapter determines that the wireless network signal is too bad, and different network adapters take different measures. Some modern wireless network adapters
The new AP is automatically selected. The positive parameter is raw.
Data is directly transmitted to the wireless NIC Driver for processing, which is generally considered as a percentage. A negative value indicates the DBM value.
Example:
# Iwconfig eth0 sens-80
# Iwconfig eth0 sens 2
Retry: Set the retransmission mechanism of the wireless network adapter. Limit 'value'
Specify the maximum number of retransmissions; lifetime
'Value' specifies the maximum retry time, in seconds. It can be attached with M and U.
The Unit is millisecond and microsecond. If the wireless network adapter supports automatic mode, you can add min and max before limit and lifetime to specify the upper and lower limits.
Example:
# Iwconfig eth0 retry 16
# Iwconfig eth0 retry lifetime 300 m
# Iwconfig eth0 retry min limit 8
RTS: Specifies the RTS/CTS handshake mode. Using the RTS/CTS handshake will increase the overhead, but performance can be improved if there are hidden wireless nodes or many wireless nodes in the wireless network.
The following parameter specifies the minimum package size using this mechanism. If this value is equal to the maximum package size, this mechanism is not allowed. You can use auto/Off/fixed
Parameters.
Example:
# Iwconfig eth0 RTS 250
# Iwconfig eth0 RTS off
Frag: Set the shard size of the sent data packet. Setting shards increases the overhead, but increases the packet arrival rate in a noisy environment. Generally, this parameter is smaller than the maximum package.
Size. For some wireless NICs that support the burst mode, you can set a value greater than the maximum package size to allow the burst mode. You can also use the Auto/fixed/off parameter.
Example:
# Iwconfig eth0 frag 512
# Iwconfig eth0 frag
Off
Key/ENC [ryption]: Set the encryption key used by the wireless network adapter. Here is the encryption key for setting WEP mode. To use WPA, you need the wpa_supplicant toolkit.
The key parameter can be a XXXX-XXXX-XXXX-XXXX or XXXXXXXX
The hexadecimal value in the format, which can also be an ASCII character of S: xxxxxx. If
If [Index] is added, only the key corresponding to the index value is set and the current key is not changed. You can directly specify the [Index] value to set which key is currently used. Specify on/
Off can control whether the encryption mode is used. Open/restricted specifies the encryption mode, which depends on different wireless network adapters. The open mode of most wireless network adapters does not use encryption and
Allow to receive unencrypted data packets. Restricted mode uses encryption. Multiple key parameters can be used, but only the last one takes effect.
The WEP key can be 40 bits, expressed by 10 hexadecimal digits or 5 ASCII characters, or bits, expressed by 26 hexadecimal digits or 13 ASCII values tables.
.
Example:
# 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: Set the power management mode of the wireless network card. Period
'Value' specifies the wake-up period, timeout
'Value' specifies the wait time for sleep. Before these two parameters, you can
Add min and max values. The unit of these values is seconds. You can append m and u to specify milliseconds and microseconds. Off/on parameter specifies whether to allow power management, all/unicast/Multicast
Specifies the data packet type that can be awakened.
Example:
# Iwconfig eth0 power period 2
# Iwconfig eth0 power 500 m unicast
# Iwconfig eth0 power timeout 300u all
# Iwconfig eth0 power off
# Iwconfig eth0 power min period 2 power Max period 4
Commit: Submit all parameters to the wireless NIC Driver. Some wireless network card drivers cache the parameter repair of the wireless network card. Use this command to make the parameter modification of the wireless network card take effect. However, I
You do not need to use this command, because the wireless NIC driver will eventually take effect of the parameter modification, which is generally used in debug.
-------------------------------------------------------------------------
Iwlist eth1 scan:
Show the searched Network (only one network is displayed here ):
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
......
---------------------------------------------------------------------------
Set the channel of the Board
Iwlist eth1 Channel 11
-----------------------------------------------------------------------------
Setting Mode:
Iwconfig eth1 mode managed
Use MAC
Set AP:
Iwconfig eth1 AP 00: 0a: EB: CA: 79: B0
AP connected to WEP on:
Iwconfig eth1 key s: 12345 is equivalent to iwconfig eth1
ENC
3132333435 (HEX value of 12345)
(Why is the ap64bit password 40bit)
Iwconfig eth1 key on
Iwconfig eth1 Essid sychip_demo
Disconnect WEP:
Iwconfig eth1 ENC off
View IP Address:
Ifconfig eth1
Set IP Address:
Ifconfig eth1 10.3.1.74
Set IP Address: 129.158.215.204, netmask:
255.255.255.0 is allocated to rh0,
# Ifconfig rh0 129.158.215.204 netmask
255.255.255.0
Obtain the IP address;
Ifconfig eth1 DHCP
Start
(From eth1, DHCP is available without IP addresses)
Udhcpc-I eth1
Udhcpc -- Help
Route processing:
To delete an IP address starting with 10.
For all routes in the route table, type:
Route Delete 10 .*
Route del default
Route add-net 10.3.0.0 netmask route 0.0
Eth1 (before eth1 obtains the IP address, use this command to display: no such
Device)
---------------------------------------------------------------------------