Dedicated server with multiple IPs

Hey all, I need some help with setting up multiple public IPs pointing to one server. Our company is currently renting a dedicated machine with two network interfaces on it, but we have 20 public IPs assigned to our account. We're using our box for Minecraft hosting, and we offer a dedicated IP as an option, but since I've had to completely wipe and reinstall Ubuntu server onto our box, it seems that I've lost the ability to use the other IPs we've got assigned to our account/box.

Whenever I try to assign a different public IP to our machine, it throws a "failed to bind to port" error and shuts down, no matter what service/application I'm using (Minecraft server, Apache, NGINX, etc.). My question is how do I make the main network interface (em2 in our case) able to use the other IP addresses available to us. The IPs that we have access to are 38.130.218.78 - 38.130.218.78.98, and we're currently running Ubuntu Server 14.04. Any help would be greatly appreciated, as I couldn't find the answer to this anywhere else.

Thats usually due to a service already using the port, or Ubuntu thinking it is. An IP address wont use any ports when your assigning it to an interface as all your doing is assigning it to an interface not a service. Have you added the IP addresses to the servers ethernet interfaces?

1 Like

No, I didn't know you had to do that. How does one do this? Sorry if this is really obvious, I've never worked with multi-ip servers before.

To quickly check it works, you can use ip to add more addresses

the format is:

ip addr add ip/cdir dev interface

for example

[root@jupiter /]# ip link                                                                                                            
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default                                       
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00                                                                            
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000                     
    link/ether 74:d4:35:f5:67:62 brd ff:ff:ff:ff:ff:ff            

[root@jupiter /]# ip addr add 10.10.10.103/24 dev eno1
[root@jupiter /]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 74:d4:35:f5:67:62 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.56/24 brd 10.10.10.255 scope global dynamic eno1
       valid_lft 76193sec preferred_lft 76193sec
    inet 10.10.10.102/24 scope global secondary eno1
       valid_lft forever preferred_lft forever
    inet 10.10.10.103/24 scope global secondary eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::76d4:35ff:fef5:6762/64 scope link 
       valid_lft forever preferred_lft forever

This is temporarily and should reset once rebooted. Youll need to set it permanently. I think Ubuntu uses /etc/network/interfaces https://askubuntu.com/questions/547289/how-can-i-from-cli-assign-multiple-ip-addresses-to-one-interface

You could also use tools like netcfg, network-manager (not usually on a server), or systemds networkd if your ubuntu system uses systemd.

Hope that points in the right direction.

1 Like

Thanks, that helps me out a ton :)

1 Like