My purpose is to mainly use the device for Netflix/p2p/surfing over NordVPN, except for port ether4 that should always work, even when VPN is down.
Everything works, however I would like to avoid “bridge-p2p” from connecting to the internet when VPN is down, while “bridge” should continue surfing without limitations.
Since all outgoing traffic pass through ether1, I’m experiencing some difficulties to set up filter rules correctly.
I’m not sure it could also be a matter of routes
Could you help me please?
I put this rule just before the "defconf: accept out ipsec policy" rule, unfortunately, everything coming from bridge-p2p (my mobile browser) towards ether1 is rejected in both cases (VPN UP or VPN DOWN). What I'm missing?
I’m also interested in a rule that blocks non-ipsec traffic once the IKEv2 tunnel drops.
Using an exclude connection mark like the way we do fasttrack except ipsec seems to not work at all under firewall - filter rules, all traffic is blocked lol:
I previously used L2TP/IPSec and that came very handy because I actually had a routing table and if the interface goes down I could use a blackhole route, but pure ipsec man, it’s a level higher on the difficulty level.
The key is to only drop ‘established,related’ combined with “!ipsec” connection-mark, because the firewall filter works before ipsec encapsulation.
I think SYN packets will leak once the VPN goes down though, but once they try establishing the filter will kick in.
Because I mark both ipsec and non-ipsec using mangle in the forward chain, the non-ipsec traffic gets dropped once the tunnel is down because the output chain is secondary to the forward chain.
Thank you icsterm, I will give a try…
However, as long as I remember correctly, one problem I experienced was even using mangle to mark connections, I was not able to “intercept” and mark IPSec connections towards NordVPN
EDIT:
To make things simplier I started over, reset the router, configured the ipsec vpn only and added these rules as you suggested, but it still does not work.
192.168.88.254 is my winbox client, I need to permit connections towards it, otherwise I will not be able to manage the device anymore.
I solved it: they must create a static route with distance 1 as the gateway the VPN link and with distance 2 the Wan one, and only a Nat rule, exit through the VPN tuner, if the tunnel fails the internet is deactivated
what I did for my kill switch on the client was to activate the nat only to the range of addresses of the tuner, only to mask everything that comes out through the VPN and a static route, 0.0.0.0 gateway L2TP Distance 1, when the VPN fails it stays without internet the router