.\" Automatically generated by Pandoc 3.1.3 .nh .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. .ie "\f[CB]x\f[]"x" \{\ . ftr V B . ftr VI BI . ftr VB B . ftr VBI BI .\} .el \{\ . ftr V CR . ftr VI CI . ftr VB CB . ftr VBI CBI .\} .TH "vnetbuild" "1" "Built 30 Mar 2024" "VNetBuild Reference" "3.1.7" .hy .SH NAME .PP vnetbuild - an easy to use but powerful namespace setup tool .SH SYNOPSIS .PP sudo vnetbuild \f[I]CONFIGFILE\f[R] { start | stop | status } .PP vnetbuild \f[I]CONFIGFILE\f[R] graphviz \f[I]OUTFILE\f[R].{gv|png|pdf|ps} .SH DESCRIPTION .PP VNetBuild is a program that helps you set up groups of interconnected network namespaces, to simulate networks of any complexity without resorting to using real or virtual machines. .PP This is ideal for testing complex multi-host configurations with a minimal amount of resources on a single machine: .IP \[bu] 2 Each namespace can have its own network setup, including firewall and QOS configuration. .IP \[bu] 2 Commands can be run in the namespace and will have that specific view of the network, including running standard network tools and daemons. .PP Run without any arguments, \f[V]vnetbuild\f[R] will present some help on usage. .SH COMMANDS .TP start Sets up a series of network namespaces as defined in \f[I]CONFIGFILE\f[R]. \f[V]vnetbuild\f[R] creates interconnected network devices as specified in the configuration, sets up routing and runs any custom commands that are given within the namespace. .TP stop Removes any devices from the namespaces defined in \f[I]CONFIGFILE\f[R] and kills any processes running with the namespaces, then removes the namespaces themselves. .TP status For each namespace defined in \f[I]CONFIGFILE\f[R], shows if it is active and if so its network devices and their configuration. .TP graphviz \f[I]OUTFILE\f[R] Generates a graph of the network defined in \f[I]CONFIGFILE\f[R]. This does not need root access, nor does it require the namespaces to have been started. .RS .PP \f[I]OUTFILE\f[R] can be \f[V]png\f[R] \f[V]pdf\f[R] or \f[V]ps\f[R]. If the extension \f[V]gv\f[R] is given the output is a graphviz(7) file which you can process separately. .RE .SH RUNNING COMMANDS IN A NAMESPACE .PP Once you have created a set of network namespaces, you can easily run any commands you want within them. If for instance you defined three hosts (\f[V]host_a\f[R] with IP \f[V]10.0.0.1\f[R], \f[V]host_b\f[R] with IP \f[V]10.0.0.2\f[R] and \f[V]host_c\f[R] with IP \f[V]10.0.0.3\f[R]) connected via a common switch \f[V]sw0\f[R]: .IP .nf \f[C] # ping host_b and host_c from host_a sudo ip netns exec host_a ping 10.0.0.2 sudo ip netns exec host_a ping 10.0.0.3 # use netcat to listen on host_a and send data from host_b # (use two terminals to run the commands simultaneously) sudo ip netns exec host_a nc -l -p 23 sudo ip netns exec host_b nc -q 0 10.0.0.1 23 < /etc/hosts # capture traffic passing through the switch, then view it sudo ip netns exec sw0 tcpdump -i switch -w capfile wireshark capfile # Use \[aq]firehol panic\[aq] in host_b to block all traffic # (you could equally load a full config etc.) sudo ip netns exec host_b firehol panic # this is now blocked sudo ip netns exec host_a ping 10.0.0.2 # not blocked (host_b not involved) sudo ip netns exec host_a ping 10.0.0.3 # obtain a shell for your regular user, only \[dq]in\[dq] host_c sudo ip netns exec host_c sudo -i -u $USER ip a | grep 10.0.0.3 \f[R] .fi .SH SEE ALSO .IP \[bu] 2 vnetbuild.conf(5) - VNetBuild configuration file .IP \[bu] 2 firehol(1) - FireHOL program .IP \[bu] 2 fireqos(1) - FireQOS program .IP \[bu] 2 FireHOL Website (http://firehol.org/) .IP \[bu] 2 VNetBuild Online PDF Manual (http://firehol.org/vnetbuild-manual.pdf) .IP \[bu] 2 VNetBuild Online Documentation (http://firehol.org/documentation/) .SH AUTHORS FireHOL Team.