I'm beginning understanding network concepts and tools. I setup three VM's with the following configuration:
A: 192.168.1.3 B: 192.168.1.1 192.168.2.1 C: 192.168.2.2
In A, I ping 192.168.1.1 and it pongs. I think A has no idea where 192.168.2.1 is located. So, when I ping 192.168.2.1, it doesn't know to what interface it should be routed. My first question is that when there's only one interface, why it wonders? :D Anyway, for route to take occur, in A I add the following:
sudo route add default enp0s3
I may use the following commands instead:
sudo route add default gw 192.168.1.1 sudo route add default gw 192.168.1.3
- Am I right in the commands?
- The last command also works! Why?! Is it correct?! How?!
With one of these commands A may ping 192.168.2.1 too. Then, I go to ping C from A. I expect the ping packet when received by B, it knows how to route it and route it to C via 192.168.2.x interface, but it doesn't.
- Why? Should I do something in B?
- What should I do in B for the ping to get response from C?