Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an internal server, which uses a certain service. This service listens on a port, and speaks on a different port. The problem with the service is that it can't listen and speak on the same IP address, so I have configured 2 IP addresses for that NIC, and so I "solved" the problem with the listening and speaking.

I have a problem though...

I need that server to be NATed, with a public IP address, and that server needs to be available from the outside (and as only one IP)...

The question is, how do I solve the situation here?

If I do a NAT for one IP address (the listening port), then he will be able to get requests from the outside, but won't be able to send out traffic (because the other IP won't have NAT). If I do NAT on both of the IPs, then when traffic comes in for the listening port, it won't necessarily arrive to the listening IP, but rather to the speaking one.

I hope I made myself clear and that there is a sensible solution here that I am missing.

share|improve this question
1  
Could you add an example with 2 IP addresses and the ports? I don't see a problem the way you described it. –  lsmooth Feb 20 '12 at 22:34
1  
Your requirements sound so bizarre, I think it's much more likely that you are misunderstanding the requirements than that you actually have to meet the stated requirements. –  David Schwartz Feb 20 '12 at 23:58

2 Answers 2

I have an internal server, which uses a certain service.

Usually we say a client uses a service. A server provides a service. I guess you mean the latter.

This service listens on a port, and speaks on a different port.

It is unusual for a service to require two ports, most manage bidirectional communication with a single port. FTP is the only common exception.

The problem with the service is that it can't listen and speak on the same IP address,

That is extremely unusual (weird even).

so I have configured 2 IP addresses for that NIC, and so I "solved" the problem with the listening and speaking.

I have a problem though...

I need that server to be NATed, with a public IP address, and that server needs to be available from the outside (and as only one IP)...

That isn't obviously a problem.

The question is, how do I solve the situation here?

If I do a NAT for one IP address (the listening port), then he will be able to get requests from the outside, but won't be able to send out traffic (because the other IP won't have NAT).

Normally NAT applies to all IP-addresses in the LAN. So I don't understand the problem. The router which is doing the NAT remembers which of it's port numbers are associated with which internal IP-addresses + port numbers.

If I do NAT on both of the IPs, then when traffic comes in for the listening port, it won't necessarily arrive to the listening IP, but rather to the speaking one.

No, you just use port-forwarding (which is different to NAT) for incoming connections. NAT takes care of distinguishing between existing connections and associating each with an internal IP-address.

I hope I made myself clear and that there is a sensible solution here that I am missing.

Perhaps I have misunderstood, If you can make the question clearer it might be worthwhile.

share|improve this answer

Agree totally with @RedGrittyBrick, the service/program/etc. you are running is really bizarre to require this.

Most NAT routers let you assign so many ports. Usually each port can be assigned to a different IP. Basically there is a port to IP mapping, so NAT is "smart enough" to direct traffic to different IPs.

So assign one port to your server's first IP and port, and another port to your server's second IP and port. The NAT facility in your router will make sure traffic coming in on your "public" IP first port goes to the server's first IP, and traffic coming in on your "public" IP second port goes to your server's second IP.

However, "aliasing" IP addresses on a single physical network adapter as what it appears you are doing on your server is usually not exactly equivalent to having two separate NICs each with their own IP address, so you may run into problems.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.