The old name was a bit too long.
-/linux-network-namespace-labs
+/lnnl
= README
-linux-network-namespace-labs is a small program to easily create networking
-lab setups based on Linux network namespaces. It provides a quick way to set
-up labs using a text file describing the architecture (networks, nodes, links,
-commands). This is much simpler than running each node in a separate virtual
-machine or manually allocating the IP addresses for each node. It is licensed
-under GPLv3+.
+linux-network-namespace-labs (lnnl) is a small program to easily create
+networking lab setups based on Linux network namespaces. It provides a quick
+way to set up labs using a text file describing the architecture (networks,
+nodes, links, commands). This is much simpler than running each node in a
+separate virtual machine or manually allocating the IP addresses for each
+node. It is licensed under GPLv3+.
== Requirements
$ go build
-Then copy the binary `linux-network-namespace-labs` to a directory in your
-`$PATH`.
+Then copy the binary `lnnl` to a directory in your `$PATH`.
== Usage
Then set up the lab by running (as root):
# cd examples/readme
- # linux-network-namespace-labs up lab.conf
+ # lnnl up lab.conf
[...]
Now you can enter the network namespace of each router and test a simple
When you change the configuration you can simply rerun "up" and it will remove
the lab (and kill all processes inside it) before restarting it:
- # linux-network-namespace-labs up lab.conf
+ # lnnl up lab.conf
[...]
When you're done you can remove the lab with:
- # linux-network-namespace-labs down lab.conf
+ # lnnl down lab.conf
[...]
To get an overview of the network you can create a
https://en.wikipedia.org/wiki/DOT_(graph_description_language)[DOT] file:
- $ linux-network-namespace-labs dot lab.conf lab.dot
+ $ lnnl dot lab.conf lab.dot
$ dot -Tpng lab.dot > lab.png
image::examples/readme/lab.png[DOT style diagram of network nodes and links]
# No `cd` here to test that relative paths work
-linux-network-namespace-labs up "$examples/bird-ospf/lab.conf"
+lnnl up "$examples/bird-ospf/lab.conf"
# Wait until OSPF is ready
wait_for_route r1 3fff::1
wait_for_route r1 3fff::2
ip netns exec r1 ping -c1 r1-loop
ip netns exec r1 ping -c1 r2-loop
ip netns exec r1 ping -c1 r3-loop
-linux-network-namespace-labs down "$examples/bird-ospf/lab.conf"
+lnnl down "$examples/bird-ospf/lab.conf"
test -z "$(ip netns)"
test "$(cd /etc/netns; find)" = "." # directory empty
cd "$examples/layer3"
-linux-network-namespace-labs up lab.conf
+lnnl up lab.conf
ip netns exec r1 ip route add 3fff::1/128 dev r2
ip netns exec r1 ping -c1 3fff::1
-linux-network-namespace-labs down lab.conf
+lnnl down lab.conf
test -z "$(ip netns)"
test "$(cd /etc/netns; find)" = "." # directory empty
./run.sh
wait_for_route r1 3fff::1
ip netns exec r1 ping -c1 r1-loop
-linux-network-namespace-labs down lab.conf
+lnnl down lab.conf
test -z "$(ip netns)"
test "$(cd /etc/netns; find)" = "." # directory empty
cd "$examples/readme"
-linux-network-namespace-labs up lab.conf
+lnnl up lab.conf
ip netns exec r1 ping -c1 r1-loop
ip netns exec r1 ping -c1 r2-loop
ip netns exec r1 ping -c1 r3-loop
-linux-network-namespace-labs down lab.conf
+lnnl down lab.conf
test -z "$(ip netns)"
test "$(cd /etc/netns; find)" = "." # directory empty
To start the lab use (as root):
- # linux-network-namespace-labs up lab.conf
+ # lnnl up lab.conf
You can use the following shell function to connect to the bird running on the
current node:
To stop the lab use:
- # linux-network-namespace-labs down lab.conf
+ # lnnl down lab.conf
-# Start lab with: linux-network-namespace-labs up lab.conf
+# Start lab with: lnnl up lab.conf
# r1 <-> r2 <-> r3
Then start the lab (as root) with:
- # linux-network-namespace-labs up lab.conf
+ # lnnl up lab.conf
To enter the node use:
To stop the lab use:
- # linux-network-namespace-labs down lab.conf
+ # lnnl down lab.conf
-# Start lab with: linux-network-namespace-labs up lab.conf
+# Start lab with: lnnl up lab.conf
# r1 <-> r2
To stop the lab use:
- # linux-network-namespace-labs down lab.conf
+ # lnnl down lab.conf
podman_stop r1 || true
podman_stop r2 || true
-linux-network-namespace-labs up lab.conf
+lnnl up lab.conf
podman_run r1
podman_run r2
-# Start lab with: linux-network-namespace-labs up lab.conf
+# Start lab with: lnnl up lab.conf
# Network range for loopback addresses of the nodes
-module linux-network-namespace-labs
+module lnnl
go 1.26