views:

370

answers:

1

While trying to get a 2008 server to connect to a sql server, I noticed a change in the 2008 IP stack that has me a bit flummoxed. I'm looking for either an OS way to override this, or a programmatic way in .NET to override this.

For the sake of this argument, assume I have a web server with multiple IP addresses to server multiple sites, connecting to multiple resources (web service, sql, etc) behind a firewall.

SERVER IP:   10.10.10.1
SITE1 IP:    10.10.10.10
SITE2 IP:    10.10.10.11

SQL SERVER:  10.10.10.2
WEB SERVICE: 10.10.10.15

The firewall is setup naturally to deny all, allow only what is needed. In other words:

ALLOW FROM 10.10.10.1 TO 10.10.10.2
ALLOW FROM 10.10.10.1 TO 10.10.10.15
DENY ALL

Prior to Windows 2008, Windows 2000/2003 always used the machines base IP (10.10.10.1) when requesting network resources. Thus, the firewall rules were met and access was granted. Under 2008, it appears that it's picking the closest match:

Connecting to 10.10.10.2 comes from IP 10.10.10.1. Firewall is happy. Connecting to 10.10.10.15 comes from IP 10.10.10.11, firewall denies connections.

Removing all virtual IPS from the NIC of course makes things work because every will then come fro 10.10.10.1

Now, I understand slightly that were this machine to have two NICs, this makes sense because of changes to implement RFC3484 and IPv6 (http://support.microsoft.com/kb/968920) and strong/weak host model comes into play, but for the life of me, I don't understand why this should have changed how IP works with a single NIC card.

I have a support case open and I'm getting nowhere. I hear muttering of "just open up your firewall to allow connections from 10.10.10.11". That's not practical. This would mean adding a allow rule for every ip address on a multihomed single nic machine just for windows 2008. I can't believe poking more holes in your firewall just for 2008s ip stack is a good answer.

Is there a way to disable this "feature" in 2008 at the machine level? Is there a way to disable this in .NET at the machine level? Is there a way to disable this per connection (SqlConnection, WebClient)?

A: 

You're seeing the side-effect of Automatic Route Metric computation. When multiple addresses have route to an address and Automatic Metrics (in the Advanced... settings under TCP) is enabled, Windows will use try and predict the "fastest" path to that address.

I suspect both your interfaces (virtual or otherwise) have the similar route metrics so the choice is non-deterministic. You could encourage it from using your "back-edge" address for by setting a higher route-metric on your .10/.11 addresses. With automatic metrics disabled you could also prescribe an explicit static route using your 10.10.10.1 address.

More detail on TechNet - search on page for Automatic Metrics.

http://technet.microsoft.com/en-us/library/bb727001.aspx

For better or worse. If both interfaces advertise a path with equal metrics - either interface can win. The behavior in the past was nondeterministic - it's changed.

The best approach is to use route at the command-line to either create a static persistent TCP route with lower or lowest cost between .1 and .2. Alternately increase the cost of every route on .14 & .15 addresses. I'd use the former since there is less to maintain and less side-effects on other communications.

stephbu
I only have one NIC/Interface. Only one metric. Unless you can set a metric per IP address on a single NIC.
claco
And static routes? Yuk. Not to feed the trolls, but things were just dandy under 2000/2003, and I don't have this issue with *nix multihomed single NIC *nix machines. That's what's so frustrating...with a single NIC, there's no reason for the stack to do anything different that it has always done.
claco
In other words, multiple IP address on a single nic all have the same mask. They are ALL the closest route to the destination to that cards gateway. No reason to no use the root IP like the stack always has.
claco
Yeah I'm pretty sure that's what you're seeing - if you dump out the routing table I suspect that both interfaces/routes are in the table and metrics are identical. The disjoined network scenario is pretty similar - their solutions were a) no default gateway on interfaces that you wanted to suppress, b) persisted static routes
stephbu
"both interfaces/routes". But I have one single network card. One. That means one metric. I'm not routing packets between two separate network cards/netmasks on this machine. One card. One gateway. One metric. One netmask. Just multiple ips on that one card. That's why I say, there is NO reason for this to work any differently than it did under 2000/2003.
claco
@claco the routing table is less about the number of NICS and more about the addresses discovered by the default gateway. Because you have a single NIC - your addresses share the same default gateway - they have the same metrics.For better or worse. If both interfaces advertise a path with equal metrics - either interface can win. You relied on this nondeterministic behaviour in the past - it's changed. You may make noise at static routes, but you have few other choices.
stephbu
Ah. I think I get it. Does this mean that 2008 now treats virtual ips as virtual interfaces (as apposed to physical interfaces), then gives them all the same default metric right?So if I add a manual route for the two destination ips, and given them different metrics, how does that change which virtual ip 2008 chooses as the source?What are my other options?
claco
Yes as far as TCP routing table is concerned each address is a logical interface. (route PRINT and you'll see what I mean). I guess you have two choices - either set a persistent route with lower metrics between .1 and .2, TCP always uses the lowest costed route, or increase the cost of the .14/.15 routes - the former is easiest to define and manage.
stephbu
stephbu, please add this as an answer and I'll mark it as the solution.Tested and works.
claco
Thanks @claco glad it worked - updated the original too
stephbu