Skip to Content.
Sympa Menu

freetds - Re: [freetds] default port discovery using 1434

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Frediano Ziglio" <freddy77 AT gmail.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] default port discovery using 1434
  • Date: Wed, 17 Dec 2008 09:11:09 +0100

2008/12/13 James K. Lowden <jklowden AT freetds.org>:
> It is technically feasible to discover the default port of a modern
> Microsoft SQL Server using port 1434.
>
> The protocol is documented in '[MC-SQLR].pdf', available at
> http://download.microsoft.com/download/B/0/B/B0B199DB-41E6-400F-90CD-C350D0C14A53/%5BMC-SQLR%5D.pdf.
> Google turns it up with "ssrp protocol site:microsoft.com".
>
> I added a -L option to tsql to print the response to message type
> CLNT_UCAST_EX, which is a single byte of value "0x3":
>
> $ src/apps/tsql -H 10.20.30.38 -L -U$U -P$P -p9999
> locale is "C"
> locale charset is "646"
> ServerName HARVEY
> InstanceName MSSQLSERVER
> IsClustered No
> Version 9.00.3042.00
> tcp 1433
> Msg 20002, Level 9, State -1, Server OpenClient, Line -1
> Adaptive Server connection failed
> There was a problem connecting to the server
>
> (One doesn't need to log in to acquire the port, but tsql doesn't know
> we're not trying to log in.)
>
> To determine the port of the default instance, use CLNT_UCAST_INST with an
> instance name of "MSSQLSERVER".
>
> For now, a freetds.conf entry like this will work:
>
> [harvey]
> host = harvey.example.com
> instance = MSSQLSERVER
> tds version = 8.0
>
> In the future, FreeTDS could use this feature to look up the default port.
> That means we now know how to connect to most servers with no
> freetds.conf:
>
> 1. Try protocols in descending order (7.2, 7.1, 7.0, 5.0, 4.2).

Yes, I think however that some protocol versions can be avoided, for
instance if 5.0 is used.

> 2. For 7.0+, query port 1434 for MSSQLSERVER, using 1433 if no response.
>

Yes, we have to take into account backward compatibility and that some
admin disable 1434 port via firewall.
If you specify "MSSQLSERVER" as instance currently libTDS shiould
lookup port using unicast request.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page