How to elegantly selectively exclude FreeBSD network traffic from OpenVPN interface by port

Posted by Polygonica on Super User See other posts from Super User or by Polygonica
Published on 2014-08-23T09:34:16Z Indexed on 2014/08/23 10:23 UTC
Read the original article Hit count: 237

Filed under:
|
|
|
|

inexperienced sysadmin here.

I'm planning on running a net daemon inside a FreeBSD jail through OpenVPN, but want to be able to SSH directly into the jail and use the daemon's web interface daemon without going through the VPN. As I understand it, an OpenVPN tunnel is normally set up as a default virtual internet interface, and so incoming traffic will go out on the OpenVPN interface by default (which is problematic, as this incurs latency).

I thought "well, obviously, since all of this traffic is leaving on a handful of ports, I'll just redirect those to the non-VPN gateway." I've tried to look for solutions, but almost all of them involve iptables instead of ipfw (which is default for FreeBSD) and solve slightly different problems. And alternate solutions like using multiple default routes to ensure that incoming traffic on any interface is always sent out on the same interface seem far-reaching and require deep knowledge of all tools involved.

Is there an elegant way of ensuring that traffic leaving on specific ports exits on a specified non-default interface using ipfw?

© Super User or respective owner

Related posts about networking

Related posts about vpn