1.wifi 켜기
# ifconfig wlan0 up
# ifconfig
wlan0 Link encap:Ethernet HWaddr 58:86:94:F7:68:56
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
2.wifi 검색
# iwlist wlan0 scanning | more
Cell 08 - Address: 70:5D:CC:D6:70:C4
ESSID:"iptime"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.442 GHz (Channel 7)
Encryption key:off -> 암호사용 여부
Bit Rates:300 Mb/s
IE: Unknown: DD7A0050F204104A00011010440001021041000100103B000103104700104D73C5C27E6B5243D6440AAB1719670B10210006697054494D4510230008697054494D4541501024000A31323334353637383930104200033336301054000800060050F204000110110008697054494D454150100800020084103C000101
Quality=36/100 Signal level=60/100
Extra:fm=0003
3.wifi 연결
(ESSID이름이 iptime이라면)
# iwconfig wlan0 essid "iptime" 또는 iw dev wlan0 connect iptime
4.wifi 연결 상태 확인
# iw wlan0 link
Connected to 70:5d:cc:d6:70:c4 (on wlan0)
SSID: iptime
freq: 2427
signal: -40 dBm
tx bitrate: 150.0 MBit/s
5.wifi ip 할당
# dhcpcd wlan0
DUID 00:01:00:01:28:01:2d:a0:02:e2:e4:67:2a:e4
wlan0: IAID 94:f7:68:56
wlan0: soliciting a DHCP lease
wlan0: soliciting an IPv6 router
wlan0: offered 192.168.0.7 from 192.168.0.1
wlan0: probing address 192.168.0.7/24
wlan0: leased 192.168.0.7 for 7200 seconds
wlan0: adding route to 192.168.0.0/24
wlan0: adding default route via 192.168.0.1
forked to background, child pid 25434
6.인터넷 연결 테스트
# ping www.google.co.kr
PING www.google.co.kr (172.217.31.163): 56 data bytes
64 bytes from 172.217.31.163: seq=0 ttl=52 time=40.399 ms
64 bytes from 172.217.31.163: seq=1 ttl=52 time=35.684 ms
7.wifi ip 연결 정보
# ip a 또는 ip addr show
15: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq qlen 1000
link/ether 58:86:94:f7:68:56 brd ff:ff:ff:ff:ff:ff
8.wifi 설정 및 연결 스크립트
위의 순서를 스크립트를 활용하여 한번에 처리
#wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
#wpa_cli -i wlan0 reconfigure
스크립트 구성
network={
ssid=공유기이름
psk=공유기 접속 비밀번호
scan_ssid=1 -> 숨겨진 ssid에 접속하기 위해서는 1로 설정해야 함
}
참고)
https://www.daemon-systems.org/man/wpa_supplicant.conf.5.html
https://gist.github.com/windows98SE/8a8a59cc5d5d9d0b2ed2
https://webnautes.tistory.com/141
https://hiseon.me/linux/command/linux-wifi-command-line/
https://www.linuxbabe.com/command-line/ubuntu-server-16-04-wifi-wpa-supplicant
https://webstory.postach.io/post/rajeuberipai-rajeubian-wifi-keomaendeu-rain-setingbangbeob
https://www.lesstif.com/lpt/linux-tee-89556049.html
9.기타 명령어
-
- wifi ip 연결 정보
# wpa_cli status
Selected interface 'wlan0'
bssid=70:5d:cc:d6:70:c4
freq=2427
ssid=iptime
id=0
id_str=school
mode=station
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
ip_address=192.168.0.7 : 외부와 통신이 안될 때는 ip_address가 보이지 않는다.
p2p_device_address=58:86:94:f7:68:56
address=58:86:94:f7:68:56
uuid=f97f4363-d017-5f52-8af7-63941e8d1418
-
- wifi ip 연결 정보
# ip r
default via 192.168.0.1 dev wlan0 src 192.168.0.7 metric 304
192.168.0.0/24 dev wlan0 src 192.168.0.7 metric 304
-
- wifi 특정 공유기 grep
# iwlist wlan0 scanning | grep ESSID:\"iptime\" -A9
ESSID:"iptime"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.427 GHz (Channel 4)
Encryption key:off
Bit Rates:300 Mb/s
IE: Unknown: DD7A0050F204104A00011010440001021041000100103B000103104700104D73C5C27E6B5243D6440AAB1719670B10210006697054494D4510230008697054494D4541501024000A31323334353637383930104200033336301054000800060050F204000110110008697054494D454150100800020084103C000101
Quality=91/100 Signal level=63/100
Extra:fm=0003
-
- wifi 동작상태
# cat /sys/class/net/wlan0/operstate
동작상태에 따라 down 또는 up이라고 표시됨
-
- wifi 검색
# iwlist wlan0 scanning | more
-
- wifi 하드웨어 검색
# iw dev
phy#11
Interface wlan0
ifindex 15
wdev 0xb00000001
addr 58:86:94:f7:68:56
type managed
-
- wifi 상태 검색
# iwconfig
wlan0 unassociated Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency=2.412 GHz Access Point: Not-Associated
Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
sit0 no wireless extensions.
lo no wireless extensions.
eth0 no wireless extensions.
//-----------------------------------
1.참고사이트
https://easylinuxtipsproject.blogspot.com/p/realtek.html?m=1
Easy tips, tweaks and tricks for Linux Mint and Ubuntu, both for beginners and for advanced users. Complete starter's guide with simple how-to's.
easylinuxtipsproject.blogspot.com
I am writing a C backup program for my Majaro Linux. It must backup files at a certain time in my home local server only if I am connecting to my home network. So I need to get an SSID and a MAC ad...
stackoverflow.com
리눅스 WiFi 연결 명령어 리눅스 서버 등의 환경에서 명령어를 사용하여 WiFi 연결 방법에 대해 설명드립니다. WPA/WPA2 암호화 프로토콜을 사용하는 와이파이와 비밀번호가 없는 WiFi 연결 방법에 대해서 설명드리도록 하겠습니다.
hiseon.me
https://changun516.tistory.com/120
http://blog.ajhodges.com/2011/10/using-ioctl-to-gather-wifi-information.html
https://webnautes.tistory.com/141
https://wiki.gentoo.org/wiki/Network_management_using_DHCPCD/ko
2. iwconfig
https://markspeople.tistory.com/72
3. dhcpcd
https://blog-jooso.tistory.com/4
https://webterror.net/2012/02/19/866/
https://wiki.archlinux.org/title/wpa_supplicant
https://hybridego.net/entry/iw-wpasupplicant
https://www.ibm.com/docs/ko/aix/7.2?topic=d-dhcpcd-daemon
https://hybridego.net/entry/iw-wpasupplicant
https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=sigsaly&logNo=220409271175
https://m.blog.naver.com/21ahn/221308950395
https://blog.naver.com/damtaja/222974920693
https://hybridego.net/entry/iw-wpasupplicant
3. rssi
https://blog.naver.com/PostView.nhn?isHttpsRedirect=true&blogId=ddol213&logNo=90023933458
'OS > LINUX' 카테고리의 다른 글
segment fault 디버깅 (0) | 2021.10.09 |
---|---|
socket 옵션 (0) | 2021.10.09 |
리눅스 입력한 내용 검색 (0) | 2021.03.16 |
linux hex viewer (0) | 2019.03.22 |
리눅스 TCP 데이터 덤프 (0) | 2019.03.18 |