Hello everybody, i'm trying to find out how to block all internet traffic which is not goingthrough the openvpn client on vpn connection faillure. Using RT AC68U and 3.0.0.4.374.41_0 merlin firmware
I've tried doing this the way I used to with dd-wrt following https://airvpn.org/index.php?option=com_kunena&func=view&catid=3&id=4287&Itemid=142#4287 so I create a firewall-start file in the jffs/scripts directory with some iptables rules, but unfortunately it has no effect : when the vpn connection drops traffic goes through the regular internet connection (wan). here is the script I use:
#!/bin/sh
touch /tmp/000firewallstarted
iptables -I FORWARD -i br0 -o tap0 -j ACCEPT
iptables -I FORWARD -i tap0 -o br0 -j ACCEPT
iptables -I FORWARD -i br0 -o vlan1 -j DROP
iptables -I INPUT -i tap0 -j REJECT
iptables -t nat -A POSTROUTING -o tap0 -j MASQUERADE
I suspect it could be related with the interface I used which might be not correct :
br0 is supposed to be the bridge with the lan
vlan1 is supposed to be the wan connected to the ISP
tap0 is supposed to be the VPN interface
I use the openvpn client1 with tap interface so I tried the same script replacing tap0 with tap11 but it does not work either.
Any idea?
Thank you in advance
I've tried doing this the way I used to with dd-wrt following https://airvpn.org/index.php?option=com_kunena&func=view&catid=3&id=4287&Itemid=142#4287 so I create a firewall-start file in the jffs/scripts directory with some iptables rules, but unfortunately it has no effect : when the vpn connection drops traffic goes through the regular internet connection (wan). here is the script I use:
#!/bin/sh
touch /tmp/000firewallstarted
iptables -I FORWARD -i br0 -o tap0 -j ACCEPT
iptables -I FORWARD -i tap0 -o br0 -j ACCEPT
iptables -I FORWARD -i br0 -o vlan1 -j DROP
iptables -I INPUT -i tap0 -j REJECT
iptables -t nat -A POSTROUTING -o tap0 -j MASQUERADE
I suspect it could be related with the interface I used which might be not correct :
br0 is supposed to be the bridge with the lan
vlan1 is supposed to be the wan connected to the ISP
tap0 is supposed to be the VPN interface
I use the openvpn client1 with tap interface so I tried the same script replacing tap0 with tap11 but it does not work either.
Any idea?
Thank you in advance
Last edited: