With ifconfig, I am able to configure multiple IP addresses on a single network interface card. Why would I want to do that and how would I later utilize several addresses, e.g. how does software know which one to use?

I have only used network interfaces with a single IP address so far.


Some (but not all) reasons:

  • In order to host multiple SSL sites as already mentioned
  • Because you may be consolidating services from multiple hosts and you need to preserve the addresses
  • In order to use an IP address that can later be transferred to another host
  • To compensate for a host that's down at that moment by adding its IP address to another one
  • If you have multiple IP networks on the same physical/logical network/vlan it will prevent traffic from being exchanged via the gateway, speeding things up and reducing the load
  • In order to setup a device that has a default IP address and thus you need to add an address on the same network
  • In order to use different public IP addresses to avoid firewalls or to avoid being blacklisted in SPAM filters
  • In order to make things less obvious to external people. E.g. you may be running apache on IP address and only allow SSH on That way if someone attempts to attack the IP address behind a site they won't find SSH running.
  • In order to run the same service multiple times
  • In order to use different hostnames in reverse DNS lookups. E.g. if you're connecting from this host to something external and you want to be presented as two different domain/hostnames
  • In order not to expose commonality between services. E.g. if you host site1.example.com and site2.example.org and you map them on different IPs instead of using CNAMEs there won't be an obvious link between them
| improve this answer | |

In the case of a web server, it depends. If you have multiple virtual hosts then in Apache for example, the server knows which IP to use from the VirtualHost block.


You can also have a VirtualHost listen on all available interfaces which Apache is currently listening on (via the Listen directive eg. Listen *:80

 <VirtualHost *:80>

In the event you have multiple sites running on a server where multiple sites are SSL enabled, it is good to have a separate IP for each site. This is because SSL certificates are exchanged before the HTTP headers are sent. If you have multiple vhosts on one IP, then Apache will not know which site you are trying to reach without the host header.

I'm sure there are many other use cases, this is a common one.

| improve this answer | |
  • You forgot that SSL doesn't matter anymore and there is a way to overcome the limitation in TLS ;) – 0xC0000022L May 3 '14 at 22:26

It's good idea to have separate ip for separate services, then when you'll have to migrate one of service to another hardware/location, there will be transparent for other components.

Some services use the same port number, then you have to have several ips to run this services on single server.

Also if you want to handle more simultanous connections than you have ephemeral port, you'll need more ip.

| improve this answer | |
  • If I'm running a web server, how does it know which IP address to use? Does it install to use the main IP by default? – Nickolai Leschov May 3 '14 at 21:03
  • 3
    It's configurable. By default it Listen or Binds to every IP on host. – fazie May 3 '14 at 21:06

multiple IP Adresses allows to you having Service IPs, in other words you can match IP with a specific service, for example in sendmail you do :

DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp, Addr=')dnl

and so on. it can be used for High Availlability, for test and network routing ^^

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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