Team,
I have a small GL-MT1300 router running openwrt. I am planning on using this device as an alternative to the raspberry pi for a guest wifi hotspot self service wifi access project.
I have configured an IPSEC tunnel using strongwan on the GL-MT1300 router running openwrt. The IPSEC tunnel comes up but I can't get specific source traffic to route through the tunnel.
The tunnel to the remote VPN device comes up but my guest wifi subnet doesn't get routed through the IPSEC tunnel, it gets routed out to the wan port.
I had the same issue years ago when I first configured IPSEC tunnels on the raspberry pi, and I was able to fix it by adding the following commands on the ipv4 tables to force guest wifi user traffic through the IPSEC tunnel by adding an explicit exemption rule before the MASQUERADE rule. See yellow highlighted line below.
# Generated by xtables-save v1.8.2 on Sat Jun 5 10:06:20 2021
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -m policy --dir out --pol ipsec -j ACCEPT
-A POSTROUTING -j MASQUERADE
COMMIT
This way I can control what IP's get forced to the IPSEC tunnel using the /etc/ipsec.conf file. In the below example, on the range 10.3.141.128/25
gets routed to the vpn tunnel.
left=%any
leftsubnet=10.3.141.128/25
aggressive=yes
authby=secret
leftid=xxxx@yyyyyyyy
leftfirewall=no
right=x.x.x.x
rightsubnet=0.0.0.0/0
lifetime=60m
auto=add
In the above configuration, when the guests connect to the wifi SSID, they get an IP address in the range of 10.3.141.128/25, which I want to route to the IPSEC vpn tunnel. I only want this source IP /25 range to be routed via the IPSEC tunnel.
In the openwrt router, I don't see a file that is similar to the iptables file in the raspberry.
There is an /etc/config/firewall file but I am not sure how to configure it so it will force only the guest wifi IP range to the IPSEC tunnel.
I am wondering if any of you configured IPSEC tunnels using openwrt or have any ideas how to force wifi client IP's through the IPSEC tunnel, which does gets established when I bring it up.
Any suggestions?