1
16.1 Legacy Series / Re: NAT Outbound And VPN
« on: June 24, 2016, 05:23:22 pm »
Hi framura,
routing table decides, which interface will be used outbound.
Afterwards, NAT rules for that single interface are used.
So it is dependent on the destination and the routingtable.
If you try to access 1.1.1.1 and you have a route, which sends that traffic through openvpn, then NAT rules on openvpn interface are followed.
If you try to acces 99.99.99.99 and you have a route, which sends that through your WAN interface, then that NAT rules are used.
To influence, which interface is used outbound, you can use policy based routing.
This is done on OPNsense, by changing the gateway inside a firewall rule.
So lets assume, you use the default LAN out rule and nothing else, then you could:
Afterwards traffic coming from 192.168.2.12 to specified destinations will go out through WAN interface and not openvpn.
You do not need to add additional outbound NAT rules, cause what you defined is already included in
nat on $WAN from $tonatsubnets to any -> 192.168.1.7/32 port 1024:65535
(192.168.2.12/32 is part of 192.168.2.0/24)
So you can remove your additional outbound NAT rule.
Regards,
Joerg
routing table decides, which interface will be used outbound.
Afterwards, NAT rules for that single interface are used.
So it is dependent on the destination and the routingtable.
If you try to access 1.1.1.1 and you have a route, which sends that traffic through openvpn, then NAT rules on openvpn interface are followed.
If you try to acces 99.99.99.99 and you have a route, which sends that through your WAN interface, then that NAT rules are used.
To influence, which interface is used outbound, you can use policy based routing.
This is done on OPNsense, by changing the gateway inside a firewall rule.
So lets assume, you use the default LAN out rule and nothing else, then you could:
- add a rule above that LAN rule, which allows traffic from 192.168.2.12 to destinations of your choice (maybe any?)
- in "Advanced features" section of that rule change gateway from "default" the the gateway representing your internet router.
Afterwards traffic coming from 192.168.2.12 to specified destinations will go out through WAN interface and not openvpn.
You do not need to add additional outbound NAT rules, cause what you defined is already included in
nat on $WAN from $tonatsubnets to any -> 192.168.1.7/32 port 1024:65535
(192.168.2.12/32 is part of 192.168.2.0/24)
So you can remove your additional outbound NAT rule.
Regards,
Joerg