cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
14189
Views
15
Helpful
4
Replies

Why Can two devices with different Subnet mask communicate in a network?

egomezan
Cisco Employee
Cisco Employee

Hello Guys,

I am very new in networking, I was just practicing in packet tracer from the most basic stuff in networking and testing some behaviors to understand better the concepts.

And I created a simple topology:                    PC1-------SW------PC 2,

I went to PC1 and statically assigned IP address 192.168.10.2   255.255.255.0, and PC2 192.168.10.3 255.255.0.0.

You can see that one of them is /24 and the other one /16, I tried to ping these 2 PCs and this was succesful.

Why the subnet mask is not taken into account in this comunication ??

I also added a router and put in both PCs a DG: 192.168.10.1, and they both could ping to their default gateway. this was the topology:

                                                                                                     ROUTER

                                                                                                            [

                                                                                                            ]

                                                                                            PC1 ------ SW--------------PC2

So I am a little bit confused about why 2 addresses in the same subnet but with different subnet mask can comunicate with no inconvenience.

4 Replies 4

johnd2310
Level 8
Level 8

Hi,

A pc uses the subnet mask to determine which network it belongs to.If it determines that an ip address is on the same network, it will arp for the host. If it determines the ip address is remote, it will arp for the default gateway. If you look at the ip addresses carefully, you will see that they are on the same network. 192.168.10.2 255.255.255.0 is on network 192.168.10.0/24, host range 192.168.10.1 - 192.168.10.254. 192.168.10.3 255.255.0.0 is on network 192.168.0.0/16, host range 192.168.0.1 - 192.168.255.254. As you can see,  your ip addresses are covered by both ranges. When host 192.168.10.2 talks to host 192.168.10.3, it determines that they are both on the same network and it will arp for 192.168.10.3. Likewise, 192.168.10.3 determines 192.168.10.2 is on the same network.

Thanks

John

**Please rate posts you find helpful**

Hello

As john states the subnet mask IS used , but as thse tow host are within the same range as ech other then communication will be allowed.

If you changed one of the pcs addressing to say .6 with a mask of 255.255.255.252 then you will find the above is then not the case on the two hosts will not be able to communicate

res
Paul


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

Thanasis
Level 1
Level 1

if i have 195.251.109.10/24 and another network 195.251.109.10/25 to the same device. that specific ip can they work seperate? cause its the same excaclty ip but different subnet. i know that is two seperate domains, but how they work together in one device (router). 

On same router, I wouldn't expect it to accept those two IPs because 1) as you note, they are same IP and/or 2) their networks overlap.

If router did accept those IPs, would expect operational issues.

BTW, above assumes VRFs or virtual routers, etc., NOT involved.