Setting up OpenWrt as a wifi client and access point

Hi everyone,

I'm setting up OpenWrt for the first time and using a TP-Link Archer A7 for that.

What I'm trying to do with the Archer is to connect it wirelessly to another router which has internet to boost the wifi signal and create a wired connection in that spot. It should also have it's own IP-range to not really interfere with the downstairs wifi.

What I have done already is to connect to the downstairs wifi with one wireless interface in Mode: Client and set it to be on the network lan and wwan.
I've then created a new password protected wifi access point and also under the Network lan and wwan. Another thing that I've changed from the default setting was the router IP to 192.168.2.1.

But on both lan and wifi, I'm only able to connect to the OpenWrt admin page but not the internet.

I later found this in the documentation https://openwrt.org/docs/guide-user/network/wifi/connect_client_wifi but I think it could be slightly dated because the UI is a little bit different and changing the firewall settings like on the page didn't change anything.

Does anyone know how to connect these networks together?

A Routed Client (Masquerade) is what you want.

In the default configuration, OpenWrt routes and masquerades LAN users to a wired WAN connection such as a cable modem. To make the WAN link wireless, it is only necessary to detach the Ethernet port from the existing WAN network and attach a wifi client instead.

This page seems relevant: https://openwrt.org/docs/guide-user/network/routedclient Follow the three steps in the first section under Masquerade. This is the most appropriate configuration when you don't want to interact with the other network other than use it for Internet access. The other network will be on the WAN or untrusted side of the firewall. The default firewall will work for this.

I recommend manually configuring the wifi client rather than using the scan and join button. That wizard creates a new network 'wwan' which is not necessary. The existing wan can be used.

4 Likes

Thanks for the answer, but the documentation only shows it how it's been done in shell commands and I did manage to brick some linux boxes over ssh but that was a long while ago.

I'm trying to do this on luci by placing the wifi client on wan and wan6 and the access point on just lan. But now the wifi client is marked as disabled with the text "Wireless is not associated".

Is it possible to configure this via luci or does it have to be via shell? I could try it out later

I did ssh into the router, but both configs appear already very similar to the example in the docs.
The difference that I see there is that the option entries are in a different order.

In the wireless config there is radio0 and radio1 instead of wlan0.

Could I past both configs in here?

I've seen other posts having the logs on here, so I think it's fine to do so. Edits were only made over luci rn

root@OpenWrt:/etc/config# cat network 

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd59:5f53:533b::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0.1'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ipaddr '192.168.10.1'

config interface 'wan'
        option proto 'dhcp'
        option type 'bridge'

config device 'wan_eth0_2_dev'
        option name 'eth0.2'
        option macaddr 'cc:32:e5:7c:2c:ea'

config interface 'wan6'
        option ifname 'eth0.2'
        option proto 'dhcpv6'
        option type 'bridge'

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

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

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

config interface 'wwan'
        option proto 'dhcp'


root@OpenWrt:/etc/config# cat wireless 

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '36'
        option hwmode '11a'
        option path 'pci0000:00/0000:00:00.0'
        option htmode 'VHT80'

config wifi-device 'radio1'
        option type 'mac80211'
        option channel '11'
        option hwmode '11g'
        option path 'platform/ahb/18100000.wmac'
        option htmode 'HT20'

config wifi-iface 'wifinet2'
        option ssid 'downstairs_wifi'
        option device 'radio1'
        option mode 'sta'
        option key 'password_redacted'
        option encryption 'psk2'
        option network 'wan wan6'

config wifi-iface 'wifinet3'
        option device 'radio0'
        option mode 'ap'
        option key 'password_redacted'
        option encryption 'psk2'
        option ssid 'upstairs_wifi'
        option network 'lan'

Yes this can all be done in LuCI. I'm a CLI user so not an authority on how to do it but I did write up a post a few weeks ago. Also note that LuCI will totally let you brick your router, its philosophy is to give the user a high level of control and there aren't a lot of safety checks.

Your configuration looks good except that the wan network in /etc/config/network must not be a bridge. This corresponds to the "Bridge" checkbox in LuCI under network--interfaces--wan--physical settings. The STA end of an ordinary AP-STA link cannot be in a bridge, that is a fatal error and the interface does not come up. Reading the system log will show that.

Most home networks are IPv4 only-- if the one downstairs does not support IPv6 you don't need wan6.

2 Likes

I've disabled bridge mode on both wan and wan6 (I do get a ipv6-address from the main router) and I can access internet from both lan and wifi now. Thank you very much ^^

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.