Skip to content

Instantly share code, notes, and snippets.

@AzimsTech
Last active January 12, 2023 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AzimsTech/b386fe78e0ee3fc146f65bb2f7d07a88 to your computer and use it in GitHub Desktop.
Save AzimsTech/b386fe78e0ee3fc146f65bb2f7d07a88 to your computer and use it in GitHub Desktop.
OpenWrt 21.03 | 802.11s Wireless Mesh Configurations | D-Link DIR-842

OpenWrt 21.03 | 802.11s Wireless Mesh Configurations | D-Link DIR-842

Requirements

  • Minimum 2 OpenWrt devices
  • wpad-basic-wolfssl replaced with wpad-mesh-wolfssl or wpad-mesh-openssl (How to do that)
  • Basics knowledge of UCI Config File (Learn it here)

Root Access Point (RAP)

This is your main router assuming internet connection has been configured to lan interface.

RAP UCI Config File

/etc/config/wireless
config wifi-device 'radio0'
	option type 'mac80211'
	option path 'pci0000:00/0000:00:00.0'
	option channel '36'     # 5Ghz Wi-Fi channel same as Mesh Access Point
	option band '5g'
	option htmode 'VHT80'   # 5Ghz Wi-Fi channel width same as Mesh Access Point
	option disabled '1'
	option country 'MY'     # change to your country code

config wifi-device 'radio1'
	option type 'mac80211'
	option path 'platform/ahb/18100000.wmac'
	option channel '6'      # 2.4Ghz Wi-Fi channel same as Mesh Access Point
	option band '2g'
	option htmode 'HT20'    # 2.4Ghz Wi-Fi channel width same as Mesh Access Point
	option disabled '0'
	option country 'MY'     # change to your country code

config wifi-iface 'wifinet1'
	option device 'radio1'      # or change to 'radio0' for 2.4Ghz Wi-Fi
	option mode 'mesh'
	option encryption 'sae'     # or 'none' if you do not want encryption
	option mesh_id 'Mesh-2.4G'  # Mesh id same as Mesh Access Point
	option mesh_fwding '1'
	option mesh_rssi_threshold '0'
	option key 'password'       # Mesh password same as Mesh Access Point
	option network 'lan'

Things that might need changes are commented.

Mesh Access Point (MAP)

This is your second router, it will be cofigured as Mesh Access Point. It also will configured as Dumb Access Point.

MAP UCI Config File

/etc/config/wireless
config wifi-device 'radio0'
	option type 'mac80211'
	option path 'pci0000:00/0000:00:00.0'
	option channel '36'     # 5Ghz Wi-Fi channel same as Root Access Point
	option band '5g'
	option htmode 'VHT80'   # 5Ghz Wi-Fi channel width same as Root Access Point
	option disabled '1'
	option country 'MY'     # change to your country code

config wifi-device 'radio1'
	option type 'mac80211'
	option path 'platform/ahb/18100000.wmac'
	option channel '6'      # 2.4Ghz Wi-Fi channel same as Root Access Point
	option band '2g'
	option htmode 'HT20'    # 2.4Ghz Wi-Fi channel width same as Root Access Point
	option disabled '0'
	option country 'MY'     # change to your country code

config wifi-iface 'wifinet1'
	option device 'radio1'      # or change to 'radio0' for 2.4Ghz Wi-Fi
	option mode 'mesh'
	option encryption 'sae'     # or 'none' if you do not want encryption
	option mesh_id 'Mesh-2.4G'  # Mesh id same as Root Access Point
	option mesh_fwding '1'
	option mesh_rssi_threshold '0'
	option key 'password'       # Mesh password same as Root Access Point
	option network 'lan'

Things that might need changes are commented.

/etc/config/network
config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'XXXX:XXXX:XXXX::/XX' # Random ULA-Prefix by your router

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0.1'
	list ports 'eth0.2' # Bridges WAN & LAN port together

config device
	option name 'eth0.1'
	option macaddr 'XX:XX:XX:XX:XX:XX' # LAN ports mac address of your router

config interface 'lan'
	option device 'br-lan'
	option proto 'dhcp' # or use static IP address in same subnet as Root Access Point

config device
	option name 'eth0.2'
	option macaddr 'XX:XX:XX:XX:XX:XX' # WAN port mac address of your router

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '1 2 3 4 0t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '5 0t'

Things that might need changes are commented.

Disable DHCP, DHCPv6 & Firewall Server

/etc/rc.local
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

# these services do not run on mesh APs
for i in firewall dnsmasq odhcpd; do
  if /etc/init.d/"$i" enabled; then
	/etc/init.d/"$i" disable
	/etc/init.d/"$i" stop
  fi
done
exit 0

Example full network configuration

sdfdsf

@AzimsTech
Copy link
Author

diagram0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment