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.

How can I add a second dedicated IP to my home server?

I need two dedicated public IPs pointing to the same server. The reason for this is because I need two applications to use the same port.

I have another NIC installed if this is to any help. I'm using Ubuntu 10.10.

share|improve this question
    
Will I get another public IP when using aliases? If so, how can I find it out? –  user58654 Apr 26 '11 at 23:22
    
@user58654 Hello, and welcome to Super User. Are you the same person who asked this question? If so, you need to associate your Super User and Server Fault accounts, so that you will have ownership of the question and can edit it. Updates to your question should be made by editing the question, not adding answers. If you need help with associating your accounts, please flag this post for a moderator by clicking the flag link above, and we can help you out. –  nhinkle Apr 26 '11 at 23:50
1  
You should also say what app you are running. Some, like httpd, make sharing a port trivial. –  uSlackr Apr 27 '11 at 0:10
    
@user: Aliases, ifconfig, NICs - they don't know and don't care about addresses being "public" or "private". It only depends on whether the first address was assigned to your server directly, or to your home router. It would help if you updated your question with this information. The second address must be assigned in the same way. –  grawity Apr 27 '11 at 11:14
    
(Also, AFAIK, aliases are deprecated on Linux. ip addr add is the new cool thing.) –  grawity Apr 27 '11 at 11:14
add comment

migrated from serverfault.com Apr 26 '11 at 23:02

This question came from our site for professional system and network administrators.

3 Answers

In order to do this you will need to have the public IP's available. Adding aliases just utilitses more private IP address space which is practically unlimited in each network. Your ISP will need to provide you with an additional public IP which you will need to configure on your perimeter firewall, this can then be NAT'ed through to the second private IP to allow you to run two applications using the same port on different private and consequently public IP addresses.

share|improve this answer
add comment

A much better way to solve the issue you are having is run a small local "proxy" program on your server that does nothing but accept traffic on one port and redirect it to the port on the application that will evidently not allow you to change port.

Assume the application only listens on port 3000 and your external IP is 255.99.99.99, and you want a second instance listening on port 3001.

Under this setup, you would tell application instance A to listen on 255.99.99.99:3000, tell application instance B to listen on 127.0.0.1:3000, and tell your proxy program to listen on 255.99.99.99:3001, and to redirect incoming connections from there to 127.0.0.1:3000.

Under Linux you can do this with iptables or another program called rinetd. I'm sure there are equivalent programs for Windows.

share|improve this answer
add comment

Your Answer

 
discard

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