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
67 DaVinci 에 대한 소개글 digipine 2017.11.03 112
66 도커(Docker)와 쿠버네티스(Kubernetes)란 무엇인가? digipine 2021.10.20 158
65 트위터에서 다크모드 설정 방법 file digipine 2022.01.20 184
64 UC 환경을 위한 종합 네트워크 FMC digipine 2017.11.03 202
63 마이크로소프트, 차세대 운영체제 윈도우 11 공개 file digipine 2021.06.29 209
62 애플, 서드파티 앱마켓 진출 허용하나 lizard2019 2022.12.18 223
61 RFID와 USN 에 대해서 digipine 2017.11.03 226
60 Cubism Live2D Demo Windows D3D9 file lizard2019 2023.01.11 243
59 차세대 비휘발성 메모리 기술동향 file digipine 2017.11.02 247
58 삼성전자 갤럭시 S22 발표, S펜을 탑재한 첫 S시리즈 file digipine 2022.02.10 249
57 iOS 14.3 업데이트 릴리즈 file digipine 2020.12.16 266
56 애플 드디어 ARM 기반의 맥 출시 예정, 11월 10일 digipine 2020.11.09 300
55 딥마인드, 인간 개발자와 유사한 수준의 AI ‘알파코드’ 개발 file digipine 2022.02.03 302
54 퀄컴, 갤노트20 두뇌 '스냅드래곤865+' 공개 file digipine 2020.07.09 303
53 모바일 전용 CPU ARM이 노트북과 AI로 진화 한다 file digipine 2017.11.03 318
52 안드로이드 의 써드파티 어플의 SD RW 권한 부여 digipine 2017.11.03 335
51 HIGH QUALITY MOBILE EXPERIENCE (HQME) digipine 2017.11.03 339
50 구글 서비스, 데이터 유지 기간을 18개월로 조정 file digipine 2020.06.25 339
49 How video compression works 4/5 - Encoder secrets and motion compensation digipine 2017.11.02 340
48 IoT 악성 코드 "Mirai"변종이 급증 주의 file 엉뚱도마뱀 2017.11.28 344
Board Pagination Prev 1 2 3 ... 4 Next
/ 4