In this article, we will use a variety of technologies to simulate practically any network scenario we need. GNS3 is a very complete network simulator, Dynamips is a Cisco hardware emulator, QEmu is a processor emulator and virtualization software, and VirtualBox is virtualization software.
In this scenario, we will use a Cisco router, a Mikrotik router, and two Gentoo virtual machines that will act as hosts. Having real virtual machines will allow us greater flexibility and the ability to test any type of attack/exploit on Mikrotik or Cisco routers.
There will be 3 networks:
- Between Gentoo-1 and the Mikrotik router: 192.168.2.0/24
- Between the Mikrotik router and the Cisco router: 192.168.1.0/24
- Between the Cisco router and Gentoo-3: 192.168.3.0/24
We install everything we need:
To link the GNS3 network architecture with the VBox virtual machines, we will use
ubridges
. We add the user who will run the VBox, GNS3, and Qemu software to the ubridge group:
We start GNS3:
We configure the ubridge binary path:
Edit -> Preferences -> Server -> Ubirdge path:
/usr/bin/ubridge
We create the Qemu and VirtualBox virtual machines in the config so that they will appear as available in the menu of available network elements:
Edit -> Preferences -> Qemu -> Qemu VMs:
New
Edit -> Preferences -> VirtualBox -> VirtualBox VMs:
New
We create a 1G disk image where we will install Mikrotik’s RouterOS:
We download the RouterOS installation image from the Mikrotik website:
https://mikrotik.com/download/archive
We boot from the ISO and install the OS and tools:
We boot the router from the hard disk:
We log in to the router:
admin
ENTER
We configure the two interfaces and let it know through static routing that the 192.168.3.0/24 network is accessible through 192.168.1.2:
/ip address
add address=192.168.1.1/24 interface=ether1 network=192.168.1.0
add address=192.168.2.1/24 interface=ether2 network=192.168.2.0
/ip route add dst-address=192.168.3.0/24 gateway=192.168.1.2
We configure the two interfaces on the Cisco router and let it know through static routing that the 192.168.2.0/24 network is accessible through 192.168.1.1:
Cisco3640c3640#configure terminal
Cisco3640c3640(config)#interface FastEthernet0/0
Cisco3640c3640(config-if)#ip address 192.168.1.2 255.255.255.0
Cisco3640c3640(config-if)#no shutdown
Cisco3640c3640(config-if)#exit
Cisco3640c3640(config)#interface fastEthernet1/0
Cisco3640c3640(config-if)#ip address 192.168.3.1 255.255.255.0
Cisco3640c3640(config-if)#no shutdown
Cisco3640c3640(config-if)#exit
Cisco3640c3640(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.1
Cisco3640c3640(config)#end
Cisco3640c3640#copy running-config startup-config
NOTE: When adding VirtualBox virtual machines from GNS3 (dragging from the left), they will have the network config with ubridge.
We configure the IP and GW of the first Gentoo:
route add -net 192.168.2.0/24 dev enp0s3
route add default gw 192.168.2.1
We configure the IP and GW of the second Gentoo:
route add -net 192.168.3.0/24 dev enp0s3
route add default gw 192.168.3.1
Now both networks are routed and fully accessible.