
Gont is a package to creat realistic virtual network, running real kernel, switch and application code, on a single machine (VM, cloud or native).
Gont is heavily inspired by Mininet.
It allows the user to build virtual network topologies using Go code.
Under to hood the network is then constructed using Linux virtual bridges and network namespaces.
Features
- L3 Routers
- L2 Switches
- L3 NAT Routers
- L3 Host NAT (to host network)
- Hostname resolution (using /etc/hosts)
- Support for multiple simultaneous and isolated networks
- Ideal for golang unit tests
- Can run in workflows powered by GitHub's runners
- Lean code thanks to functional options
Examples
Have a look at the unit tests for usage examples:
Prerequisites
iptables
(for NAT)
ping
(for testing)
traceroute
(for testing)
Roadmap
- NAT
- Use netlink socket instead of
iptables
tool for configuring NAT
- Use netlink socket instead of
ipset
tool for configuring NAT
- Integrate go imlementations of
ping
and traceroute
tools
- More tests
- Fix host NAT
- Add support for netem and tbf qdiscs on Links
- Add separate examples directory
- Topology factories
- Full IPv6 support
Architecture
classDiagram
direction RL
class Network {
Nodes []Node
Links []Link
}
class Link {
Left Endpoint
Right Endpoint
}
class Endpoint {
}
class Port {
Name string
Node Node
}
class Interface {
Addresses []net.IPNet
}
class Namespace {
NsFd int
Run()
}
class Node {
Name string
}
class Host {
Interfaces []Interface
AddInterface()
}
class Switch {
Ports []Port
AddPort()
}
class Router {
AddRoute()
}
class NAT {
}
Node *-- Namespace
Host *-- Node
Router *-- Host
NAT *-- Router
Switch *-- Node
Port *-- Endpoint
Interface *-- Port
Port "1" o-- "1" Node
Host "1" o-- "*" Interface
Switch "1" o-- "*" Port
Link "1" o-- "2" Endpoint
Network "1" o-- "*" Link
Network "1" o-- "*" Node
Credits
Funding acknowledment
The development of Gont has been supported by the [ERIGrid 2.0] project of the H2020 Programme under Grant Agreement No. 870620