IP Address Assignment: Can Two PCs Share Same IP?

  • Thread starter Thread starter magneeto
  • Start date Start date
  • Tags Tags
    Assignment
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 3K views
magneeto
Messages
6
Reaction score
0
can we assign the same ip address to two different PC's ? if so then how does it work when sending or receiving packets?
 
Physics news on Phys.org
You can do anything you like :) doesn't mean it will work.

If you have 2 devices with the same IP address on the same subnet, you will have problems, if you use IP as your communcation protocol.

For a start your ARP tables (MAC-IP table) will have 2 entries for the same IP address pointing to different MAC addresses. I have never sniffed the wire with this senario, but I would believe that you will get 50% of the packets going to one device and 50% to the other. This is assuming you are not using a layer 2 device with an ARP gaurd or something similar to stop the arp table being posioned.

Any traffic you send out of your subnet will return to your subnet, but probably won't get to your end device.

1 scenario I know where you can have the "Same" ip address on 2 different devices within the same subent is over a PPP link between two PPP devices and you are using IP unnumbered. Another perhaps would be if you are using Multicasts exclusivley and your multicast addresses are different.
 
But, you can share one "real" ip address amongst several computers (to share, say, a dsl connection) if you have a Network Address Translation router to assign "fake" ip addresses to all computers on your local network. All cable/dsl routers are NAT routers.
 
You arent "sharing" an IP address on the same subnet, you are translating an IP address from one class to another, or if you are using VLSM, (variable length subnet masking) you translate from one subnet to another.
There is no "fake" ip address, typically NAT is used to translate from public IP address that are routable on the 'net to private IP address that are not routable on the 'net. Maybe this is what you mean.

What you just described is actually called PAT, Port address translation or NAT overload. PAT is a subset of NAT that uses random high port numbers within a Table to map traffic flows between the public IP address and the private ip address.

It is not correct to say that the system shares an IP address, because it doesnt, it has its own IP address. Rather the router translates and tracks traffic flows from the "internal" Systems to 1 IP address on the outside, to avoid a flaw in IPv4, naminly the amount of IP address you can have ie 2^32
 
Last edited: