{"id":24029926,"url":"https://github.com/pcolladosoto/dvnet","last_synced_at":"2026-05-06T11:32:07.204Z","repository":{"id":65317316,"uuid":"552771568","full_name":"pcolladosoto/dvnet","owner":"pcolladosoto","description":"A Docker plugin for creating Linux-native virtual networks","archived":false,"fork":false,"pushed_at":"2023-10-30T15:04:52.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-08T17:09:38.173Z","etag":null,"topics":["docker","golang","linux","netlink","network-namespaces"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pcolladosoto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-17T07:51:09.000Z","updated_at":"2022-11-25T19:39:47.000Z","dependencies_parsed_at":"2025-01-08T17:05:08.652Z","dependency_job_id":"3a18866b-1609-40e1-9c03-aa05fcc7f5d1","html_url":"https://github.com/pcolladosoto/dvnet","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcolladosoto%2Fdvnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcolladosoto%2Fdvnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcolladosoto%2Fdvnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcolladosoto%2Fdvnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pcolladosoto","download_url":"https://codeload.github.com/pcolladosoto/dvnet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240784389,"owners_count":19857014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","golang","linux","netlink","network-namespaces"],"created_at":"2025-01-08T17:04:58.052Z","updated_at":"2026-05-06T11:32:02.185Z","avatar_url":"https://github.com/pcolladosoto.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dvnet: Docker Virtual Network Plugin\nThis repository contains the implementation of a compliant *Docker Network Plugin*\ncapable of instantiating arbitrary virtual networks.\n\nVirtual networks can be defined through JSON files in which one can specify:\n\n1. Whether to allow the containers in the virtual network outbound Internet access.\n2. Whether to automatically route the entire network.\n3. An arbitrary number of subnets, each with its own CIDR block.\n4. An arbitrary number of hosts on each subnet:\n    - Each host is capable of running a specific (and possibly different) Docker image.\n5. An arbitrary number of routers bridging the different subnets:\n    - Each router is capable of running a specific (and possibly different) Docker image.\n    - Each router can instantiate a series of `iptables`-based firewall rules.\n\nYou can find an example configuration file over at [`demos/quagga/net.json`](demos/quagga/net.json).\n\nThe main purpose of this tool is offering fully emulated network topologies allowing for\nthe study and comprehension of network-related concepts. One can easily:\n\n- Capture traffic in **any** point in the network for online or offline analysis using\n  tools such as [`tcpdump(1)`](https://man7.org/linux/man-pages/man1/tcpdump.1.html)\n  and [WireShark](https://www.wireshark.org).\n\n- Check whether a given firewall policy implemented with\n  [`iptables(8)`](https://man7.org/linux/man-pages/man8/iptables.8.html) accomplishes\n  its objective by injecting specific traffic to the router in question.\n\n- Configure and deploy network configuration protocolos such as\n  [OSPF](https://www.rfc-editor.org/rfc/rfc1131.pdf)\n  and [RIPng](https://datatracker.ietf.org/doc/html/rfc2080) through tools such as\n  [Quagga](https://www.nongnu.org/quagga/)\n\nThe above are just a taste of what can be done: we're sure you can come up with more use cases!\n\n## Installation\n`Dvnet` is a plugin for the Docker daemon. This means **Docker must be installed** for `dvnet` to be\nof any use. You can check how to install it for your system by following the\n[official documentation](https://docs.docker.com/engine/).\n\nGiven the technologies used \"under the hood\" this plugin will **only** run on Linux-based systems.\nWe provide statically compiled releases to be used \"as-is\" on Linux machines running on 64-bit\nhardware. You can find those over at the [releases page](https://github.com/pcolladosoto/dvnet/releases).\n\nThe installation is just a matter of downloading the executable and then running it. We also provide\na SystemD unit file for convenience: [`dvnet.service`](dvnet.service). You can just copy it to\n`/etc/systemd/system/dvnet` and you should be good to go.\n\nIn order to ease up the process, we also provide a simple (yet working) automation script: [`install.sh`](install.sh).\nYou can use it directly from the repo without having to download anything:\n\n    # If you use curl(1)\n    $ curl -sSL https://raw.githubusercontent.com/pcolladosoto/dvnet/main/install.sh | sudo bash\n\n    # If you use wget(1)\n    $ wget -q -O - https://raw.githubusercontent.com/pcolladosoto/dvnet/main/install.sh | sudo bash\n\nJust like the installer explains, you'll need to manually run the following when you want to start the plugin.\nBear in mind the command will need to be executed with elevated privileges (i.e. `sudo`).\n\n    $ systemctl start dvnet\n\n## Creating and removing a network\nAs `dvnet` is a compliant Docker plugin, you won't be interacting with it directly. You will just have to issue\n`docker network ...` commands to the Docker daemon which will then be relayed to the plugin itself.\n\nCreating a network is matter of running:\n\n    $ docker network create --driver dvnet --opt net.dvnet.def=/path/to/network/definition network-name\n\nWe just need to pass a single option: the **absolute** path of a valid JSON network definition. We'll also\nhave to name the network: this is the name the Docker daemon will refer to this network as.\n\nNetwork definitions might be arbitrarily complex. What's more, the address assignment on each subnet is **implicit**,\nwhich means you'll know the CIDR block assigned to a particular host, but not necessarily the specific IPv4 address.\nYou might also want to check whether your network definition is the one you actually intended to define. The best\nway to check that is to take a look at the links that have been taken into account when instantiating the network.\n\nAll the above information is dumped into a couple of files. Assuming your network definition is contained on\n`netDef.json`, you'll see that after creating the network through `docker network create ...` the following two files\nwill appear in your working (i.e. current) directory:\n\n1. `netDef.ipaddr`: This file is a JSON document containing the IPv4 addresses assigned to each host and router. Bear\n   in mind that as routers belong to several subnets, they'll be assigned one address per subnet: it's okay for them\n   to appear more than once.\n\n2. `netDef.netg`: This file contains the *edges* (i.e. *links*) in the graph representing the instantiated network. Each\n   line contains an initial node name, followed by the nodes they have links to and the number of links. The number of\n   links will always be `1`, as these networks aren't modelled as [multigraphs](https://en.wikipedia.org/wiki/Multigraph).\n   The important bit is checking each node has links to each of the nodes we expect them to be connected to, according to\n   the initial network definition.\n\nThese files can be deleted at will: they're not needed at all, they just fulfill an informational purpose. Be sure to\ncheck them if you find yourself wondering things such as: what IPv4 address did `foo` have?\n\nAfter it's brought up, you can check the network exists with:\n\n    $ docker network ls\n\nYou can also take a look to find how the different hosts and routers present in the network definition are\nnow running containers with:\n\n    $ docker ps\n\nWhen you're done, you can tear the whole thing up with:\n\n    $ docker network rm network-name\n\nThis will leave your machine in the same state it was before the network was instantiated configuration-wise. When\nthe network is up and running, you can use the familiar `docker exec ...` and `docker cp ...` commands to work\nwith the containers as if they were regular machines.\n\n## Our default Docker images\nIn order to mimic regular machines, we have written a couple of `Dockerfiles` (you can check them over at\n[`dockerfiles`](dockerfiles)) which just add some additional goodies on top of regular Ubuntu images. The\ncatch is we're running an [`sshd(8)`](https://man7.org/linux/man-pages/man8/sshd.8.html) daemon as each\ncontainer's main process (i.e. the process whose `PID` is `1`). This makes containers run \"forever\" so that\nwe can open up shells within them at will. As they are running an SSH daemon we can also\n[`ssh(1)`](https://man7.org/linux/man-pages/man1/ssh.1.html) into them without a problem. Bear in mind the\nuser will always be `root` and that the password is `1234`.\n\nWe have uploaded these images to [Docker Hub](https://hub.docker.com). You can use them yourself by specifying\n[`pcollado/dhost`](https://hub.docker.com/r/pcollado/dhost) and  [`pcollado/drouter`](https://hub.docker.com/r/pcollado/drouter)\nfor the hosts and routers, respectively.\n\nThese images are just an example of what you can run to serve as hosts and routers in the network. You can\nalso develop your own images and have at it: you just need to tweak your network definition to use them!\n\n## Uninstallation\nUninstalling `dvnet` is just a matter of stopping it before removing a couple of files. Just like before, we provide\nan uninstallation script: [`uninstall.sh`](uninstall.sh).\n\nIn order to run it from the repo without having to download anything you can follow the same strategy:\n\n    # If you use curl(1)\n    $ curl -sSL https://raw.githubusercontent.com/pcolladosoto/dvnet/main/install.sh | sudo bash\n\n    # If you use wget(1)\n    $ wget -q -O - https://raw.githubusercontent.com/pcolladosoto/dvnet/main/install.sh | sudo bash\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcolladosoto%2Fdvnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpcolladosoto%2Fdvnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcolladosoto%2Fdvnet/lists"}