Following GNS3 networking access scenario:
A dual homed guest (virtual machine) with two physical network interfaces, 2 NIC's:
* eth0
IP point to point interface, connected to the real world (192.0.2.2/30)
* eth1
IP network interface, connected to virtual world (10.1.1.2/24)
Using the 192.0.2.0/30
IP point to point interface, access the running HTTP webserver on GNS3 appliance (in that case it is cacti).The HTTP access works, using a HTTP browser, from the physical host
where GNS3 is running, via IP interface, to the virtual GNS3 guest
running in the GNS3 topology.
Solution 1 (not working)
Initial idea, this could be done via binding the HTTP (IP Port 80) service to hosts
lo (linux IP loopback) interface:
physical
host
- IP 127.0.0.1
- TCP port 1080
virtual GNS
guest
- 192.0.2.2
- TCP Port 80
Accessing on the host the HTTP address:
http://127.0.0.1:1080/
Would be forwarded to the guest:
http://192.0.2.2:80/
And one could access the cacti application in the guest (VM) without explicit assign of a IP address.
This did not work that way. Maybe due to the dual home attached guest (VM) and it possibly received the http access on one physical interface, and for the way back out it look up its own routing table and forwarded it via the default route pointing to eth0. No TCP session has been established.
Here the problem was there was no point to point interface on the host, it has been lacking the 192.0.2.1/30 virtual interface.
Solution 2 (not working)
Creating a loopback1 interface on physical host
Add an IP address to virtual interface on host
Set loopback1 interface in no shut
In GNS3 take a cloud device (I do not like this cloud device name, since it is a virtual IP interface) and connect it physically from this cloud to the guest physical interface eth0.
This did not work as well. Even if it is a IP point-to-point interface. No ICMP Echo vice versa. From host to guest, and from guest to host.
Solution 3 (working)
3rd solution, and this one a working one. On the host crate a tap interface (tap0 layer2 interface), assign an IP address, and bring it up:
This is where the solution has been described (it is not entirely true it is a loopback interface), but this solution with tap interace is working
Connect host to GNS3 guest
In the GNS3 application take a cloud device and add it to the topology. Configure the settings of cloud device, choose to the register tap, dd the host created tap0 interface to it.
Finally connect the guests network interface f.e. eth0 to the cloud tap0 interface. IP point to point configuration has been created.
Verify the guest has a correct IP address on the eth0 interface:
Add a IP routing table entry for the IP network on the guest:
This way a working IP point to point configuration from the physical host to the guest running in the GNS3 topology, has been configured.
IP access to the GNS3 topology
To access all topology routers via IP pointo-to-point link to test ansible/puppet/chef automation tools in the GNS3 topology.
Before heading further that in this kind of access from the host to the guest network, note that the point of attachment to the guest network plays a major role. Also the transfer network used 192.0.2.0/30
has to be routed in your GNS topology.
Change the link from the cloud to a IP router in that case R1.
In the topology is assumed a dynamical routing protocol is running RIP/OSPF/IS-IS/EIGRP/BGP. In this case OSPF is running at R1-R3.
Adjust the interface G1/0 IP configuration R1
conf t
!
interface Gi1/0
ip address 192.0.2.2 255.255.255.252
ip ospf 1 area 0
no shut
end
wr
Add a IP route on the host
to the guest
network via IP interface tun0
The IP network used in the GNS3 topology 10.0.0.0/8
is known to the host via the 192.0.2.1 tap0, IP point-to-point interface.
The host network is 192.168.178.0/24
in the example.
default via 192.168.178.1 dev eth0 proto dhcp src 192.168.178.101 metric 3 192.168.178.0/24 dev eth0 proto dhcp scope link src 192.168.178.101 metric 3 10.0.0.0/8 via 192.0.2.2 dev tap0 127.0.0.0/8 via 127.0.0.1 dev lo 192.0.2.0/30 dev tap0 proto kernel scope link src 192.0.2.1
IP routed access from host to guest network. Without using any IP-NAT crippled solutions. Pure IP routing.