Configuring outdoor CPE to AP links
CLI reference:/interface/wifi/interface/wifi/radio/interface/bridge/interface/list/member/ip/dhcp-client/ip/dhcp-server
Package: wifi-qcom
An indoor access point has omnidirectional antennas with a low gain: they send the signal around the access point in a "donut" shape. In open space with no interference, this reaches up to about 100 meters, and much less inside buildings.
An antenna with a higher gain sends the signal in a narrow angle towards one destination. Outdoor access points and CPEs (customer premises equipment) with such antennas make Wi-Fi links over several kilometers, as long as the other device is inside that angle.
A link needs one device in AP mode and one in station mode. One AP can serve several stations.
This guide is for Wi-Fi 6 (802.11ax) devices with the wifi-qcom package.
Choose the frequency
Local regulations limit the transmit power, and the limits depend on the country and the frequency range. reg-info shows the limits of a country profile:
/interface/wifi/radio/reg-info country=Latvia 0
ranges: 2402-2482/20dBm/40MHz
5170-5250/23dBm/160MHz/indoor
5250-5330/23dBm/160MHz/indoor/dfs
5490-5730/30dBm/160MHz/dfs
5735-5875/14dBm/80MHz
With the Latvia country profile, 5490-5730 allows the most power, 30 dBm. 5735-5875 allows only 14 dBm, so avoid it for a long link.
The values are EIRP: the transmit power plus the antenna gain. The higher the antenna gain, the lower RouterOS sets the transmit power, so the EIRP stays within the limit. For built-in antennas, this happens automatically. More allowed EIRP means a stronger signal and a longer link.
The ranges with the most power can be DFS channels (dfs): the AP checks for radar before it uses them, and stops broadcasting on the channel when it detects radar.
The country profile Superchannel has no software limit on the transmit power. Use it only in controlled environments, or with special permission for your region. You can combine it with a lower configuration.tx-power to set a power of your own.
A narrower channel gives less interference and a longer distance. For long links, use a 20 MHz channel.
Set up the AP
/interface/wifi
set [ find default-name=wifi1 ] channel.frequency=5660 \
channel.width=20mhz configuration.country=Latvia .mode=ap \
.ssid=Farm-Link security.authentication-types=wpa2-psk,wpa3-psk \
.passphrase="long passphrase for the link" disabled=no
channel.frequency- the channel of the link. Leave it out to let the AP select the channel.channel.width=20mhz- the channel width.configuration.country- the country you are in. It selects the allowed channels and transmit power..mode=ap- the interface is an access point..ssid- the network name of the link.security.authentication-typesand.passphrase- the security of the link.
A dot at the start of a parameter repeats the prefix of the previous one: .mode is configuration.mode, .passphrase is security.passphrase.
Set the distance
If the link is longer than 2 km, set configuration.distance on the AP and on the station. This setting does not work with the wifi-qcom-ac package.
/interface/wifi
set [ find default-name=wifi1 ] configuration.distance=3
configuration.distance is the distance in kilometers to the farthest device of the link, and it accepts decimal values such as 2.5. When it is not set, the interface works with links up to 2 km. A change of the distance restarts the AP, and on a DFS channel the AP checks the channel for radar again before its clients can connect.
Connect the AP to the network
When the network already has a router with a DHCP server, connect the AP behind it:

- Add the Ethernet and Wi-Fi interfaces of the AP to a bridge.
- Add a DHCP client on the bridge, or a static IP address and a default route.
- Change the interface list members if needed.
When the AP itself is the router and the DHCP server for the stations:

- Use an Ethernet port as the uplink: add a DHCP client, or a static IP address and a default route, and add the port to the
WANinterface list. - Add an IP address and a DHCP server on the Wi-Fi interface, or on the bridge that the Wi-Fi interface belongs to.
Set up the station
On the CPE:
/interface/wifi
set [ find default-name=wifi1 ] channel.frequency=5660 \
configuration.country=Latvia .mode=station .ssid=Farm-Link \
security.authentication-types=wpa2-psk,wpa3-psk \
.passphrase="long passphrase for the link" disabled=no
The station uses the SSID, security and passphrase of the AP, and channel.frequency is the AP's channel. You can leave channel.frequency out: the station then finds the AP on its own. If the link is longer than 2 km, set the distance on the station too. To bridge the CPE's clients into the AP's network, use .mode=station-bridge instead, see Bridge the CPE's clients.
Route the CPE's clients
The CPE's Wi-Fi interface is the internet port, and the devices behind the CPE are hidden behind NAT. This is the default configuration of most CPEs.

The CPE needs:
-
mode=stationon the Wi-Fi interface. -
The Wi-Fi interface outside the bridge, in the
WANinterface list, and a DHCP client on it (or a static IP address and a default route):/interface/list/memberadd interface=wifi1 list=WAN/ip/dhcp-clientadd interface=wifi1 -
A DHCP server on the Ethernet interfaces. Use another subnet than the AP's DHCP server: the same subnet on both sides of the CPE can cause routing problems.
Bridge the CPE's clients
The CPE bridges its ports, so the CPE and its clients get their addresses from the AP's network.

The CPE needs:
-
All Ethernet and Wi-Fi interfaces in one bridge, and the bridge in the
LANinterface list. -
No DHCP server.
-
A DHCP client or a static IP address on the bridge.
-
station-bridgemode on the Wi-Fi interface:/interface/wifiset [ find default-name=wifi1 ] configuration.mode=station-
station-bridge works between MikroTik devices that use the /interface/wifi menu. For the station modes of the legacy wireless package, see Wireless station modes.
Check the link
When the station is connected, the registration table of the AP shows the station:
/interface/wifi/registration-table/print
Flags: A - AUTHORIZED
Columns: INTERFACE, SSID, MAC-ADDRESS, UPTIME, LAST-ACTIVITY, SIGNAL,
AUTH-TYPE, BAND
# INTER SSID MAC-ADDRESS UPT LAS SIG AUTH-TYPE BAND
0 A wifi1 Farm-Link 02:00:00:00:02:00 24s 0ms -25 wpa3-psk 5ghz-ax
The registration table of the station shows the AP:
/interface/wifi/registration-table/print
Flags: A - AUTHORIZED
Columns: INTERFACE, SSID, MAC-ADDRESS, UPTIME, LAST-ACTIVITY, SIGNAL,
AUTH-TYPE, BAND
# INTER SSID MAC-ADDRESS UPT LAS SIG AUTH-TYPE BAND
0 A wifi1 Farm-Link 02:00:00:00:01:00 24s 0ms -24 wpa3-psk 5ghz-ax
On the CPE, scan shows the access points the station sees, with their channel and security. A scan stops the station's connection while it runs. frequency limits the scan to the channel of the link:
/interface/wifi/scan wifi1 duration=10s frequency=5660
Flags: A - ACTIVE
Columns: ADDRESS, SSID, CHANNEL, SECURITY, SIGNAL, STA-COUNT
ADDRESS SSID CHANNEL SECURITY SIGNAL STA-COUNT
A 02:00:00:00:01:00 Farm-Link 5660/ax wpa2-psk -24 0
wpa3-psk
See the /interface/wifi CLI reference for all parameters.