Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Many datacentres sell the option of having more than one IPv4 address per server.

Before I buy and allocate any addresses, I'd like to experiment with this at home, but I am unsure how to go about it. Is it the job of specialist routers/switches or can it be achieved with basic switches and cheap PCs?

For example:

PC(A) has IPs 10.0.1.1/28

PC(B) has IP 10.0.1.254

PC(A)'s request to 10.0.1.1 and 10.0.1.2 (etc.) go to PC(B).

I have a few home routers with inbuilt switches on them that I can disable DHCP in the config. I also have a few old machines I can use to provide any netwoking services e.g. DHCP.

One of the reasons I'd like to experiment with how to do this, is to allow 1 machine to accept requests on a given port from multiple domains without proxying (hence multiple IPs), then forward the packets internally to services, on differing internal ports, based on their destination IP, with iptables rules.

share|improve this question
    
Why the down votes? I specifically want experiment with this on available hardware so that I can put it into place quicker in the workplace. –  Mike Sep 11 '11 at 23:42

1 Answer 1

Simply having multiple addresses is pretty simple and requires no special equipment. It's called IP Aliasing. There's the traditional method of creating alias interfaces (eth0:1, etc), or the newer method of using the 'ip' command to add IPs to a single interface. A server with aliased IPs will ARP-reply for all of them (and Linux will do so on all connected interfaces, not just that subnet).

Both methods have the same effect; use of one or the other is dependent on how much you rely on broken software that binds to an interface by name (instead of an IP address) to select the source of outgoing connections and for creating a daemon's listen socket.

Aliased IPs must be manually configured; DHCP has no provision for assigning additional IPs to a single MAC address.

Building on this is multi-IP handling by loopback interfaces. In this setup, the actual interface (ethX) has a small block used to talk to the gateway (say a /30 or a /29), and a larger block is aliases as above to the 'lo' interface. The gateway device (datacenter router) has a static route for the block on the loopback, specifying the server's eth0 IP as the next hop. In this setup, the server may not ARP-reply for the IPs in the routed block, only for the IP actually directly connected on ethX.

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.