Giter VIP home page Giter VIP logo

network-lab's Introduction

Various network related labs

I use those labs to test various stuff. Most of them are tailored to my need. The most recent ones are more likely to work than the older ones.

They are expected to run without being root on top of an up-to-date Debian sid. Some of them are using User-Mode-Linux, some other are using KVM.

lab-generic should always contain the latest iteration of the lab and be used as a base for other labs.

For labs exposing some serial console, you can use socat to connect:

socat $(tty),raw,echo=0 UNIX-CONNECT:/tmp/tmp.N3BTQ07qSG/vm-IOS1-serial2.pipe

Previously, labs were self-contained. This was done to avoid any breakage when introducing "new features". However, this didn't work as expected and labs become broken because of external changes (kernel changes, systemd changes, etc.). Therefore, new labs are now sourcing some common files (in common/). This means that older labs may broke due to more recent changes. In this case, get the latest commit for a lab (git log --oneline -1 lab-generic for example) and get a checkout for it (git checkout 22f22864632a).

This lab doesn't work on Ubuntu because they are missing VDE support in QEMU. The easiest way is to use schroot to work on a Debian Bookworm:

#!/bin/sh
sudo debootstrap bookworm bookworm
cat <<EOF | sudo tee /etc/schroot/chroot.d/lab
[lab]
type=directory
description=Network lab
directory=$PWD/bookworm
users=$USER
shell=$SHELL
profile=default
EOF
sudo schroot -c lab apt install --no-install-recommends \
    qemu-system-x86 sudo tmux busybox ssh vde2 python3 binutils \
    dosfstools mtools ansible jq linux-image-amd64 nginx rsyslog

You may need to uncomment /dev/shm line in /etc/schroot/default/fstab. You also have to add yourself to kvm group (sudo adduser $USER kvm). Then, run:

schroot -c lab ./setup /boot/$(schroot -c lab ls /boot | grep vmlinuz | head -1)

The ./setup script takes a Linux kernel as first argument. Have a look at eudyptula-boot's minimal-configuration script to compile a kernel that should work with the lab as well.

License

All the labs are distributed under the ISC license:

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Other tools

There exist many other tools to run network labs that may not be as hacky as this one:

  • CORE. It uses Linux network namespaces and provides a GUI tool. This is a very good tool. Please, have a look at it. It doesn't use disk images and the whole lab configuration fits into a single file that's easy to share. Integration with Quagga or BIRD is very good.

  • GNS3. It uses virtual machines and emulators to build the network. It also comes with a GUI tool. You can emulate Cisco, Juniper, Arista and other brands network equipments. However, it relies heavily on disk images for anything else than Cisco devices and it makes it harder to share your work on GitHub.

You will find a more comprehensive list (with tests) on Brian Linkletter's blog.

network-lab's People

Contributors

0x7f454c46 avatar vincentbernat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

network-lab's Issues

Possible update idea on your article about multi-tier-loadbalancer (lab-3tier-lb) ?!

Hi, your article are very interesting, he had inspiring me about.
https://vincent.bernat.ch/fr/blog/2018-repartiteur-charge-multi-niveaux

I've tryed differente solution about what you explain, ipvs, katran, github lb director, google seesaw, keepalived, and ....
i've tested cilium overley with k8s that implemente L4 load balacing DSR with maglev with eBPF/XDP and BGP Load balancing in one solution.

His make possible to implemente what you explain in your article, with K8S simple object with kubectl apply (support Load Balancer service type).

They use of k8s make possible to implemente the LB L7 in distributed maner (haproxy, nginx, envoy or what you whant as pod)...
and make possible to scale also on BGP and L4 level dynamicly... you add kubernetes nodes and L4/BGP grow... you add node and L7 can grow...

All are industrialized thanks to kubernetes (dynamic cluster grow at each level).

Plus cilium not use full ip (like GRE/GUE/Foo-Over-UDP/Geneve, etc...) encapsulation between L4 and L7, they use simple SNAT/DNAT in setting the destination IP (VIP) in TCP options field... in distributed way without storing state anywhere... this field are used to DNAT in output of the L4 to the real ip of the L7 pod, and SNAT in the output of the pod to respond directly to the client... all are done with eBPF by cilium...

You can also use kube router + metallb to do the same but not with the same performence (kube router use ipvs for LB L4 DSR in place of eBPF/XDP), and with ip encapsulation...

And linux IPVS support DSR with maglev algorithme since linux kernel 4.18.

I think that while be interesting to update your article with this solutions !?

I've made a test bed with vagrant on my github :
https://github.com/mcarbonneaux/vagrant-kubeadm-cluster-mca

overlayfs does not seem to exist on Debian unstable

$ mount -t overlayfs overlayfs /tmp/target/overlay -o lowerdir=/,upperdir=/tmp/target/rw

I don't seem to be able to get this command on Debian unstable working, it always results in the following error message:

"mount: unknown filesystem type 'overlayfs'"

Using aufs works fine for me though:

$ mount -t aufs -o br=/tmp/target/rw:/ none /tmp/target/overlay

No route to host?

root@users:/mnt/lab# curl -v --interface 203.0.113.184 198.51.100.1

* Expire in 0 ms for 6 (transfer 0x55bbcc2cb7a0)
*   Trying 198.51.100.1...
* TCP_NODELAY set
* Name '203.0.113.184' family 2 resolved to '203.0.113.184' family 2
* Local port: 0
* Expire in 200 ms for 4 (transfer 0x55bbcc2cb7a0)
* connect to 198.51.100.1 port 80 failed: No route to host
* Failed to connect to 198.51.100.1 port 80: No route to host
* Closing connection 0
curl: (7) Failed to connect to 198.51.100.1 port 80: No route to host

something wrong?

Unclear license

Hi Vincent,

I am considering to use your uml-network-lab code and adapt it to setup a regression test suite for smcroute. However, I would like to know under what license terms I can make use of your code. Can you please provide a license for all your scripts, e.g. in a COPYING file in the project's root directory?

Thanks a lot in advance,
Micha Lenk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.