Skip to content

Instantly share code, notes, and snippets.

@hkwi
Last active December 17, 2015 10:49
Show Gist options
  • Save hkwi/5597298 to your computer and use it in GitHub Desktop.
Save hkwi/5597298 to your computer and use it in GitHub Desktop.

Linux wireless で遊ぶ

Fedora 18 に USB wireless module をさしてみる。あっさり認識した。

$ tail -f /var/log/messages
...
... Product: 802.11 n WLAN
... Manufaturer: Ralink
...
... new 802.11 WiFi device (driver: 'rt2800usb' ifindex: 9)
...

無線の物理インターフェースの状態、netdev の裏の状態を見る。

$ iw list
$ iw phy
$ iw dev

netdev wlan0 の状態を見てみる。

$ ifconfig wlan0

AP を立ててみる。

$ yum install hostapd
$ vi /etc/hostapd/hostapd.conf
...
interface=wlan0
hw_mode=g
channel=1
ssid=testssid
...
$ hostapd -d /etc/hostapd/hostapd.conf

ちなみに -dd にすると、プローブもログに出てきて大変。

$ hostapd -dd /etc/hostapd/hostapd.conf

何かを無線参加させてから、つながってることを確認する。

$ iw dev wlan0 station dump
Station XX:XX:XX:XX:XX:XX (on wlan0)
...

さっき繋がったやつを、強制切断する。

$ iw dev wlan0 station del XX:XX:XX:XX:XX:XX

hostapd_cli での切断方法。

$ hostapd_cli disassociate XX:XX:XX:XX:XX:XX

iw

plink_action は mesh のときに使うもののようだ。

$ ip dev wlan0 station set XX:XX:XX:XX:XX:XX plink_action block

状態は次のようにして確認できるらしい。

$ ip dev wlan0 station get XX:XX:XX:XX:XX:XX
...
mesh plink: LISTEN
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment