User Tools

Site Tools


virtualization:netsim

This is an old revision of the document!


Netlab is an great opensource project for easy deployment of network labs, initiated and managed by Ivan Pepelnjak. Here's just some of my notes about installation and operation:

The application is installed in /usr/local/lib/python3.10/dist-packages/netsim. There you can find files like /defaults/addressing.yml where we can customize ips or change them to ipv6


The below process is for bare metal server in equinix metal but is easily extrapolatable to other bare metal env.

! Be sure you create the instance with Ubuntu LTS
! Manually
scp image
! 
! Via 'user data'
#!/bin/bash
apt remove needrestart -y 
apt-get update -y 
apt install python3-pip -y 
python3 -m pip install netsim-tools
!
! APPLY THIS MANUALLY
netlab install ubuntu ansible libvirt -y
usermod -a -G libvirt $USER
echo 'user = "root"' >> /etc/libvirt/qemu.conf
echo 'group = "root"' >> /etc/libvirt/qemu.conf
service libvirtd restart
netlab libvirt package eos vEOS-lab-4.28.0F.vmdk
! Manually: follow recipe here and box is automatically added: LINK AT THE BOTTOM!
git clone https://github.com/jotasantos/netsim-labs.git
git clone git@github.com:jotasantos/ansible.git
!
! create topology file..
netlab up  

https://softbackbone.duckdns.org/doku.php?id=virtualization:containerlab:veosinitial
https://softbackbone.duckdns.org/doku.php?id=virtualization:containerlab:csr100vinstall

LIFECYCLE NETLAB PROJECT - LIBVIRT ! First use

netlab up
!! work on the lab
netlab collect
netlab down

Here I come back to work on the lab

vagrant up
netlab initial
ansible-playbook -i hosts.yml pusheos.yml
!! work in the lab 
netlab collect
git add,commit.push
netlab down

Containerlab saves automatically the nodes configuration. If we want versioning control on out lab we can push the content to github. Nowever this uses quite a lot of space. We can prevent git to push the nodes configuration with the .gitignore below. If we need to share the devices configuration, use the command with tarball also below to save/share configs:

cat .gitignore
**/archive/
**/schedule/
**/flash/
**/.vagrant/
vault.key
.Python
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
.env
pip-selfcheck.json
! This to save all the containerlab configs at once:
netlab clab tarball

—-

TROUBLESHOOTING

virsh net-dhcp-leases --network vagrant-libvirt    # this is to see the dhcp leases for given by libvirt for management
cat /var/lib/libvirt/dnsmasq/virbr0.*  
vim /etc/libvirt/qemu/networks/vagrant-libvirt.xml  

Now manage Cumulus-VX instances:

netsim multicast lab

sudo vtysh / sh run / wr
sudo vi /etc/frr/daemons  # enable pim
sudo systemctl restart frr
sudo vtysh
! paste the saved configuration (twice, for ospf)
wr
interface swp1
ip pim
interface swp2
ip pim
interface swp3
ip pim
interface swp4
ip pim
exit
wr

NEXUS

# Download image from cisco: site nexus9300v.9.3.5.box
vagrant box add nexus9300v.9.3.5.box --name cisco/nexus9300v
vagrant mutate cisco/nexus9300v libvirt
virtualization/netsim.1679944949.txt.gz · Last modified: (external edit)