Need to connect to wifi as a client with a separate subnet

For a little more clarity here is an image explaining what I am aiming to do.

The issue is that on the other side of the Wireless "WAN" is a modem/router I have no control over. My intended goal is as follows:

  1. Use my RPi to connect to the Wifi of the Router I can't control. - Done
  2. Have a DHCP server on the RPi that can also manage VLAN tagging and still route outbound to the internet. <----- The part where I'm stuck.
  3. Use the Cisco switch to do the VLAN tagging by port and send it via the trunked port to the RPi for management.
  4. Use other AP's to create the SSID's for the various VLAN'd items.
  5. Profit.

What I have been successful so far at doing is connecting to the Wifi as a client and I was able to route the eth0 (LAN) connection using relayd. However, that doesn't allow me to setup a DHCP server and VLAN's and still maintain an active internet connection.

The official guide doesn't clarify anything and my GoogleFu is coming up short.

Any advice?

EDIT Wrote up a little tutorial below on what I ultimately did to get my setup working.

https://openwrt.org/docs/guide-user/network/wifi/connect_client_wifi

relayd is the opposite of what you intended.

3 Likes

Thanks!

I think my GoogleFu was sending me down the wrong road.

So from here I should be able to setup the VLAN Tagging as intended by following the standard guide correct?

Yes, I think so

Yes, create vlan subinterfaces on eth0 for each vlan you have and they will be trunked to the c2960.
Assign the WWAN interface to the WAN zone in firewall, so that it masqurades the outgoing traffic.
Assign the subinterfaces you want to have access to the LAN zone in firewall.
For the rest of the subinterfaces create some new zone and allow accordingly.

2 Likes

Update:

Following the link and the advice given by @trendy, I was able to get it working with ease.

I also disabled the default LAN connection by removing it from the LAN firewall connection, but only after I had made the VLAN interfaces and software VLAN connections in the LuCi configuration.

Here's the steps (Assuming you have a default config and/or understand you may need to reset...)

There are two parts to this. First go and config it to be attached to the WiFi you need to connect to. Easiest way is to go to Network --> Wireless and next to the description of the WiFi adapter click Scan. Select the WiFi in question and enter in the necessary info. It will offer to create a WWAN interface, accept the defaults there and continue to the next set of steps.

  1. Go to Network --> Interfaces
  2. Click Add New Interface.
  3. Under Protocol of the new interface make sure Static Address is selected.
  4. Name it appropriately, and remember it cannot be renamed once named. (Not that I could see anyways)
  5. Under Cover the following interface click and make a custom interface named (in my case) eth0.110 (so adapter.vlanid# for the ethernet port in this case)
  6. Once you hit submit, it will take you to the configuration page for the interface, configure it for the subnet appropriately. Make sure the Gateway IP is set to whatever IP you are routing your traffic to, so in my case 192.168.1.1 for the router/modem in my setup.
  7. Hit Save, but do NOT apply it yet.

** Repeat each step above for each VLAN you wish to create **

  1. Go to Network --> Firewall next. Click Edit on the WAN interface and under Allow Forward to Destination Zones and Allow Forward from Source Zones select your interfaces you would like to route outwardly.

  2. Once all of that is saved but NOT applied, you can now apply it. At this point, if you removed the LAN from the LAN interface and have only the eth0.vlan# interface attached to it like I have, you will need to connect via your switch OR somehow get VLAN tagging working before you will be able to access it again.

  3. Have a cold drink and bask in your awesomeness.

Credit where credit is due, this blog post aided in solving some of the problem as well:
http://blog.sergem.net/jailing-iot-devices-with-openwrt/

1 Like

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