Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an IIS server set up with multiple web sites, each with their own IP address. It works fine for routing incoming traffic to the right site. However, outgoing traffic all appears to come from the IP address of the physical machine, not the individual sites. They need to appear to the outside world as separate IP addresses because the service they are communicating with differentiates by IP address alone.

Maybe someone has set up a NAT server to do this? Any ideas? Thanks!

share|improve this question
add comment

5 Answers

I don't think you're going to get that functionality with IIS alone. You could put in some kind of front-end NAT box (say, a Linux machine w/ iptables), run the various sites on different TCP ports on the IIS box, and NAT them to different IP's on the Linux machine as a quick-and-dirty solution. IIS and Windows, though, aren't going to do what you want.

The iptables rules to do what you'd be looking for would be pretty simple. A Cisco router's NAT, and a slew of other embedded NAT implementations, could do it too.

share|improve this answer
    
My problem is related - I want to give 10 sites on my hosted VM Windows 2008 server different IP addresses. So per your answer, I can leave my email ip the same in all the Web.Config files? –  IrishChieftain Sep 28 '11 at 17:52
    
Uhh-- what? I don't think I said anything about email in my answer and I'm not sure what you mean. Consider posting a question with details about what you're looking for. –  Evan Anderson Sep 28 '11 at 21:32
add comment

When you communicate which level are you? If you are in TCP level you can set an interface to use.

share|improve this answer
    
c# web services, not at TCP level. –  mDelp Jun 26 '09 at 16:46
add comment

It depends what the outgoing requests are how you are making them. If the facility you are using to make the requests supports it then you can ask it to bind to a specific address instead of the default.

I'm pretty sure that you can not do this with the common IIS methods though (like using the WinHTTP library).

In other tools/libraries, look for a "bind address" option such as this taken from the wget man page:

--bind-address=ADDRESS
    When making client TCP/IP connections, bind to ADDRESS on the local
    machine. ADDRESS may be specified as a hostname or IP address. This
    option can be useful if your machine is bound to multiple IPs.
share|improve this answer
    
I think that would work, but the code is not creating a socket. It is a C#.NET WebRequest object. –  user10805 Jun 26 '09 at 19:36
    
I'm not much experienced with dotNet but the docs look like there is no bind option with that class. You might be able to do what you are looking for with a service point class (msdn.microsoft.com/en-us/library/system.net.servicepoint.aspx) with an end point delegate (msdn.microsoft.com/en-us/library/system.net.servicepoint.aspx) –  David Spillett Jun 28 '09 at 12:49
add comment

Check to make sure that your extra IPs are not just being routed to a single IP before it gets to you. You could do this by plugging into the same VLAN as the server and hitting the secondary IP.

share|improve this answer
add comment

In IIS, it might sound picky, but Web sites don't communicate outbound; applications hosted in a website container do.

Program your app to use a specific IP, and it will happen. IIS doesn't provide an outbound communication API directly, so it won't help you.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.