0

As a part of an experiment, my network has the following topology for two host machines connected to a router in mininet(on Ubuntu 22.04.02 Virtual Machine)

     h1 - r1 - h2

The host Machine 'h1' has the following configuration: h1 ifconfig

The host Machine 'h2' has the following config: h2 ifconfig

The router r1 has the following config: r1 ifconfig

I am trying to setup the experimental topology such that both the hosts can access each other, which of course, is possible through configuring routing tables

I have taken the following steps:

On the router terminal(xterm):

    ifconfig r1-eth0 192.168.3.0 netmask 255.0.0.0  
    ip route add 192.168.0.0/24 dev r1-eth0   
    ip route add 192.168.1.0/24 dev r1-eth0 

On the h1 terminal (xterm)

    ifconfig h1-eth0 192.168.0.103 netmask 255.0.0.0
    ip route add 192.168.1.0/24 via 192.168.3.0
    route add default gw 192.168.3.0

On the h2 terminal (xterm)

    ifconfig h2-eth0 192.168.1.2 netmask 255.0.0.0
    ip route add 192.168.0.0/24 via 192.168.3.0
    route add default gw 192.168.3.0

The updated routing tables for h1, h2 and r1 are as follows:

h1 IP routes
h2 IP routes
r1 IP routes

When I try pinging h2 from h1 and vice versa I get destination host unreachable error.

where am I going wrong? Is there a step I have skipped? Any insight/help is appreciated.

P.S.: I would appreciate any good resources on static IP routing.

Zac67
  • 90,111
  • 4
  • 75
  • 141

1 Answers1

0

For routing to work, h1 and h2 need to be on separate subnets.

ifconfig h1-eth0 192.168.0.103 netmask 255.0.0.0

and

ifconfig h2-eth0 192.168.1.2 netmask 255.0.0.0

are on the same 192.0.0.0/8 subnet. Both try to ARP each other, failing due to lack of a common broadcast domain. Increase netmask to 255.255.255.0 = /24.

Also, the router needs to have two interfaces - one for facing and sharing a subnet with each host. The hosts need to use their respective router interface as default gateway. Generally, you can't have a (default) gateway that is outside of a host's subnet.

Zac67
  • 90,111
  • 4
  • 75
  • 141