OpenWrt Forum Archive

Topic: Basic routing question

The content of this topic has been archived on 9 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am trying to understand how routing works, and have read through a lot of posts and tried to understand the iptables command, but to little avail.  I am thinking I need to install some kind of NAT (iptables-mod-nat?) to get my proposed configuration to work. 

I have my WLAN configured to use the ip range 10.10.0.x and my LAN to use the ip range 20.20.0.x.  When I connect to the AP and use an IP of 10.10.0.101, I want to ping 20.20.0.1 (a client on the LAN).

This seems like it should be a routing or Network Address Translation kind of thing.  I want to keep the separate ip ranges, so as far as I understand it, bridging isn't an option. 

Any guidance would be greatly appreciated.

You would most likely need to update your firewall settings to allow the WLAN to talk to LAN:

iptables -A FORWARD -i $WLAN -o $LAN -j ACCEPT

and to allow for LAN to talk to WLAN:
iptables -A FORWARD -i $LAN -o $WLAN -j ACCEPT

Make sure the variable $WLAN is set, you can probably use a modified version of this command:
config_get WLAN wlan ifname

Also, the iptable rule above will allow any connection to be made between WLAN and LAN, you can add specific ports or ip ranges to those lines to limit the type of connections that can be made.

Hope that helps.

The discussion might have continued from here.