Prevent Certain LAN ips from accessing WAN when OpenVPN goes down
-
OK - I want to be sure about this, so I'll list a list of conditions. Tell me which are true or false for you.
Your distant VPN server uses a fixed IP?
If your VPN drops you want everything connected to pfsense to not be able to access internet?
-
OK - I want to be sure about this, so I'll list a list of conditions. Tell me which are true or false for you.
Your distant VPN server uses a fixed IP?
NO It's dynamic. Using OpenVPN Client in pfsenseIf your VPN drops you want everything connected to pfsense to not be able to access internet?
No only machines forwarded to VPN Gateway -
In that case, not sure… I'll be reading along and thinking about it a while.
-
You posted a screen shot above. I cant see the whole page. Can you repost the screen shot to include the interface tabs etc?
-
Here you go
![Screen Shot 2013-08-09 at 7.12.12 PM.png](/public/imported_attachments/1/Screen Shot 2013-08-09 at 7.12.12 PM.png)
![Screen Shot 2013-08-09 at 7.12.12 PM.png_thumb](/public/imported_attachments/1/Screen Shot 2013-08-09 at 7.12.12 PM.png_thumb) -
This can easily be done using iptables I just don't know how to do it here.
Idea is mark packets to go to either one routing table or another. then if packet still arrives to unwanted interface drop it. I have my iptables rules in earlier posts.
-
The rules, as they are now, pass everything. For sure. First you pass 192.168.1.5, and then you pass everything that isn't 192.168.1.5.
So, that everything.For the first one, shouldn’t you specify a destination gateway?
-
Yeah sorry I was doing some other tests to see here are the rules as they are now. OpenVPN gateway is down and I can still ping outside from 192.168.1.5
![Screen Shot 2013-08-09 at 7.20.11 PM.png](/public/imported_attachments/1/Screen Shot 2013-08-09 at 7.20.11 PM.png)
![Screen Shot 2013-08-09 at 7.20.11 PM.png_thumb](/public/imported_attachments/1/Screen Shot 2013-08-09 at 7.20.11 PM.png_thumb) -
So, if you put in a rule immediately after the pass 192.168.1.5 to olive rule and you made it a block 192.168.1.5 to anywhere rule, I wonder what that would do?
Second what is the subnet the VPN is using? I have 1 last question after this…
-
Like so ?
Still lets traffic go though ISP.![Screen Shot 2013-08-09 at 7.40.15 PM.png](/public/imported_attachments/1/Screen Shot 2013-08-09 at 7.40.15 PM.png)
![Screen Shot 2013-08-09 at 7.40.15 PM.png_thumb](/public/imported_attachments/1/Screen Shot 2013-08-09 at 7.40.15 PM.png_thumb) -
If none of this works, I'm thinking this.
Traffic should go from 192.168.1.5 > some VPN subnet > WAN > VPN
(my understanding could be bad)
But, if you put a rule on the WAN to block any traffic that is source 192.168.1.5 and destination * that should block 192.168.1.5 when its not using VPN for sure. Not sure if it will also block it when inside VPN also. Never tried it. Its easy to do, try and undo if needed. Maybe try it.
If blocking 192.168.1.5 at the wan doesn't work or if it completely breaks 192.168.1.5 then I'm fresh out of unique and amazing ideas.
-
Like so?
You would think this would work ;) So did I, I think this was the first think i tried.anyway tried it again same thing.
![Screen Shot 2013-08-09 at 7.49.51 PM.png](/public/imported_attachments/1/Screen Shot 2013-08-09 at 7.49.51 PM.png)
![Screen Shot 2013-08-09 at 7.49.51 PM.png_thumb](/public/imported_attachments/1/Screen Shot 2013-08-09 at 7.49.51 PM.png_thumb) -
Just an idle question? Do you have a floating rule that says pass anything to anything because this is getting strange?
And are you sure the computer in question's IP is actually 192.168.1.5? -
hehe..
no but I have block source 192.168.1.5 to anywhere. Doesnt work either. -
So, its going to the VPN as a gateway and then that gateway is sending to the openweb when the vpn fails.
Maybe make a rule on the WAN that blocks anything from source interface BOLEVPN that isn't on that one port that openvpn needs.
This isn't multi-public-IP system right? Just 1 WAN?
-
I really hoped that would work but no :(
It seems the rules are being bypassed and traffic just jumps to VPN gateway. -
Did you apply some rules to the firewall outside the gui using command line?
-
No I don't. I haven't gotten that desperate yet :D I am hoping someone who made pfSense would be able to shed some light on this.
-
What does this mean: (from the docs)
Policy Route Negation
When a firewall rule directs traffic into the gateway, it bypasses the firewall's normal routing table. Policy route negation is just a rule that passes traffic to other local or VPN-connected networks that does not have a gateway set. By not setting a gateway on that rule it will bypass the gateway group and use the firewall's routing table. These rules should be at the top of the ruleset – or at least above any rules using gateways. -
It just means that when you send LAN traffic to VPN as gateway it does an end run around the rest of pfsense rules and that if no gateway is stipulated it will use a default gateway. Also says these rules belong at the top, which is where you have them.
Doesn't explain to me how to get a down VPN to cease and desist passing traffic.
BLOCK TRAFFIC WHEN VPN IS DOWN would be a great option to add to client VPN settings…