Linux commands to set up a wireless connection

Source: Internet
Author: User

Using the Iwconfig command

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

Iwconfig wlan0 Essid "Spaek"

Iwconfig WLAN Key s:liudehua123

Dhclient Wlan0

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

Iwconfig is one of the user layer configuration tools for the Linux Wireless Extensions (LWE). Lwe is a tool for configuring wireless networks under Linux, including kernel support, user-level configuration tools, and driver interface support. Many wireless cards now support lwe, and the mainstream Linux release, such as Redhat Linux, Ubuntu Linux, has been equipped with this configuration tool.


1, Iwconfig
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]

Description: Iwconfig is the most important tool for lwe, which can be configured for most of the wireless card parameters.
Parameters:
Essid: Sets the Essid (Extension Service set ID) of the wireless card. Use Essid to differentiate between different wireless networks, normally only the same Essid wireless sites
To communicate with each other, unless you want to listen to wireless networks. Subsequent arguments are double-quoted Essid strings, or Any/on/off, if the Essid string contains
Any/no/off, you need to add "--" to the front.
Example:
#iwconfig eth0 Essid Any allows any Essid, i.e. promiscuous mode
#iwconfig eth0 Essid "My Network" setting Essid to "My Network"
#iwconfig eth0 Essid--"any" setting Essid to "any"

Nwid:network ID, only for pre-802.11 wireless card, 802.11 network card with ESSID and AP MAC address to replace Nwid, now basically do not set.
Example:
#iwconfig eth0 Nwid AB34
#iwconfig eth0 Nwid off

Nick:nickname, some network cards need to set this parameter, but the 802.11 protocol stack, MAC does not use this parameter, generally do not have to set.
Example:
#iwconfig eth0 nickname "My Linux Node"

Mode: Sets the operating modes of the wireless card, which can be
Ad-hoc: Point-to-point wireless network without AP
Managed: A network of multiple APS that allows wireless devices to roam through the network
Master: Set the wireless card as an AP
Repeater: Set as a wireless network relay device that can forward network packets
Secondary: Ap/repeater Set as Backup
Monitor: Monitor mode
Auto: Automatic selection of working mode by wireless card

Example:
#iwconfig eth0 Mode Managed
#iwconfig eth0 Mode Ad-hoc

Freq/channel: Set the operating frequency of the wireless card or channel, less than 1000 of the parameters are considered to be channels, more than 10000 of the parameters are considered to be frequency. The frequency unit is Hz,
You can change the order of magnitude, such as 2.4G, by appending K, M, G to the number. The channel starts at 1. Use the Lwlist tool to see how often the wireless network card supports
and channels. The parameter Off/auto indicates the wireless network auto-pick frequency.
Note: If you are in managed mode, the AP indicates the frequency of the wireless card, so the parameters for this setting are ignored. Only the frequency of this setting is used in Ad-hoc mode
The initial wireless network, if joined to an already existing Ad-hoc network, ignores the frequency parameter of the setting.
Example:
#iwconfig eth0 freq 2422000000
#iwconfig eth0 freq 2.422G
#iwconfig eth0 Channel 3
#iwconfig eth0 Channel Auto

AP: Connect to the specified AP or wireless network, the following parameters can be the MAC address of the AP, or it can be an identifier for the Iwlist scan. If it is ad-hoc, connect to
A Ad-hoc network that already exists. Use the off parameter to allow the wireless card to enter automatic mode without changing the currently connected AP. Any/auto parameter, automatic selection of wireless card
The best AP.
Note: If the wireless signal is low to a certain level, the wireless network will go into Auto Select 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 set the rate of work by this command. Parameters less than 1000 are defined by the specific wireless NIC driver, which is generally a transmission speed
Rate of the index value, greater than 1000 of the rate, unit bps, can be appended to the number k, M, G to specify the order of magnitude. Auto parameter allows the wireless card to automatically select the rate
The fixed parameter does not use the automatic rate mode for the wireless card.

Example:
#iwconfig eth0 Rate 11M
#iwconfig eth0 Rate Auto
#iwconfig eth0 rate 5.5M Auto//automatically selects rates below 5.5M

