This page looks best with JavaScript enabled

GNS3 on FreeBSD using Kali/CBSD

 ·  🎃 kr0m

The easiest way to get GNS3 working on FreeBSD is by virtualizing a Kali machine, for which we will launch a VM using CBSD and install everything necessary on it.

The first step will be to install all the necessary software, part of the software is available from Kali’s repositories, another will be installed from Pip and finally the ubridge utility will be compiled manually:

apt install -y libpcap-dev python3-pip python3-pyqt5 python3-pyqt5.qtsvg python3-pyqt5.qtwebsockets qemu qemu-kvm qemu-utils libvirt-clients libvirt-daemon-system virtinst apt-transport-https ca-certificates curl gnupg2 software-properties-common dynamips xterm telnet
pip3 install gns3-server gns3-gui
git clone https://github.com/GNS3/ubridge.git
cd ubridge
make
make install
ls -la /usr/local/bin/ubridge

-rwxr-xr-x 1 root root 121224 oct 17 20:16 /usr/local/bin/ubridge

We copy the IOS images to the Kali VM:

scp -r /mnt/2T/ios/ kr0m@192.168.69.99 :/home/kr0m/GNS3/images/

We authorize the Kali IP to be able to launch applications locally over the network, we connect via SSH and launch GNS3 remotely:

xhost +inet:192.168.69.99
ssh -vYC kr0m@192.168.69.99 gns3

We are going to configure some GNS3 parameters, for which we access the preferences through:

Edit -> Preferences

We configure the Dynamips binary path:

We load the IOS images we need:

When selecting the image, it may ask us for confirmation to decompress it, we accept:





We do not configure the idle-pc value since GNS3 is buggy and it does not work. We will do it later once the router has been added to the diagram.


Now we can add the newly configured router from the left-hand side to our diagram:

Start it:

Right-click -> Start

Now generate the idle-pc:

Right-click -> Autoidle-pc

To access the console, we would have to do right-click -> Console, but since we are running the application through SSH, it will not open the xterm corresponding to that action. We must access the Kali through SSH and manually connect to the console port. The range of ports to use is defined in the GNS3 preferences:

In the GNS3 interface, we can see which port has been assigned to each router:

We access Kali and connect to the console socket:

ssh kr0m@192.168.69.99
telnet 127.0.0.1 5000

Where we can see the router booting:

Connected to Dynamips VM "R1" (ID 1, type c3600) - Console port  
Press ENTER to get the prompt.  
ROMMON emulation microcode.  
Launching IOS image at 0x80008000...  
Smart Init is disabled. IOMEM set to: 5    
Using iomem percentage: 5  
    
Restricted Rights Legend  
  
Use, duplication, or disclosure by the Government is  
subject to restrictions as set forth in subparagraph  
(c) of the Commercial Computer Software - Restricted  
Rights clause at FAR sec. 52.227-19 and subparagraph  
(c) (1) (ii) of the Rights in Technical Data and Computer  
Software clause at DFARS sec. 252.227-7013.  
  
           cisco Systems, Inc.  
           170 West Tasman Drive  
          San Jose, California 95134-1706  
  
Cisco IOS Software, 3600 Software (C3660-I-M), Version 12.4(13b), RELEASE SOFTWARE (fc3)  
Technical Support: http://www.cisco.com/techsupport  
Copyright (c) 1986-2007 by Cisco Systems, Inc.  
Compiled Tue 24-Apr-07 21:18 by prod_rel_team  
Image text-base: 0x60008E5C, data-base: 0x60FE0000  
  
Cisco 3660 (R527x) processor (revision 1.0) with 187392K/9216K bytes of memory.  
Processor board ID FTX0945W0MY  
R527x CPU at 250MHz, Implementation 40, Rev 1.2, 512KB L2 Cache  
  
  
3660 Chassis type: ENTERPRISE  
2 FastEthernet interfaces  
DRAM configuration is 64 bits wide with parity enabled.  
253K bytes of NVRAM.  
8192K bytes of processor board System flash (Read/Write)  
  
Press RETURN to get started!

We run a simple command to check that it works correctly:

R1#show version

Cisco IOS Software, 3600 Software (C3660-I-M), Version 12.4(13b), RELEASE SOFTWARE (fc3)  
Technical Support: http://www.cisco.com/techsupport  
Copyright (c) 1986-2007 by Cisco Systems, Inc.  
Compiled Tue 24-Apr-07 21:18 by prod_rel_team  
  
ROM: ROMMON Emulation Microcode  
ROM: 3600 Software (C3660-I-M), Version 12.4(13b), RELEASE SOFTWARE (fc3)  
  
R1 uptime is 0 minutes  
System returned to ROM by unknown reload cause - suspect boot_data[BOOT_COUNT] 0x0, BOOT_COUNT 0, BOOTDATA 19  
System image file is "tftp://255.255.255.255/unknown"  
  
Cisco 3660 (R527x) processor (revision 1.0) with 187392K/9216K bytes of memory.  
Processor board ID FTX0945W0MY  
R527x CPU at 250MHz, Implementation 40, Rev 1.2, 512KB L2 Cache  
  
3660 Chassis type: ENTERPRISE  
2 FastEthernet interfaces  
DRAM configuration is 64 bits wide with parity enabled.  
253K bytes of NVRAM.  
8192K bytes of processor board System flash (Read/Write)  
  
Configuration register is 0x2102

Let’s give the router a network through a “cloud”:

We connect the fastEthernet0/0 interface to the cloud’s eth0 using the “Add link” element:

We configure the router:

R1#conf terminal

Enter configuration commands, one per line.  End with CNTL/Z.  
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 192.168.69.100 255.255.255.0 
R1(config-if)#no shutdown
*Mar  1 00:02:02.419: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up  
*Mar  1 00:02:03.419: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up  
R1(config-if)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.69.200

We check that the network works up to the Internet:

R1(config)#end
R1#ping 8.8.8.8

Type escape sequence to abort.  
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:  
!!!!!  
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/29/32 ms

We must be careful with the images we load, if the IOS image is corrupt it can cause problems, especially when we save the configuration. If we do, Dynamips crashes completely with the following error:

C3600 ‘Ghost’: generic_nvram_extract_config: Unknown error -61605

If you liked the article, you can treat me to a RedBull here