Soft WPS with OpenWRT
When I use WPS, I find it easy to set up but not safe enough! If someone is able to touch the router, he/she may connect to the network without permission.
So why not disable the WPS button? I did some research to find a way to initiate WPS with command. It means If I agree someone or some device to connect to my network, I should just do some types on my computer…
I happen to have an old ZTE H618B which already installed Tomato DualWAN, and I happen to find a openwrt firmware for this device. So, my experiment bengins…
Device: ZTE H618B
Install WPAD package
As the default package wpad-mini is not enough to make WPS function well, it is necessary to remove it and install wpad which was called wpad-full.
opkg remove wpad-mini opkg update opkg install wpad
The offical document suggest to install hostapd-utils, but I find it is already the latest version in my firmware, so I skip it.
Set up WPS function
After the package installed, it is time to configure the wireless configuration file located at /etc/config/wireless:
config wifi-device 'radio0' option type 'mac80211' option channel '11' option macaddr '00:90:4c:c1:04:51' option hwmode '11g' option txpower '20' option country '00' config wifi-iface option device 'radio0' option network 'lan' option mode 'ap' option ssid 'OpenWrt' option encryption 'psk2+ccmp' option key 'password' option 'wps_pushbutton' '1'
option 'wps_pushbutton' '1' under config wifi-iface section, then type
wifi to apply wireless configuration changes.
If you have only one radio device, the initial command should be like this: (which is my case)
hostapd_cli -p /var/run/hostapd-phy0 wps_pbc
If your device has more than one radio device, you should write some codes as below:
for dir in /var/run/hostapd-*; do [ -d "$dir" ] || continue hostapd_cli -p "$dir" wps_pbc done
wps_pbc indicates you pushed the WPS button, it is short for “push-button configuration”
-p points to the path includes wlan0 device.
It works for me finally! My device connected to my router when I runs the command:
hostapd_cli -p /var/run/hostapd-phy0 wps_pbc Selected interface 'wlan0' OK
本文出自 Lesca 技术宅，转载时请注明出处及相应链接。