1

I have two hosts. They both have the same IP/subnet, ex.: 1.2.3.4/24 on both. I know this is bad, since there will be duplicate IP in the network. OK.

But: If I have different (?) ranges:

1.2.3.4/22

and

1.2.3.4/24

for the same situation, will it cause IP conflict? Or since different subnet, they doesn't affect each other in any way?

  • 4
    The same address is still the same address. X is always X; the size of the range is meaningless. – Ricky Beam Apr 18 '18 at 17:07
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer. – Ron Maupin Dec 25 '18 at 8:22
5

An IPv4 address is a 32-bit number, and it doesn't matter if the mask is different, all 32 bits are the address, so if they are the same then it is the same address.

The mask (or mask length) simply determines which portion of the address represents the network, and which portion represents the host on the network. The /24 network address is a subnet of the /22 network. That means the /24 network is part of the /22 network, but the /22 network also has other addresses not part of the /24 network. The single address is part of the /24 network, and by extension, part of the /22 network that contains the /24 network. The address is the same address, regardless of the network mask (or mask length).

The IPv4 packet headers do not contain any mask information; they only have the address, so there is no way to determine from the packet, which network you mean, so yes, you have two hosts with the same address.


Think of your networks/subnets as a binary tree. Adding a bit the the mask length simply halves the number of host addresses for the network. In the diagram below, it doesn't matter where you start on the binary tree above the host address (/22, /23 /24, etc.), following down the binary tree will get you to the same final address:

enter image description here

The mask length just tells you where in the binary tree to start.

| improve this answer | |
0

Generic concepts:

  • IP address identify host in IP network. So if two hosts hawe same IP it's indistinguishable.

Short answer: Yes it still conflict.

Long answer:

  • If itconnected to same broadcast domain (L2 network switch) then both can't work as expected.

  • If it in different L2 networks. Only one host can be reachable. Which - depends on routing rules. (for example anycast works in this way). But this still make troubles for TCP protocol so anucast most used for simple UDP stateless request-response protocol. DNS for example.

Detailed understanding require knowledge of ARP (ND) and TCP protocol works.

| 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.