logo

English

임베디드 무선랜 개발 iwconfig wpa_supplicant

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

필요한 소프트웨어
wireless-tools,  wpa_supplicant,  dhcpcd


iwconfig명령으로 사용 가능한 무선랜 카드 장치 이름 확인할 수 있다. wlan0이 무선 랜카드 임을 알 수 있다. 
$ iwconfig
lo        no wireless extensions.

wlan0     IEEE 802.11bgn  Mode:Managed  Access Point: Not-Associated   
          Tx-Power=0 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          
sit0      no wireless extensions.

eth0      no wireless extensions.


유선 랜 장치를 비활성화하고 무선 랜 장치를 활성화 한다. 
ifconfig eth0 down
ifconfig wlan0 up


연결 가능한 무선 공유기의 ssid 이름 및 무선 보안 여부를 확인해야 함.
iwlist wlan0 scanning
.......................
Encryption key:on  <-- 무선 보안 사용 중임
ESSID:"ssid_name"  <-- ssid 이름
.......................
IE: WPA Version 1  <-- 무선 보안 정보
    Group Cipher : CCMP
    Pairwise Ciphers (1) : CCMP
    Authentication Suites (1) : PSK
IE: IEEE 802.11i/WPA2 Version 1
    Group Cipher : CCMP
    Pairwise Ciphers (1) : CCMP
    Authentication Suites (1) : PSK
.......................

wpa_supplicant 명령을 사용하려면 wpa_supplicant.conf가 필요하다. 
이를 위해 우선 psk키를 생성한다.

wpa_passphrase ssid_name > /etc/wpa_supplicant/wpa_supplicant.conf  
password 입력 후 엔터 


입력한 password가 psk로 바꿔어 진 것을 확인 할 수 있다. 
cat /etc/wpa_supplicant/wpa_supplicant.conf
# reading passphrase from stdin
network={
    ssid="ssid_name"
    #psk="입력한 password"   
    psk="생성된 psk"
}


생성된 파일 wpa_supplicant.conf에 추가 정보를 입력한다. 
# reading passphrase from stdin
network={
        ssid="ssid_name"
        proto=WPA
        key_mgmt=WPA-PSK
        pairwise=CCMP
        group=CCMP
        psk="생성된 psk"
}


유선 랜 장치를 중지시키고 
ifconfig eth0 down

무선 랜  장치를 활성화 한다. 
ifconfig wlan0 up

ssid가 ssid_name인 공유기에 연결한다
iwconfig wlan0 essid "ssid_name"
wpa_supplicant -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf &
[1] 1920
CTRL-EVENT-SCAN-RESULTS 
Trying to associate with 00:00:00:00:00:00 (SSID='ssid_name' freq=2412 MHz)
Associated with 00:00:00:00:00:00
WPA: Key negotiation completed with 00:00:00:00:00:00 [PTK=CCMP GTK=CCMP]
CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (auth) [id=0 id_str=]


ip를 dhcp로 할당 받는다
dhcpcd wlan0 &
[2] 1923
wlan0: dhcpcd 4.0.15 starting
wlan0: broadcasting for a lease
wlan0: offered 192.168.0.2 from 192.168.0.1
wlan0: acknowledged 192.168.0.2 from 192.168.0.1
wlan0: checking 192.168.0.2 is available on attached networks
wlan0: leased 192.168.0.2 for 864000 seconds


또는 수동으로 ip를 설정하려면
$ ifconfig wlan0 192.168.0.10 netmask 255.255.255.0 broadcast 192.168.0.255
$ route add default gw 192.168.0.1 wlan0
$ echo nameserver 192.168.0.1 > /etc/resolv.conf   <--DNS 서버 설정 

인터넷 사용가능 여부 테스트
ping google.com
PING google.com (74.125.127.147) 56(84) bytes of data.
64 bytes from pz-in-f147.1e100.net (74.125.127.147): icmp_seq=1 ttl=48 time=135 ms



참고 

Wireless LAN with WPA (AES)

 
TAG •

List of Articles
No. Subject Author Date Views
» 임베디드 무선랜 개발 iwconfig wpa_supplicant digipine 2017.11.02 775
6 How video compression works 5/5 - Deblocking, deringing, and color space conversion file digipine 2017.11.02 23694
5 How video compression works 4/5 - Encoder secrets and motion compensation digipine 2017.11.02 340
4 How video compression works 3/5 - Color and motion file digipine 2017.11.02 1595
3 How video compression works 2/5 - Quantization, coding, and prediction file digipine 2017.11.02 5828
2 How video compression works 1/5 file digipine 2017.11.02 1596
1 TI사의 DSP 종류 digipine 2017.11.02 766
Board Pagination Prev 1 ... 2 3 4 Next
/ 4