0

I have a question about network masks.

  • Host A IP : 10.0.0.1/24
  • Host B IP : 10.0.0.2/25

Why is PC1 able to ping PC2, but when PC2 tries to ping PC1, it times out? Can I get a detailed explanation?

Edit for clarification:

On PC1 we did ping -c2 10.0.0.2, and we did get a reply successfully from PC2. On PC2 we did ping -c2 10.0.0.1, and we did not get a reply successfully from PC1. We want to know why this happened?

enter image description here

Update: We used 10.0.0.200/25 instead, and were able to ping PC1 to PC2, but not PC2 to PC1, which is what we wanted. Can someone explain why this is?

  • You need to give a lot more context around this. If those two hosts are connected to the same switch, on the same VLAN. There is no reason they shouldn't be able to ping each other. – Ron Maupin Apr 3 '16 at 22:11
  • Now if host B's IP had been 10.0.0.200/25 instead, then packets would go from A to B, but they shouldn't go back, so it shouldn't ping. – Law29 Apr 3 '16 at 22:56
  • I edited my question. – yoman Apr 4 '16 at 0:04
  • There is something else going on. As I wrote in my first comment, based on the information you have given us, and if both PCs are on a single VLAN, there is no reason the two PCs can't ping each other. You should give us more information, e.g. a diagram, switch model(s) and configurations, etc. The PCs, themselves, are off-topic here. – Ron Maupin Apr 4 '16 at 0:23
  • 1
    They are either in different layer-2 networks, or there's a firewall involved: A ping B, B answers; B pings A, A ignores it. – Ricky Beam Apr 4 '16 at 0:37
1

It's because the two PCs are on different networks. The PC with 10.0.0.1/24 is on a network which spans hosts 10.0.0.1 to 10.0.0.254, while the PC with 10.0.0.200/25 is on a network with hosts from 10.0.0.129 to 10.0.0.254, but the network doesn't include the first PC with the address 10.0.0.1. Clearly the second host thinks the first host is on a different network.

When an IP host wants to send something to another IP host, it first looks to see if the destination IP address is on the same network as itself. If not, it sends the traffic to its configured gateway.

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.