Skip to content

Month: May 2022

Create your own virtual lab with Netsim Tools – Installation

How do you know your change won’t cause problems to network? Traditional network engineering relies on robust Change Review processes plus CCIE-level knowledge combined with smart-hands to ensure that. More modern approaches aim to solve this problem with a DevOps mindset that would include multiple layers of testing.

In Networking it’s very expensive to have an environment like production for testing. One possible approach is having some type of a virtual networking lab. We’ve been playing around with an opensource tool called Netsim-tools and below we give an overview of the tool and describe the installation process.

Netsim-tools is bringing IAC to your networking labs. Instead of wasting time creating lab topology in a GUI and configuring boring details, you’ll start with a lab preconfigured according to your specifications. Netsim allows you to:

  • Describe high-level lab topology in YAML format without worrying about the specific implementation details
  • Use the same lab topology with multiple virtualization providers (Virtualbox, KVM/libvirt, Docker containers)
  • Create Vagrant configuration files and Ansible inventory from the lab topology

In a future post, we will create an actual topology, for now, let’s focus on the installation procedure.

  • Arista vEOS
  • Cisco IOSv
  • Cisco CSR 1000v
  • Cisco Nexus 9300v
  • Cumulus Linux
  • Cumulus Linux 5.0 (NVUE)
  • Fortinet FortiOS
  • FRR 7.5.0
  • Generic Linux host
  • Juniper vSRX 3.0
  • Mikrotik CHR RouterOS
  • Nokia SR Linux
  • Nokia SR OS
  • VyOS
  • Dell OS10

Read more about supported devices in:
netsim-tools.readthedocs

Installation

Now, let’s install the Netsim. The install process are automated, you can copy and paste this script on your Ubuntu 20.04, but some requirements are indispensable:

Server requeriments:
• 4 CPUs
• 8 GB MEM
• 64 GB Disk
• Ansible
• Python3 with pip

Please read the comments and adjust to yours needs, but if you have a new server or if you can remove old versions of Python and Ansible, maybe be the better way.

Installation with Ansible:

# you can copy/paste and run all this text.
# you can choose not update your system and Python
# but we recommend to do this to avoid some troubles with Ansible

# can you update your system? uncomment this step
# apt update && apt -y upgrade && apt -y autoremove

# can you update your Python? uncomment these two step under
# apt remove -y python3 ansible ansible-core 
# apt install python3-pip

# adjust the step "ADJUSTING TIME TO AVOID ISSUE" to your timezone if the script do not work

# Update your pip and install Ansible to run de playbook
pip install --upgrade pip
pip install ansible ansible-core

# create playbook in netsim-install.pb file
cat > netsim-install.pb << EOF
---
- hosts: localhost
  gather_facts: no
  tasks:
    - name: "[ UPDATING SYSTEM PACKAGES ]"
      apt:
        update_cache: yes
        upgrade: full
        autoremove: yes
      register: aptout

    - name: "[ INSTALLING DEPENDENCIES OF NETLAB ]"
      apt:
        name: "{{ pkgs }}"
        state: present
      vars:
        pkgs:
          - python3-pip
          - vagrant-libvirt

    - name: "[ UPDATING PIP ]"
      shell:
        cmd: "pip install --upgrade pip"

    - name: "[ INSTALLING NETSIM-TOOL WITH PIP  ]"
      pip:
        name: "netsim-tools"

    - name: "[ INSTALLING NETLAB PACKAGES ]"
      shell:
        cmd: "netlab install -y ubuntu ansible libvirt containerlab"

    - name: "[ ADJUSTING TIME TO AVOID ISSUES ]"
      shell:
        cmd: "timedatectl set-timezone $(cat /etc/timezone) && timedatectl --adjust-system-clock"

    - name: "[ TESTING KVM LIBVIRT SUPPORT ]"
      shell:
        cmd: "kvm-ok"
      register: kvmout
      ignore_errors: True

    - debug:
        msg: "{{ kvmout }}"
EOF
# run the PB and run the netlab test if PB pass
ansible-playbook ./netsim-install.pb && netlab test libvirt

We really expect that you reach theses objectives and get something like this:

When Netsim(netlab) script finishs, automatically the lab its detroyed, evidencing that all requirements are done. Well, its that all, good run and enjoy!

fonts:
https://github.com/ipspace/netsim-tools
https://netsim-tools.readthedocs.io

Leave a Comment