WRT Router Series Wireless Client Bridge Mode with OpenWRT

wiki.TerraBase.info
Revision as of 21:46, 14 December 2020 by Root (talk | contribs)
Jump to navigation Jump to search

The purpose of this article is to configure an OpenWRT based router to function in a manner similar to a DD-WRT Router with a wireless interface configured in "Client Bridge" mode.

In DD-WRT, this is very simple: Select "Client Bridge" under the wireless settings tab. In OpenWRT it isn't as easy.

Important Note

Per the documentation here, it states (paraphrased): If the wireless adapter is in "Client" mode, it will not function as a bridge to devices plugged into the wired LAN ports. This is because most wireless LAN drivers do not support this functionality (IE, it isn't OpenWRT's fault, but a limitation of the hardware drivers).

Origins of this Article

There are two articles the information here is based on (plus actual experience and experimentation)

A Simpler and more Direct "How to..."

Without going through the complex and non-intuitive UCI commands to achieve the same results, the solution here will be presented in the form of configuration files.

Assumptions

It is assumed the reader has a general knowledge of networking (IP Addresses, Wireless, etc.) and OpenWRT

To save confusion and focus on clarity of this specific subject, it is assumed the router being configured has a fresh installation of OpenWRT (19.07.05 or higher) installed and the following items are configured as described;

  • The default wireless configuration has been deleted
  • The WAN interface of the router has been disabled and is configured to not start at boot time.

Prerequisites

opkg update

opkg install relayd luci-proto-relay

Configuration Files

/etc/config/wireless

config wifi-device 'radio0'
	WhatEverDefaultsArePresent

config wifi-iface 'wifinet0'
	option ssid 'WhatEverSSID'
	option device 'radio0'
	option mode 'sta'
	option key 'WhatEverKey'
	option encryption 'psk-mixed' OR 'WhatEverOtherEncryption'
	option network 'wwan'

/etc/config/network

WhatEverExistingWorkingSettings, "plus the following added or modified items";

config interface 'wwan'
	option ipaddr 'WhatEverIPAddress'
	option netmask 'WhatEverSubnetMask'
	option gateway 'WhatEverGateway'
	option broadcast 'WhatEverBroadcastIP'
	list dns 'WhatEverDNSServer'
	option proto 'static'

config interface 'ClientBridge'
	option proto 'relay'
	list network 'lan'
	list network 'wwan'
	option ipaddr 'SameIPAddressAsWWAN'

config interface 'lan'
	WhatEverExistingWorkingSettings
	option ipaddr 'AnIPAddressOnTheSameSubnetAsWWAN'

/etc/config/firewall

config zone
	option name 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	option network 'lan wwan ClientBridge'

* Anything that starts with "WhatEver" in the above example should include appropriate settings.

Examples

For the above configuration files;

  • /etc/config/network
    • WhatEverIPAddress: 192.168.1.10 (This is the IP Address by which the Client Bridge Router can be accessed for administration and configuration purposes)
    • WhatEverSubnetMask: 255.255.255.0
    • WhatEverGateway: 192.168.1.1 (This is not the IP Address of the Client Bridge Router, but a router connected to the internet.)
    • WhatEverBroadcastIP: 192.168.1.255
    • WhatEverDNSServer: 192.168.1.1 (usually the same as the router connected to the internet)
    • SameIPAddressAsWWAN: 192.168.1.10 (This IP Address is assigned to the "RelayD" service

Other Notes

DHCP can be used instead of assigning static IP Addresses, as in the above example. But it is far easier to assign static IPs.

Double Check Settings

Double check all of the above settings as any errors may make the router inaccessible. This would require resetting the router to default settings and starting over.

Final Question

In the end, there are some questions that don't appear to have any answers;

  • Why is there a "Client" mode for a wireless adapter if it doesn't accomplish anything other than connecting a router as a client to an access point?
  • Wouldn't it be better to have a group of packages (opkg install "Wireless Client Mode Package" relayd luci-proto-relay) included as a single package to enable this functionality?