# WPS on GL.iNet's OpenWRT

## Installation

Login to web UI, go to *APPLICATION* > *Plug-ins*. First, click on **Update** button to update the metadata for packages. Then, search and install **hostapd-utils**.

![img1](/files/-LntGy2TehS-KJR3LyRX)

## WPS for AP

### Enable WPS

After installed the package, you should go to *MORE SETTINGS* > *Advanced* > *Network* -> *Wireless* to enable the WPS function.

![img2](/files/-LntGy2VTVuYXviT1vfA)

![img3](/files/-LntGy2XDO2g5gNUbKL7)

Selecting the wireless interface which you want to enable WPS. Changing to **Wireless Security** tab, and ticked **Enable WPS pushbutton**, and change the encryption to **WPA2-PSK**.

Please note that the encryption must be WPA2-PSK, otherwise it will not work. Finally, click on "Save & Apply".

![img4](/files/-LntGy2Z6PHot2GTF5mA)

![img5](/files/-LntGy2aBD10FVptTLFA)

### Change reset Button to WPS

Using WinSCP drag and drop the reset file to /etc/rc.button folder. If you don’t know how to use WinSCP, please refer to our instruction. <https://docs.gl-inet.com/en/3/app/ssh/#winscp>

Now, you can press the reset button to active WPS function.

The full reset file as below. You can new a file, and copy & paste the content into it.

```
#!/bin/sh

if [ "$ACTION" = "pressed" -a "$BUTTON" = "reset" ]; then
    cd /var/run/hostapd
    for socket in *; do
        [ -S "$socket" ] || continue
        hostapd_cli -i "$socket" wps_pbc
    done
fi

return 0
```

## WPS for Station

For the sake of convenience, you should connect to an exist AP at first, because of station mode depends on some configuration files, such as firewall, network and dhcp. If you hadn't been connected a AP, you have to configure them manually.

When the AP activated WPS, you can type this command on mini-router to connect it.

```
wpa_cli -i wlan-sta wps_pbc
```

Please note that you might need to stop the **gl\_health** process via `killall gl_health && mv /usr/bin/gl_health /usr/bin/gl_health1`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kysonlok.gitbook.io/blog/wireless/wps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
