Home > other >  Why can't I ping host (router) in my Virtual Box network in Linux?
Why can't I ping host (router) in my Virtual Box network in Linux?

Time:01-09

I have a small project of creating and configuring a network as shown on the picture. Network configuration

I have: 3 VMs (1 work station and 2 routers).

What I need: successful ping from ws11 to r2.

What I have done: 1) Created 2 internal networks 2) Edited /etc/netplan/*.yaml files on each machine (shown below) 3) tried to ping each:

  • ws11: ping 10.10.0.1 - OK,
  • ws11: ping 10.100.0.11 - OK,
  • r1: ping 10.100.0.12 - OK,
  • ws11: ping 10.100.0.12 - FAIL (100% packet loss, no ping reply).

Results of route -n command on each machine are shown here

From what I learned recently the path of packet would be: ws11 checks its routing table and passes packet to gateway (r1), r1 checks its routing table and sees that receiver (10.100.0.12) is somewhere on its network and sends packet to r2. But it actually doesn't work like that for some reason.

What am I not doing correctly? What should be done to make it work? I'm new to networking and I will be thankful for your help.

For ws11:

network:
  ethernets:
    enp0s3:
      dhcp4: false
      addresses: [10.10.0.2/18]
      gateway4: 10.10.0.1
  version: 2

For r1:

network:
  ethernets:
    enp0s3:
      dhcp4: false
      addresses: [10.10.0.1/18]
    enp0s8:
      dhcp4: false
      addresses: [10.100.0.11/16]
  version: 2

For r2:

network:
  ethernets:
    enp0s3:
      dhcp4: false
      addresses: [10.100.0.12/16]
  version: 2

CodePudding user response:

IPv4 forwarding is not enabled on r1, and MASQUERADE NAT will have to be enabled on the gateway interface (enp0s3 on r1)

  •  Tags:  
  • Related