2

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!

5 Answers5

1

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.

Evan Anderson
  • 141,881
  • 20
  • 196
  • 331
  • 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
0

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.
David Spillett
  • 22,754
  • 45
  • 67
  • I think that would work, but the code is not creating a socket. It is a C#.NET WebRequest object. –  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 (http://msdn.microsoft.com/en-us/library/system.net.servicepoint.aspx) with an end point delegate (http://msdn.microsoft.com/en-us/library/system.net.servicepoint.aspx) – David Spillett Jun 28 '09 at 12:49
0

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.

MathewC
  • 6,957
  • 9
  • 39
  • 53
0

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

dr. evil
  • 81
  • 1
  • 1
  • 6
0

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.

TristanK
  • 9,073
  • 2
  • 28
  • 39