logo

English

Linux Wi-Fi Setup Tools and Commands

by digipine posted Nov 02, 2017
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

NOTE: NOT ALL CARDS/FIRMWARE SUPPORT ALL OF THE COMMANDS LISTED BELOW.

 

Note: To connect your Linux machine to a WLAN using WPA, WPA2 or 802.1X you will need to use WPA Supplicant

  

Connecting to an OPEN / WEP WLAN (DHCP)

 Note: replace [interface] with your interface name as required (e.g. eth1, wlan0, ath0 etc.)

 iwconfig [interface] mode managed key [WEP key] (128 bit WEP use 26 hex characters, 64 bit WEP uses 10)

  

iwconfig [Interface] essid "[ESSID]" (Specify ESSID for the WLAN)

 

dhclient [interface] (to receive an IP address, netmask, DNS server and default gateway from the Access Point)

  

ping www.bbc.co.uk  (if you receive a reply you have access)

 

  

Connecting to an OPEN / WEP WLAN (Manual IP Setup)

 Note: replace [interface] with your interface name as required (e.g. eth1, wlan0, ath0 etc.)

 It may be necessary to run some packet capture software (e.g. Ethereal) to determine the IP addresses of both the Default Gateway and DNS servers.

 iwconfig [interface] mode managed key [WEP key] (128 bit WEP use 26 hex characters, 64 bit WEP uses 10)

  

iwconfig [interface] essid "[ESSID]"

 

ifconfig [interface] [IP address] netmask [subnetmask]

  

route add default gw [IP of default gateway] (Configure your default gateway; usually the IP of the Access Point)

  

echo nameserver [IP address of DNS server]  >>  /etc/resolve.conf (Configure your DNS server)

  

ping www.bbc.co.uk (if you receive a reply you have access)

  

 

iwconfig Commands:

 Note: replace [interface] with your interface name as required (e.g. eth1, wlan0, ath0 etc.)

 iwconfig [interface] mode master (set the card to act as an access point mode)

 

 iwconfig [interface] mode managed (set card to client mode on a network with an access point)

  

iwconfig [interface] mode ad-hoc (set card to peer to peer networking or no access point mode)

  

iwconfig [interface] mode monitor (set card to RFMON mode our favourite)

  

iwconfig [interface] essid any (with some cards you may  disable the  ESSID  checking)

  

iwconfig [interface] essid �your ssid_here� (configure ESSID for network)

  

iwconfig [interface] key 1111-1111-1111-1111 (set 128 bit WEP key)

  

iwconfig [interface] key 11111111 (set 64 bit WEP key)

  

iwconfig [interface] key s:mykey (set key as an ASCII string)

  

iwconfig [interface] key off (disable WEP key)

  

iwconfig [interface] key open (sets open mode, no authentication is used and card may accept non-encrypted sessions)

  

iwconfig [interface] channel [channel no.] (set a channel 1-14)

  

iwconfig [interface] channel auto (automatic channel selection)

  

iwconfig [interface] freq 2.422G (channels can also be specified in GHz)

  

iwconfig [interface] ap 11:11:11:11:11:11 (Force card to register AP address)

  

iwconfig [interface] rate 11M (card will use the rate specified)

  

iwconfig [interface] rate auto (select automatic rate)

  

iwconfig [interface] rate auto 5.5M (card will use the rate specified and any rate below as required)

 

  

ifconfig Commands:

 Note: replace [interface] with your interface name as required (e.g. eth1, wlan0, ath0 etc.)

 ifconfig [interface] up (bring up specified interface)

  

ifconfig [interface] down (take down specified interface)

  

ifconfig [interface] [IP address] netmask [subnet-mask] (manually set IP and subnet-mask details)

  

ifconfig [interface] hw ether [MAC] (Change the wireless cards MAC address, specify in format 11:11:11:11:11:11)

 

  

iwpriv Commands:

 Note: replace [interface] with your interface name as required (e.g. eth1, wlan0, ath0 etc.)

 iwpriv [interface] hostapd 1 (used to set card mode to hostapd e.g. for void11)

  

When the monitor mode patch is installed as per the Wireless Build HOWTO the following commands may be used to set the card into monitor mode.

  

