能否通过OpenWRT配置实现接入点仅允许单个客户端连接?
Absolutely, you can set up your OpenWRT-based access point to only allow one client connection at a time using just built-in configurations—no external tools or extra packages required. Here's the straightforward way to do it:
Method 1: Use hostapd's Built-in Connection Limit
Hostapd (the daemon that manages wireless access points in OpenWRT) has a native setting to cap the number of connected clients. This is the most efficient approach since it blocks excess connection attempts directly at the AP level:
- Log into your OpenWRT device via SSH (
ssh root@[your-openwrt-ip]) or the LuCI web interface. - If using SSH, open the wireless configuration file with your preferred editor:
vi /etc/config/wireless - Locate the
config wifi-ifacesection corresponding to your target wireless network (look for lines likeoption ssid 'YourWiFiName'to identify it). - Add this line inside that section to enforce a single-client limit:
option max_num_stations '1' - Save the file (in vi, press
Escthen type:wqto save and exit). - Restart the wireless service to apply the changes:
wifi reload
Once this is active, when one client is already connected, any subsequent devices trying to join will receive a rejection from the AP immediately—they won’t get an IP address or establish a connection at all.
Notes
- This setting applies per wireless interface. If you have multiple SSIDs (e.g., 2.4GHz and 5GHz), you’ll need to add the line to each
wifi-ifacesection you want to limit. - No additional software is needed—this uses OpenWRT’s default hostapd setup, so it’s fully self-contained within the system.
内容的提问来源于stack exchange,提问作者Kerberos