Txpower: If the wireless network card supports multiple transmit power settings, use this parameter to set the emission, in dbm, if specified as W (MW), the conversion formula is:
Dbm=30+log (W). Parameters on/off to open and close the transmitting unit, auto and fixed specify whether the wireless automatically select the transmitting power.
Example:
#iwconfig eth0 Txpower 15
#iwconfig eth0 Txpower 30mW
#iwconfig eth0 Txpower Auto
#iwconfig eth0 Txpower off

Sens: Set the lower limit of the receiving sensitivity, under the lower limit, the wireless network card that the wireless signal is too poor, different network cards will take different measures, some modern wireless network card
The new AP is automatically selected. The positive parameter is raw data, directly to the wireless Card driver processing, is generally considered as a percentage. Negative values represent the dbm value.

Example:
#iwconfig eth0 sens-80
#iwconfig eth0 Sens 2

Retry: Sets the retransmission mechanism of the wireless card. Limit ' value ' specifies the maximum number of retransmissions; lifetime ' value ' specifies the longest retry time in seconds, which can be supplied with M and U
Specifies the units in milliseconds and microseconds. If the wireless network card supports automatic mode, you can also attach min and Max to specify the upper and lower limits before limit and lifetime.

Example:
#iwconfig eth0 Retry 16
#iwconfig eth0 retry Lifetime 300m
#iwconfig eth0 Retry min Limit 8

RTS: Specifies the rts/cts handshake, which adds additional overhead to using the rts/cts handshake, but can improve performance if there are hidden wireless nodes in the wireless network or if there are many wireless nodes.
The following parameter specifies the size of a minimum package that uses the mechanism, which is equivalent to prohibiting the use of the mechanism if the value equals the maximum packet size. You can use auto/off/fixed
Parameters.

Example:
#iwconfig eth0 RTS 250
#iwconfig eth0 RTS Off

Frag: Sets the Shard size of the sending packet. Setting up shards adds additional overhead, but it can increase the arrival rate of packets in noisy environments. In general, this parameter is less than the maximum package
Size, some wireless cards that support burst mode can set values larger than the maximum packet size to allow 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 card, here is the encryption key to set WEP mode, if you want to use WPA, the Wpa_supplicant kit is required.
The key parameter can be a hexadecimal value in xxxx-xxxx-xxxx-xxxx or XXXXXXXX format, or it can be an ASCII character of S:xxxxxx. If before the key parameter
When [index] is added, only the key corresponding to the index value is set, and the current key is not changed. Specify the [index] value directly to set which key is currently used. Specify on/
Off to control whether encryption mode is used. open/restricted Specifies the encryption mode, depending on the wireless network card, the open mode of most wireless network cards does not use encryption and
Allows to receive packets that are not encrypted, restricted mode uses encryption. You can use more than one key parameter, but only the last one takes effect.
The WEP key can be 40bit, expressed as 10 hexadecimal digits or 5 ASCII characters, or 128bit, with 26 hexadecimal digits or 13 ASCII character tabulation
Shown

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: Sets the mode for the wireless card to be managed. Period ' value ' specifies the period of wakeup, and timeout ' value ' Specifies the wait time to enter hibernation before both parameters can be
Plus min and Max modifiers, these values are in seconds and can be appended with M and U to specify milliseconds and microseconds. The off/on parameter specifies whether power management is allowed, all/unicast/multicast
Specifies the type of packet that is allowed to wake.

Example:
#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: Submit all parameters modified to the wireless card driver. Some wireless network card drivers will first cache the wireless network card parameter repair, use this command to let the wireless network card parameter modification take effect. But a
You do not need to use this command, because the wireless card driver will eventually be the parameters of the changes to take effect, generally used in the Debug.


For ease of configuration, you can write the configuration to/etc/network/interfaces so that you don't have to configure it again.

Auto Loiface lo inet loopback
Auto Eth1iface eth1 inet staticaddress 192.168.1.3netmask 255.255.255.0gateway 192.168.1.1echo nameserver 192.168.1.1 >/etc/resolv.confpre-up/sbin/iwconfig eth1 Essid "LW HOME LINK" Pre-up/sbin/iwconfig eth1 key S:liwei
Auto Usb0iface usb0 inet staticaddress 192.168.0.200netmask 255.255.255.0

Auto Dsl-provideriface dsl-provider inet ppppre-up/sbin/ifconfig eth0 Up # line maintained by Pppoeconfprovider Dsl-provi Der
Auto eth0iface eth0 inet Manual

================================================================================


Linux commands to set up a wireless connection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.