iwpriv [interface] monitor [A] [B]

[A]

0 = disable monitor mode

1 = enable monitor mode with Prism2 header 
= enable monitor mode with no Prism2

[B]

Channel to monitor (1-14)

 

iwlist Commands:

 

Note: replace [interface] with your interface name as required (e.g. eth1, wlan0, ath0 etc.)

 

iwlist is used to display some large chunk of information from a wireless network interface that is not displayed by iwconfig.

 

iwlist [interface] scan (Give the list of Access Points and Ad-Hoc cells in range (ESSID, Quality, Frequency, Mode etc.) Note: In tests only worked with Atheros cards).

  

iwlist [interface] channel (Give the list of available frequencies in the device and the number of channels).

  

iwlist [interface] rate (List the bit-rates supported by the device).

  

iwlist [interface] key (List the encryption key sizes supported and display all the encryption keys available in the device).

  

iwlist [interface] power (List the various Power Management attributes and modes of the device).

  

iwlist [interface] txpower (List the various Transmit Power available on the device).

 

 iwlist [interface] retry (List the transmit retry limits and retry lifetime on the device).

  

iwlist [interface] ap (Give the list of Access Points in range, and optionally the quality of link to them.  Deprecated in favour of scan)

  

iwlist [interface] peers (Give the list of Peers associated/registered with this card).

  

iwlist [interface] event (List the wireless events supported by this card).

 

 

Madwifi-ng Commands:

 

MADWiFi supports virtual access points (VAPS), which means you can create more than one wireless device per wireless card (the host wireless card = wifi0). 

 By default, a sta mode VAP is created by, which is MadWifi talk for a 'managed mode wireless interface'.

  

Note: replace athx with your interface name as required (e.g. ath0, ath1)

  

wlanconfig athx destroy (Destroy VAP, athx)

  

wlanconfig athx create wlandev wifi0 wlanmode sta (Create a managed mode VAP, athx)

  

wlanconfig athx create wlandev wifi0 wlanmode ap (Create an Access Point VAP, athx)

 

 wlanconfig athx create wlandev wifi0 wlanmode adhoc (Create an Ad-Hoc VAP, athx)

  

wlanconfig athx create wlandev wifi0 wlanmode monitor (Create a Monitor mode VAP, athx)

  

Changing modes:

 ifconfig athx down (Take the VAP down)


wlanconfig athx destroy (Destroy the VAP, athx)


wlanconfig athx create wlandev wifi0 wlanmode [sta|adhoc|ap|monitor] (Create a new sta, adhoc, ap or monitor VAP)

 

 Scan for Access Points (requires both steps):

 modprobe wlan_scan_sta (To insert the scanning module)

  

wlanconfig athx list scan (To list the APs)


 

 


 

1. 무선랜 Device 구동

  1. iwconfig 로 무선 Device 검색

    # iwconfig
    lo        no wireless extensions.

    eth0      no wireless extensions.

    wlan0     IEEE 802.11abg  ESSID:off/any 
              Mode:Managed  Frequency:2.462 GHz  Access Point: Not-Associated  
              Tx-Power=15 dBm  
              Retry  long limit:7   RTS thr:off   Fragment thr:off
              Encryption key:off
              Power Management:on
  2. 무선 Device 의 Bring up

    # ifconfig wlan0 up

 

2. 외부 무선 Device 검색

 

 # iwlist wlan0 scan

 

3. WEP

 

iwconfig 이용

 

인증이 OPEN이고, Key가 ASCII일경우,

 

# iwconfig wlan0 essid xxxyyyzzz channel 11 key s:testtest

 

# iwconfig
eth0      no wireless extensions.

wlan0     IEEE 802.11abg  ESSID:"xxxyyyzzz" 
          Mode:Managed  Frequency:2.462 GHz  Access Point: 00:08:9F:09:75:B8  
          Bit Rate=1 Mb/s   Tx-Power=15 dBm  
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:4578-6365-6C74-6563-6831-3032-37
          Power Management:on
          Link Quality=66/70  Signal level=-44 dBm 
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

 

 wpa_supplicant 이용

# wpa_supplicant -B -iwlan0 -cwpa_supplicant.conf

 

