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 Ubuntu server with only one NIC and an address x.x.31.82 configured on it, the default gateway for it is x.x.31.81 and the mask is x.x.31.80/29.

The problem is that I'm trying to configure another address x.x.20.210 – the default gateway is supposed to be x.x.20.209 but I'm unable to configure it on the server.

After I've configured x.x.20.210 as an alias on the NIC, I've used the command

route add -net x.x.20.208 netmask 255.255.255.248 gw x.x.20.209

The route was added to the routing table but but I still can't access x.x.20.210 from the outside.

Can anybody help me please?

share|improve this question

1 Answer 1

To use multiple IP on the same interface, the best way in my opinion is to add in /etc/network/interfaces something like that for the 2nd IP:

auto eth0:0
iface eth0:0 inet static
    address x.x.20.210
    netmask 255.255.255.0
    broadcast x.x.20.255
    network x.x.20.0
    gateway x.x.20.209

And you shouldn't need to configure a route manually. If you want to access it from the outside, don't forget to add this 2nd IP to /etc/hosts and if needed, to configure a DNS record for it.

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.