IPv4 Virtual Networks emulator based on net + mount namespace technology for fast deployments of related labs activities.
This script provides simple virtual IPv4 interconnected networks from json predefined topologies given as argument. For each network entity a screen-based CLI is setup for management (see screen documentation). Internet access could be enabled through masquerading (iptables) via host machine interface.
Commands tested: arp, sysctl (routers), ifconfig, route, ip, iptables, ping, tcpdump, scapy3, wget, snort, nmap, ipsec, ssh
Wrappers implemented for:
- rsyslog
- nmap
- ssh
- strongswan
- (more to be added)
Developed and tested with Bash v5.0.3(1) shell on WSL2 Debian platform.
sudo ./vnet.sh <json_file>
In file vnetenv.sh set variable VTERM={"screen", "xterm"} for screen-style interraction or xterm-style, respectivelly.
Configuration specified in net1.json sample file:
.1 (10.0.1.0/24) .2 .2 (10.0.2.0/24) .1
| H1 | ------------------ | Router | ------------------- | H2 |
veth0_h1 veth0_router | veth1_router veth0_h2
| veth2_router
| .2
| (10.0.3.0/24)
|
| veth0
| Host |
| eth0 (wsl2)
|
|
|
Internet
Configuration specified in net2.json sample file:
.1 (10.0.1.0/24) .2 .1 (10.0.2.0/24) .2 .1 (10.0.3.0/24) 2.
| H1 | ------------------ | R1 | ---------------- | R2 | ---------------- | H2 |
veth0_h1 veth0_r1 veth1_r1 veth0_r2 veth1_r2 veth0_h2