I am currently working in my gns3 lab on ospf and I have connected my routers to the real world virtual network. What is real world virtual network? I am running gns3 on vms using kvm+libvirt+virt-manager and created a network for them. Here I have connected gns3 to the vms network. Now the issue is I want to route networks. My vms network is default for libvirt which is 192.168.122.0/24 and gns3 network is 10.0.0.0/8. I run ospf on gns3 lab with network 0.0.0.0 0.0.0.0 area 0 command and injected default route for access vms network with ip route 0.0.0.0 0.0.0.0 192.168.122.1 . Now I want to route vms the gns3 network.
Route Add Syntax
To add route ip route command is used and ip route command have following syntax.
ip route add NETWORK via GATEWAY
- NETWORK is destination network where the packet will be send
- GATEWAY is first hop where packet will be forwarded.
This commands add route where 192.168.122.241 is my GNS3 lab router ip address
<strong>$ sudo ip route add 10.0.0.0/24 via 192.168.122.241</strong>
And I can ping from vms to the lab router interfaces
<strong>$ ping 10.3.0.2</strong>
PING 10.3.0.2 (10.3.0.2) 56(84) bytes of data.
64 bytes from 10.3.0.2: icmp_seq=1 ttl=254 time=0.657 ms
64 bytes from 10.3.0.2: icmp_seq=2 ttl=254 time=0.646 ms
64 bytes from 10.3.0.2: icmp_seq=3 ttl=254 time=0.525 ms
64 bytes from 10.3.0.2: icmp_seq=4 ttl=254 time=0.631 ms
64 bytes from 10.3.0.2: icmp_seq=5 ttl=254 time=0.566 ms
64 bytes from 10.3.0.2: icmp_seq=6 ttl=254 time=0.552 ms
64 bytes from 10.3.0.2: icmp_seq=7 ttl=254 time=0.621</code> ms
To remove added route from linux box use same as add by changing it del
<strong>$ sudo ip route del 10.0.0.0/24 via 192.168.122.241</strong>