Skip to Content.
Sympa Menu

freetds - Re: [freetds] How to specify the local ip address to connect from

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Peter Deacon <peterd AT iea-software.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] How to specify the local ip address to connect from
  • Date: Mon, 29 Oct 2012 18:13:34 -0700 (Pacific Daylight Time)

On Mon, 29 Oct 2012, Steven Peterson wrote:

However, this is a general problem: in general, to connect to remote
machines, all clients, not only FreeTDS, need to present themselves as
originating from an acceptable source. The natural answer is to use
network address translation at the source.

I'd love to help, but I'm afraid I do not have the C skills to provide a patch. My interim solution will be as you suggest -- use the iptables nat table to change the source IP address based on the port, (I can specify a dummy port in FreeTDS, and use that as a flag to iptables to rewrite the 'from' IP). While this may be the general solution, it is probably getting further into linux than many FreeTDS users are able. So, please consider a bindAddress parameter as a suggestion to make using FreeTDS easier for people who are not so familiar with linux.

FWIW unless you bind to a specific interface the kernel normally selects source address based on local knowledge of routing table.

If you add a route preferencing destination OS will pick the right source address for you.

For example:

route add -host mysqlserver mysourceinterface
(route add -host 10.0.0.1 eth1:1)

regards,
Peter




Archive powered by MHonArc 2.6.24.

Top of Page