Skip to Content.
Sympa Menu

freetds - Re: network unreachable with freetds

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: James K. Lowden <jklowden AT speakeasy.org>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: network unreachable with freetds
  • Date: Wed, 7 Aug 2002 23:40:14 -0400


On Wed, 7 Aug 2002 20:28:49 -0400, "Casey Letzia" <casey AT creditguard.org>
wrote:

> Greetings,

Hello.

> We can telnet from said dmz box to the
> database server on port 1433, but when we try to connect from php using
> freetds, we recieve the dreaded "src/tds/login.c: tds_connect:
> 228.128.0.168:1433: Network is unreachable."

Is 228.128.0.168 the right address? And is that the address in your DNS,
or in /etc/hosts? I'm guessing it's the wrong address, because it's
unreachable.

> Viewing our trusty tcpdump
> logs indicates that freetds is looking at our name servers (hosted by
> sprint external to our network) and seemingly ignoring our /etc/hosts
> file.

As you probably know, the consultation order of name-lookup resources is
configurable. NetBSD, for instance, uses nsswitch.conf.

> We are confident that our freetds.conf is okay because when we
> remark out the nameservers in /etc/hosts it connects no problem.

Removing the nameservers from /etc/hosts -- assuming that's precisely what
you mean -- would have the effect of disabling access to DNS if
/etc/resolv.conf mentions the nameservers by name (and not by address).

FreeTDS relies on gethostbyname(3) to determine the address. In case you
are using a recent snapshot, I should mention that recently support for
gethostbyname_r(3) was added for hosts with threading needs.

Also, recent snapshots (and cvs, of course) install a file called "tsql".
You can use it to test your connection:

$ tsql
Usage: /usr/local/freetds/bin/tsql [-S <server> | -H <hostname> -p <port>]
-U <username> [ -P <password> ]

$ tsql -S sandbox -U freetds -P xxxxxx
1> exit

$ tsql -H sandbox -p 1433 -U freetds -P xxxxxx
src/tds/login.c: tds_connect: 192.168.1.12:1433: Connection refused
There was a problem connecting to the server

$ tsql -H sandbox -p 4100 -U freetds -P xxxxxx
1> exit

> We are somewhat confused as to why we can telnet to the socket pair, but
> are unable to 'freetds' to it. We are assuming that we've done something
> wrong, and would greatly appreciate your assistance.

Hope this helps.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page