Can a computer with 2 network cards have the same IP address for both

5

2

While answering this question I found something I didn't know and couldn't find an answer for.

In the context of the above question if a computer / server has 2 LAN ports built in on the motherboard (Or 2 seperate Network Cards) should these 2 cards have the same IP address e.g 10.0.0.1 or should they both have different addresses e.g
Port 1 10.0.0.1
Port 2 10.0.0.2 Hypothesising that the user wants just to connect 2 other computers to the servers 2 LAN ports using crossover cable.

I would think they had to have different 2 seperate IP addresses but was wondering what that would mean if using DNS. Would the server have 2 seperate records in DNS. Could it be contacted by either? Which would take precedence?

Any answers on this topic or further information would be greatly appreciated.

Joe Taylor

Posted 2011-09-17T22:44:22.293

Reputation: 11 533

Answers

10

Yes and no.

While e40 is correct in thinking that IP addresses should be unique within a routing domain (i.e. there should ever only be one 10.0.0.1 present on your network - see RFC 5889) you can have multiple hardware devices underlying that single IP address. This is generally done with Link Aggregation Control Protocol (LACP). LACP can function at any of the three lowest OSI layers which of course includes IP. The method in which the IP address is "resolved" (at Layer-3) to which specific MAC address (at Layer-2) for frame delivery is largely implementation dependent (although generally it's round robin).

You could configure IP address aliases on each device so that each NIC could be reachable individually or through the "virtual" IP address that represents the bonded NIC (both devices).

user74416

Posted 2011-09-17T22:44:22.293

Reputation:

What are the implications of using IP-level LACP? I would like ethernet connection to have a given IP but if I ethernet is not working I want the Wireless card to take the same IP, can I configure LACP and just leave one of them working at the time without any troubles? and is it worth it? – White_King – 2019-09-18T11:52:05.873

1

The NICs must each have a separate IP-address, these should normally be in separate subnets.

The exception would be when you are using something such as channel bonding or some hot-failover redundancy system.

RedGrittyBrick

Posted 2011-09-17T22:44:22.293

Reputation: 70 632

0

To complement the answers already given...

there area at least 2 occurrences
where you can reach 2 different NICS
targeting the same IP...

these are a bit more ''techie''
and I leave them here just for completeness:

  1. you have subnet(s) defined in the same LAN (MAC is the relevant ID )
  2. you have bridge'ed the network cards... ()

ZEE

Posted 2011-09-17T22:44:22.293

Reputation: 571

0

Each "LAN port", or NIC, must have a unique IP address. It would be unusual for each of the IPs to be on the same network. The same DNS server could serve both IPs, and usually does. I have an internal NIC and external NIC, and my same DNS server knows about both of them.

e40

Posted 2011-09-17T22:44:22.293

Reputation: 1 143

0

A Domain Name Service deals with Names. You can put in multiple name records (A records) with the same name and different IP address. When the DNS gets a Name request, it returns all A records. If the records are on different subnets, the client can decide to use the appropriate address. If both addresses are on the same subnet, the client may get confused.

You can (but shouldn't) give both LAN ports the same IP address, and put them on physically disconnected networks. Since the networks are physically disconnected, other computers on those networks will not be confused. You could even have only one Name, and one IP address, and computers on physically disconnected networks can't get confused.

But the computer with two LAN ports, or rather the software on the computer with two ports, will get confused. The commonly used API, "Berkeley Sockets" doesn't understand computers with multiple interfaces, and uses the IP address as an alias for the interfaces. Any software written using a portable socket interface won't be able to distinguish the two LAN ports. At the bottom level, the OS won't be confused, but even if ALL of its parts can handle the situation, it will probably notice the error.

Note that if you bond the two interfaces togethor, the OS and the socket API will only see one interface. You won't "give both ports the same IP address" since there will only be one "port" visible to give an IP address to.

user165568

Posted 2011-09-17T22:44:22.293

Reputation: 421