Point to point connection with mismatched mask

It is a general practice to assign a /30 IP address to point to point connections. But what will happen if we don’t have same subnet mask at both the ends.

As demonstrated in diagram, 2 routers are connected via point to point connection.  

10.0.0.2 from router R1 and here are the results:

R1#ping 10.0.0.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/11/28 ms

Now let me change the IP on fa0/0 of router R2 to 10.0.0.10/30 from 10.0.0.2/30. So if I ping 10.0.0.10 from R1, all the packets are getting dropped.

R2(config-if)#int fa0/0
R2(config-if)#no ip add 10.0.0.2 255.255.255.252
R2(config-if)# ip add 10.0.0.10 255.255.255.252
R1#ping 10.0.0.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.10, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

So the reason for such behavior lies in routing. A ping packet is an application of ICMP which is carried by an IP packet. An IP data packet does not carry a subnet mask hence subnet mask will never be compared while pinging. So why was I able to ping 10.0.0.2 but not 10.0.0.10?

When I ping 10.0.0.2 from router R1, an IP packet is formed with source address as 10.0.0.1 and destination as 10.0.0.2. Router R1 will check in its routing table for route for 10.0.0.2. It can see that it has a route for router R2 exiting via fa0/0

R1#
     10.0.0.0/24 is subnetted, 1 subnets
C       10.0.0.0 is directly connected, FastEthernet0/0

Ping packet will leave the router R1 via fa0/0 port and it will reach the router R2. Now for ping reply destination IP will be 10.0.0.1 and source IP will be 10.0.0.2. Router R2 will check its routing table for 10.0.0.1 and it will also find a route connected via fa0/0. Hence ping reply will be sent over the fa0/0 port and connectivity will be established.

R2#
     10.0.0.0/30 is subnetted, 1 subnets
C       10.0.0.0 is directly connected, FastEthernet0/0

When I have changed IP address from 10.0.0.2 to 10.0.0.10, the route in router R2 will change to

R2#

     10.0.0.0/30 is subnetted, 1 subnets
C       10.0.0.8 is directly connected, FastEthernet0/0

Now if I try to ping from router R1, it will successfully reach the router R2. But router R2 does not have a route back to 10.0.0.1 hence the packet will be dropped.

Hence we may conclude that, different subnet mask assignment can work but we have to take special care of the IP addressing.

Leave a Comment