Iptables – OpenVPN pass through to lan and out second internet connection

iptablesopenvpnroutingswitchvpn

I asked on SuperUser, was told it might be best to ask on here, so here we go.

I want to run OpenVPN on a computer connected to a FiOS connection on one NIC, then pass that traffic onto the LAN, and out another connection. I'm trying to do this so my ISP's tv app can go through the modem, but that company doesn't offer a high enough upload to watch tv that's visible.

Can OpenVPN be used in anyway, in combination with something like iptables, to route that traffic?

Recap, FiOS is strictly for VPN, no traffic but VPN, everything else out the cable modem.
I was thinking:

FiOS -> firewall/openvpn/iptables -> l3 switch -> pfsense firewall -> cable modem

Using the l3 switch to route the traffic to the port that the cable modem is plugged in. Then the LAN on the switch, like media server, web server, security camera dvr server, wireless router as access point.

Best Answer

Short answer: You will need to setup Policy Based Routing.

Longer answer: Your VPN Server will need to default route to the pfSense, then have Policy Based routing (on the VPN Server) to:

  1. Connection Mark connections coming in the FiOS pipe or route the reply packets back that way.
  2. Route UDP/1194 (or whatever you choose for your OpenVPN server) out the FiOS as well.

Number 2 may not be required if 1 is done properly, and you never expect the VPN server to initiate a VPN connection.

I wrote a script to help set this kind of thing up, it might be able to assist you: https://github.com/fukawi2/pb-route/