ctrl_interface=/var/run/wpa_supplicant

 

network={

ssid="TestAP"

#scan_ssid=1 # Hidden AP 일 경우에만 설정

key_mgmt=NONE

wep_key0="testetetst"

auth_alg=OPEN

}

 

 

4. WPA

 

# wpa_supplicant -B -iwlan0 -cwpa_supplicant.conf

 

wpa_supplicant.conf

 

ctrl_interface=/var/run/wpa_supplicant

 

network={

ssid="TestAP"

#scan_ssid=1

psk="testtesttest"

key_mgmt=WPA-PSK

proto=WPA

pairwise=CCMP

group=CCMP

}

 

5. WPA2

 

# wpa_supplicant -B -iwlan0 -cwpa_supplicant.conf

 

ctrl_interface=/var/run/wpa_supplicant

 

network={

ssid="TestAP"

#scan_ssid=1

psk="testtesttest"

key_mgmt=WPA-PSK

proto=RSN

pairwise=CCMP

group=CCMP

}

 

 

 

 

6. dhcp

 

# dhclient wlan0

 

# dhclient wlan0

Internet Systems Consortium DHCP Client V3.1.3
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/00:27:10:2a:74:94
Sending on   LPF/wlan0/00:27:10:2a:74:94
Sending on   Socket/fallback
DHCPREQUEST of 192.168.2.45 on wlan0 to 255.255.255.255 port 67
DHCPACK of 192.168.2.45 from 172.16.20.1
bound to 192.168.2.45 -- renewal in 17242 seconds.

 

7. Trouble Shooting

 network-manager가 동작 중 일 경우에는 Terminal에서 wifi Association시에 에러가 발생 할 수 있다.

이 경우에는 network-manager를 stop 시켜야 한다.

 

# /etc/init.d/network-manager stop

TAG •

List of Articles
No. Subject Author Date Views
67 해킨토시 설치법 GA-P55A-UD3R rev 2.0 / intel Core i5 760 / NVIDIA GeForce GT 240 digipine 2017.11.03 643
66 파나소닉, 풀 스펙 8K 동영상 신호 전송용 단일 케이블 및 커넥터 솔루션 개발 file lizard2019 2019.06.07 1187
65 트위터에서 다크모드 설정 방법 file digipine 2022.01.20 185
64 퀄컴, 갤노트20 두뇌 '스냅드래곤865+' 공개 file digipine 2020.07.09 303
63 쿠버네티스, 도커 지원 중단 file digipine 2021.10.20 489
62 차세대 비휘발성 메모리 기술동향 file digipine 2017.11.02 247
61 임베디드 무선랜 개발 iwconfig wpa_supplicant digipine 2017.11.02 775
60 임베디드 Linux 시스템 부팅 시 프로그램 자동 실행 digipine 2017.11.03 4154
59 이더리움 (Ethereum) digipine 2018.02.08 826
58 윈도우XP 배경화면, '스마트폰용' 속편 출시 file 엉뚱도마뱀 2017.11.27 761
57 영화의 매트릭스의 네오의 컴퓨터 화면 프로그램 digipine 2021.02.04 1050
56 애플, 서드파티 앱마켓 진출 허용하나 lizard2019 2022.12.18 235
55 애플, 맥미니 2011 지원 종료 공식화, 신제품 출시는 미정 file 엉뚱도마뱀 2017.12.08 748
54 애플 워치와 모방제품과의 승부 file lizard2019 2020.05.26 454
53 애플 드디어 ARM 기반의 맥 출시 예정, 11월 10일 digipine 2020.11.09 300
52 암호화폐 (Crypto Currency) 비트코인 file digipine 2018.02.08 3514
51 안드로이드 의 써드파티 어플의 SD RW 권한 부여 digipine 2017.11.03 336
50 스니핑 개념, 공격기법, 방어법, 참고할만한 오픈소스 라이브러리 및 툴 digipine 2017.11.03 1300
49 서보모터의 기초와 제어 file digipine 2017.11.02 423
48 서보 모터 (Servo-motor) 의 내부 구조와 회전 원리 file digipine 2017.11.02 807
Board Pagination Prev 1 2 3 ... 4 Next
/ 4