30 Jul 2012 15:25
Forcing track/routeback over OpenVPN connection
Bas van Schaik <bas <at> tuxes.nl>
2012-07-30 13:25:51 GMT
2012-07-30 13:25:51 GMT
Hi all, I've been struggling with a rather exotic routing challenge for a few days now, hope someone here can give me some hints. I'm running a virtualised server (Debian, Shorewall 4.5.5.3, IP 123.123.123.123/255.255.255.0 - let's call this 'server') in on a location at which all ports except for 22 are firewalled. I need access to this server on ports 25, 143, 587, 80, and 443, so I decided to hire a VPS (Debian, Shorewall 4.4.11, IP 234.234.234.234/255.255.255.0) - let's call this 'vps-gateway') which runs OpenVPN. The server connects to the vps-gateway, and Shorewall on the vps-gateway is configured to DNAT the ports mentioned above to the server. A shorewall dump of the server is attached (vps-gateway is irrelevant, that one works fine), which will show you a set-up using two providers: - prov_main: main outgoing network connection (over LAN with gateway) - prov_vpn: provider created for traffic coming in through the vps-gateway (with 'track' option) This works beautifully: traffic coming in on 234.234.234.234 gets DNATted to 192.168.103.6 (IP of server on VPN), is sent to the server, and the server routes replies back using tun0 via vps-gateway through the prov_vpn provider. Even though the default gateway for the server is 123.123.123.254 on eth0 (123.123.123.123/255.255.255.0). So the routing responses over the same interface works. One problematic exception: traffic from the server's LAN (e.g. a client at 123.123.123.100/255.255.255.0) with destination 234.234.234.234. The packets get DNATted at the vps-gateway and sent to the server through the VPN (as is to be expected), but the server acts in one of three ways (seemingly at random, not sure what's going on here):(Continue reading)
RSS Feed