Same ip in two different hosts but with different netmask, will work?

2

If I configure a network with 10.0.0.0/16 it's range is from 10.0.0.1 to 10.0.255.254, so a host with an IP like 10.0.0.2/16 is ok.

But if I configure another network with IP alias (like IP address add 10.0.0.0/24 brd + dev eth0) and another host is configured with an ip like 10.0.0.2/24.

Will this work? Or it is a conflict?. The IPs are the same, but with different netmasks.

Excuse me the lack of testing but I don't have how to test this.

Paulo

Posted 2016-05-23T14:17:11.150

Reputation: 606

It will conflict... The subnet mask basically tells the computer if an address is intra or inter network, but 10.0.0.2 is 10.0.0.2 whether it is a /16 or a /24. I would suggest some basic research into IP addressing to understand what these things, like subnet mask, do. – acejavelin – 2016-05-23T14:30:16.283

Thanks for the answer. I myself would never do such configuration but it is a question that I have to answer so I was in doubt if it would work. Thanks again and excuse any english errors. – Paulo – 2016-05-23T14:34:42.243

1No problem... Remember that the subnet mask is basically just a guide to say if something is inter or intra network, meaning (extremely simplified) the device uses the subnet mask to look at the destination IP and asks "is this in my network or subnet?" if the answer is yes, it communicates directly to that IP address, if the answer is no, then it communicates to the gateway so it can relay the communication to the IP address or more accurately to the next hop towards the destination. A different subnet mask and same IP within a single network does not make them unique. – acejavelin – 2016-05-23T14:45:20.123

I have added my comment as an answer now that I know this is the answer you were looking for, please accept and upvote if it satisfies your question. Thanks. – acejavelin – 2016-05-23T14:47:44.217

Answers

7

Yes, it will conflict...

The subnet mask basically tells the computer if an address is intra or inter network, but 10.0.0.2 is 10.0.0.2 whether it is a /16 or a /24. I would suggest some basic research into IP addressing to understand what these things, like subnet mask, do.

Remember that the subnet mask is basically just a guide to say if something is inter or intra network, meaning (extremely simplified) the device uses the subnet mask to look at the destination IP and asks "is this in my network or subnet?" if the answer is yes, it communicates directly to that IP address, if the answer is no, then it communicates to the gateway so it can relay the communication to the IP address or more accurately to the next hop towards the destination. A different subnet mask and same IP within a single network does not make them unique.

acejavelin

Posted 2016-05-23T14:17:11.150

Reputation: 5 341