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
27 Wandboard Yocto XBMC 올리기 digipine 2017.11.03 436
26 Wandboard Yocto XBMC 올리기 digipine 2017.11.03 351
25 안드로이드 의 써드파티 어플의 SD RW 권한 부여 digipine 2017.11.03 336
24 스니핑 개념, 공격기법, 방어법, 참고할만한 오픈소스 라이브러리 및 툴 digipine 2017.11.03 1300
23 GA-P55A-UD3R rev 2.0 / GT 240 OSX 스노우 레파드 해킨가이드 digipine 2017.11.03 754
22 HIGH QUALITY MOBILE EXPERIENCE (HQME) digipine 2017.11.03 339
21 해킨토시 설치법 GA-P55A-UD3R rev 2.0 / intel Core i5 760 / NVIDIA GeForce GT 240 digipine 2017.11.03 643
20 CISCO Router 설정 팁 - QOS 1 digipine 2017.11.03 1817
19 UC 환경을 위한 종합 네트워크 FMC digipine 2017.11.03 202
18 네트웍 용어중 bps, cps, BPS, pps 의 차이점 digipine 2017.11.03 1578
17 L4 장비의 핵심 로드 밸런싱(Load Balancing) digipine 2017.11.03 946
16 DaVinci 에 대한 소개글 digipine 2017.11.03 112
15 RFID와 USN 에 대해서 digipine 2017.11.03 226
14 SECS 프로토콜 개요 digipine 2017.11.03 899
13 반도체 전공정 후공정 설명 digipine 2017.11.02 4305
12 반도체 장비/공정 기술 용어집 digipine 2017.11.02 1890
11 차세대 비휘발성 메모리 기술동향 file digipine 2017.11.02 247
10 서보모터의 기초와 제어 file digipine 2017.11.02 423
9 서보 모터 (Servo-motor) 의 내부 구조와 회전 원리 file digipine 2017.11.02 807
8 Linux Wi-Fi Setup Tools and Commands digipine 2017.11.02 15454
Board Pagination Prev 1 ... 2 3 ... 4 Next
/ 4