source /opt/raizo/api/Add-to-GNS3.sh
To modify the created config of VM
To add config of VM to GNS3
You must create the md5sum file of the hard disk before to call Add-ConfigVM-to-GNS3
To create a specific network configuration
To modify a specific network configuration created with Create-NetworkConfig
To add a specific network configuration created with Create-NetworkConfig to a VM config created with Create-VMQEmu or Create-VMDocker
OPTION_QEMU : Option to use with Create-VMQEmu : To add options to the QEmu VM
if a variable is unset, the functions initialise it to this default value.
To create the configuration of a Qemu VM
This function returns the name of the temporary file to use with Add-ConfigVM-to-GNS3
#!/usr/bin/bash
source /opt/raizo/api/Add-to-GNS3.sh
if (( $? ))
then
return
fi
DIR_VDI="/media/usb0/vdi"
# Windows Server 2019
SYMBOL_QEMU="/symbols/raizo/microsoft_server.svg"
# On Processor AMD Ryzen, you should perhaps add :
# OPTION_QEMU="-cpu pentium2"
ConfigVM=$(Create-VMQEmu Win2019 1 2048 spice false "${DIR_VDI}/windows-2019-server.vhd")
if [ -n "${ConfigVM}" ]
then
Add-ConfigVM-to-GNS3 "${ConfigVM}"
fi
#!/usr/bin/bash
source /opt/raizo/api/Add-to-GNS3.sh
if (( $? ))
then
return
fi
DIR_VDI="/media/usb0/vdi"
SYMBOL_QEMU="/symbols/raizo/microsoft_guest.svg"
# On Processor AMD Ryzen, you should perhaps add :
# OPTION_QEMU="-cpu pentium2"
ConfigVM=$(Create-VMQEmu Win10 1 1024 spice false "${DIR_VDI}/windows-10.vdi")
if [ -n "${ConfigVM}" ]
then
NetworkConfig=$(Create-NetworkConfig 1 "loc-area-con-" e1000)
Modify-NetworkConfig "${NetworkConfig}" 0 port_name "loc-area-con-2"
Add-NetworkConfig-to-VM "${ConfigVM}" "${NetworkConfig}"
Add-ConfigVM-to-GNS3 "${ConfigVM}"
fi
#!/usr/bin/bash
source /opt/raizo/api/Add-to-GNS3.sh
if (( $? ))
then
return
fi
DIR_VDI="/media/usb0/vdi"
SYMBOL_QEMU="/symbols/raizo/hacker.svg"
TYPE_HARD_DISK="IDE"
# OPTION_QEMU_9P_HOSTHOME : Use 9P to share /home/user via hosthome : mount -t 9p hosthome /mnt
# OPTION_QEMU_VWIFI : To use the virtual wifi after installing and running vwifi-client from https://github.com/Raizo62/vwifi
OPTION_QEMU="${OPTION_QEMU_9P_HOSTHOME} ${OPTION_QEMU_VWIFI}"
ConfigVM=$(Create-VMQEmu KaliLinux 2 1024 spice false "${DIR_VDI}/linux-kali-2022.3-amd64.vmdk")
if [ -n "${ConfigVM}" ]
then
Add-ConfigVM-to-GNS3 "${ConfigVM}"
fi
unset TYPE_HARD_DISK OPTION_QEMU SYMBOL_QEMU
#!/usr/bin/bash
source /opt/raizo/api/Add-to-GNS3.sh
if (( $? ))
then
return
fi
DIR_VDI="/media/usb0/vdi"
TYPE_HARD_DISK='ide'
SYMBOL_QEMU='/symbols/asa.svg'
OPTION_QEMU='-no-kvm -icount auto'
ConfigVM=$(Create-VMQEmu ASA 6 1024 telnet false "${DIR_VDI}/ASA/FLASH")
if [ -n "${ConfigVM}" ]
then
Modify-ConfigVM "${ConfigVM}" initrd "${DIR_VDI}/ASA/asa842-initrd.gz"
Modify-ConfigVM "${ConfigVM}" kernel_command_line 'ide_generic.probe_mask=0x01 ide_core.chs=0.0:980,16,32 auto nousb console=ttyS0,9600 bigphysarea=65536 ide1=noprobe no-hlt -net nic'
Modify-ConfigVM "${ConfigVM}" kernel_image "${DIR_VDI}/ASA/asa842-vmlinuz"
Modify-ConfigVM "${ConfigVM}" port_name_format 'GigaEthernet{0}'
Modify-ConfigVM "${ConfigVM}" category 'firewall'
Add-ConfigVM-to-GNS3 "${ConfigVM}"
fi
unset TYPE_HARD_DISK OPTION_QEMU SYMBOL_QEMU
SYMBOL_DOCKER : To change the default symbol of the Docker device in GNS3
if you unset a variable, the functions initialise it to this default value.
To add a folder to the list of persistent folders of the Docker VM
To create the configuration of a Docker VM
This function returns the name of the temporary file to use with Add-ConfigVM-to-GNS3
#!/usr/bin/bash
source /opt/raizo/api/Add-to-GNS3.sh
if (( $? ))
then
return
fi
# alpine :
docker pull alpine
SYMBOL_DOCKER="/symbols/computer.svg"
ConfigVM=$(Create-VMDocker alpine "alpine:latest" 1 telnet)
if [ -n "${ConfigVM}" ]
then
Add-PersistentFolder-to-VMDocker "${ConfigVM}" "/etc/ssl"
Add-ConfigVM-to-GNS3 "${ConfigVM}"
fi
#!/usr/bin/bash
source /opt/raizo/api/Add-to-GNS3.sh
if (( $? ))
then
return
fi
cat > "c7200.gns3" <<EOF
{
"name": "c7200",
"default_name_format": "R{0}",
"usage": "ConsoleType=Cisco",
"image": "c7200-advipservicesk9-mz.152-4.S5.bin",
"symbol": ":/symbols/router.svg",
"category": "router",
"startup_config": "/opt/raizo/user/Config/GNS3/configs/Raizo_ios_base_startup-config.txt",
"private_config": "",
"console_type": "telnet",
"console_auto_start": false,
"platform": "c7200",
"idlepc": "0x62cf0330",
"idlemax": 500,
"idlesleep": 30,
"exec_area": 64,
"mmap": true,
"sparsemem": true,
"ram": 512,
"nvram": 512,
"mac_addr": "",
"disk0": 0,
"disk1": 0,
"auto_delete_disks": true,
"system_id": "FTX0945W0MY",
"compute_id": "local",
"slot0": "C7200-IO-FE",
"slot1": "PA-2FE-TX",
"slot2": "",
"slot3": "",
"slot4": "",
"slot5": "",
"slot6": "",
"midplane": "vxr",
"npe": "npe-400",
"template_id": "8b3b55a3-3644-4fc9-a494-b525165a2603",
"template_type": "dynamips",
"builtin": false
}
EOF
cp "c7200.gns3" /tmp/c7200.gns3
Add-ConfigVM-to-GNS3 /tmp/c7200.gns3