4

I understand that an IP adress refers to a NIC and not to a host, therefore a single host can have as many IP adresses as NICs.

But Tannenbaum says:

It really refers to a network interface, so if a host is on two networks, it must have two IP addresses.

Can someone clarify this?

  • At a very basic level: you can make one NIC pretend to be two NICs (e.g. with VLANs) – user253751 Jan 22 at 16:00
  • 1
    I think you may be misunderstanding that quote - it says that, if a host is on two networks (i.e. if it has two NICs, one on each network) then it must have two IP addresses (i.e. each NIC must have its own IP address). So that's very much inline with what you say in your first paragraph. Or am I missing something? – psmears Jan 23 at 13:11
  • Did any answer help you? If so, you should accept the answer so that the question does not keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer. – Ron Maupin Jan 29 at 14:44
11

IP addresses are assigned to layer-3 interfaces (IP is a layer-3 protocol), either physical or virtual, and each interface can have multiple IP addresses. Multiple IP addresses are even required for IPv6, where you will have a Link-Local address and one or more Global and/or ULA addresses per interface.


I will give you an IPv4 example that happens. DHCP is normally confined to a single LAN because it uses broadcast (forget for a minute about DHCP relay because not every router supports that). That means that you would need a DHCP server on every network you have, but there are reasons you do not want to do that. One way around this is to connect the DHCP server via a trunk link. The DHCP server would have a single NIC, but it would have an address for every network that comes in through the trunk. It could have many addresses for networks served by that one NIC.

| improve this answer | |
8
  • Each interface requires an IP address of its own.
  • Two different networks (subnets) require two different IP addresses, one from each network.
  • You can bind multiple IP addresses to a single interface.
  • When interfaces are bonded in some ways they can share an IP address (or address pool).
  • A physical interface configured with multiple VLANs (on a trunk) logically represents multiple (sub)interfaces.
| improve this answer | |
3

Zac67 and Ron Maupin have briefly explained how multiple IP addresses per NIC work, which was probably the intent of the question.

Here, I try to explain why one would add a second IP address to a host or gateway.

In most cases nowadays, one would normally use multiple VLANs for these situations, with one subnet per VLAN.

History

VLANs were standardised much later then Ethernet (1998 for IEEE 802.1Q compared with 1986 for IEEE 802.3), and it was not until about 2002 that Layer 3 workgroup switches became affordable. VLAN capability in branch office routers was not standard until several years later.

Therefore, the ability to bind multiple IP addresses to a single NIC without VLANs has existed for a long time in Unix and Linux, and in Windows since at least NT4.

Reason 1 : Shortage of IP addresses

Imagine you have a site with a public /24 (Class C) network (254 useable addresses) and you need more.

The easiest way to expand is to ask your ISP for another block of addresses which can access the Internet through a secondary IP address on the router (ignoring the need for a firewall for the moment).

Both subnets will be available at every port on the network, but without any other changes, all traffic from subnet B to subnet A must pass through the router, which reduces performance and adds congestion on the router port.

If you then add a secondary IP address to the server(s), PCs on subnet B can access the server(s) without passing through the router.

Reason 2 : Migration of IP adressing

When interconnecting isolated sites and new acquisitions into a corporate network (especially in a NAT environment), it's often necessary to change the subnet used.

As described in Reason 1, one can simply do this by adding a secondary IP address in the new subnet to the router and server(s) on site, then over time changing the configuration (static IP addresses, static DNS addresses, static IP addresses in applications ...) before retiring the old subnet addresses.

Note : DHCP servers or forwarders may have problems assigning IP addresses on their secondary subnet - it's better to put the new IP address as primary and the old as secondary.

| improve this answer | |
  • 2
    Reason 3: special-purpose address ranges. Sometimes you'd want to keep some protocols on a dedicated (e.g. non-routed) subnet but don't require VLANs because there's no risk of spoofing (e.g. SSH or Mysql inside a DMZ). Other instances include load balancing over LAG trunks that can only use SA/DA traffic distribution. – Zac67 Jan 23 at 10:33
  • @Zac67 : You have some good points there. – grahamj42 Jan 23 at 11:46

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.