Can we have exactly same IP addresses with different CIDR notations? Example:
184.108.40.206/20 220.127.116.11/21 18.104.22.168/16 22.214.171.124/24 126.96.36.199/29 188.8.131.52/15 And so on...
How will it effect routing?
Network Engineering Stack Exchange is a question and answer site for network engineers. It only takes a minute to sign up.Sign up to join this community
Subnets are for routing tables for longest prefix match. But an IP packet in itself has no notion of subnets. so you cannot assign same IP addresses with different subnets.
What you seem to be missing is that when you mask those addresses with your different network masks, they all arrive at the same network address:
184.108.40.206. An IPv4 address is simply a 32-bit binary number. CIDR notation gives you the mask length. When you mask (logical
AND) the address and mask, you get the network address. See the previous question, How do you calculate the prefix, network, subnet, and host numbers? and its excellent answer for more details.
You cannot assign overlapping network addresses to router interfaces because the router would have no way to know to which interface it should send traffic destined for that network. You can, however, have multiple routes to a network with different mask lengths in a routing table. The router will look at the mask length to determine to which interface it should send traffic destined for that network. The routing table entry with the longest mask length wins. Based on what you have listed in your question, that would be
It's always the same IP address, just in varying subnets (all overlapping):
220.127.116.11/15 - part of 18.104.22.168 to 22.214.171.124 126.96.36.199/16 - part of 188.8.131.52 to 184.108.40.206 (subnet of above) 220.127.116.11/20 - part of 18.104.22.168 to 22.214.171.124 (subnet of above) 126.96.36.199/21 - part of 188.8.131.52 to 184.108.40.206 (subnet of above) 220.127.116.11/24 - part of 18.104.22.168 to 22.214.171.124 (subnet of above) 126.96.36.199/29 - part of 188.8.131.52 to 184.108.40.206 (subnet of above)
So essentially: no, you can't use the same address for different hosts (if they're connected).
The netmask defines the size of the subnet that's directly connected. This is the range of destination IP addresses that can be talked to directly on a common layer 2 connection (e.g. Ethernet). Destination adresses outside this range require the use of a router.