Choosing which interface to use

Bill Moran wmoran at
Fri Apr 7 14:36:35 UTC 2006

hal <hal at> wrote:

> I am setting up a VPN client on a 6.0 box of mine.
> As a result of the VPN client (openvpn) running I
> have two interfaces active, xl0 needed by the dhcp
> client and tun0 used by the vpn client.
> The question.  How do I tell an application perhaps telnet,
> ssh, or ftp to use tun0 and not xl0?

Ideally you would set up appropriate routes when you establish the VPN
tunnel, and the kernel would know the correct direction based on the
destination IP address.  Since this isn't the case, I strongly suggest
that you look into cleaning up your IP ranges so it can be.  Never allow
half-baked routing to exist, it just causes more and more headaches the
longer you let it go.

However, many programs have an option to control where the source port
originates from.  If the application you want to use supports this, you
can specifiy the IP of your end of the VPN tunnel and it should force
the traffic to go through the tunnel.  ssh, for example uses -b to set
the originating IP.

I'll reiterate, however, that the _best_ way is to properly organize
your routing so it happes automagically.

Bill Moran
Potential Technologies

More information about the freebsd-questions mailing list