[Solved] Routing vs Bridging question - FreeBSD pf NAT
Posted: Thu Jan 14, 2016 7:09 am
Hello, everyone.
FreeBSD host with 2 ethernet interfaces ( re0 and re1) connects to an OpenVPN server, upon connection interface tun0 gets created per my client config, the tunnel replaces default route. I guess it has "redirect-gateway def1" set in server config. It's all right, that was the idea.
So, originally Internet comes through re0 on the VPN-connecting machine. And re1 connects to LAN, for which VPN-connecting machine acts as a router.
My idea was to serve VPN tunnel as default gateway to LAN machines connected through eth1. But this doesn't work! As long as default gateway is through ethernet re0, LAN on eth1 has Internet all right. As soon as tun0 appears and default gateway is replaced with that through tun0, LAN on eth1 has no Internet.
At the same time, it's not a routing problem, since VPN network 172.16.55.0/24 can be pinged from LAN clients. I have NAT rules to translate addresses between LAN and VPN network (and other needed rules as well). Only Internet requests from LAN are not forwarded to tun0 on the VPN-connected machine and Internet hosts cannot be pinged.
QUESTION: is this a limitation of OpenVPN tunnels? Should bridged configuration (tap0 + re1) be used instead?
That'll be rather strange, for I've seen entire LANs sharing VPN-provided Internet.
FreeBSD host with 2 ethernet interfaces ( re0 and re1) connects to an OpenVPN server, upon connection interface tun0 gets created per my client config, the tunnel replaces default route. I guess it has "redirect-gateway def1" set in server config. It's all right, that was the idea.
So, originally Internet comes through re0 on the VPN-connecting machine. And re1 connects to LAN, for which VPN-connecting machine acts as a router.
My idea was to serve VPN tunnel as default gateway to LAN machines connected through eth1. But this doesn't work! As long as default gateway is through ethernet re0, LAN on eth1 has Internet all right. As soon as tun0 appears and default gateway is replaced with that through tun0, LAN on eth1 has no Internet.
At the same time, it's not a routing problem, since VPN network 172.16.55.0/24 can be pinged from LAN clients. I have NAT rules to translate addresses between LAN and VPN network (and other needed rules as well). Only Internet requests from LAN are not forwarded to tun0 on the VPN-connected machine and Internet hosts cannot be pinged.
QUESTION: is this a limitation of OpenVPN tunnels? Should bridged configuration (tap0 + re1) be used instead?
That'll be rather strange, for I've seen entire LANs sharing VPN-provided Internet.