VDE can be started from an end user (unprivileged) using the following command:
This command does not “return” because the problem is now being run in the foreground and interactively. There is a good reason why we want to run the VDE switch in this mode. Once started like this, VDE creates a subfolder at /tmp/switch that consists of some additional subfolders and important files. Note that you can run multiple switches by specifying a different path in the -s option.
At this point, you have a virtual switch that is ready to accept connections to its ports. However, this switch only connects nodes of the same subnet in TCP/IP. It has no ability to share the outside (Internet) connection of the host OS with nodes of the virtual switch. Furthermore, since the VDE switch is a switch device, it cannot offer DHCP services.
If you want to offer DHCP and let the virtual switch connect to a NAT device (that attaches to one of the switch ports), you have to run the following command (returns immediately):
This starts up a separate daemon (background process) that acts as a router and a DHCP server, and it connects to one of the ports of the VDE already running using the subfolder /tmp/switch. At this point, you have the equivalence of a common residential gateway/router device.
Unfortunately, the DHCP server built-in to slirpvde does not have all the options available to a real DHCP server. For example, you cannot assign a range of IP addresses to be assigned dynamically, or to assign a specific IP address to a specific MAC ID.
If you require more flexibility regarding the DHCP server, then don’t specify --dhcp when you start slirpvde. This turns of the DHCP server. Without the DHCP server, you have to assign IP addresses along with other parameters to your VMs. The gateway address is 10.0.2.2, and the DNS server address is 10.0.2.3. The netmask is 255.255.255.0.
You can reassign the IP network address using the -n option, but there are no options to change the host number of the DHCP server (2) and the DNS server (3).
If you want to learn more about the commands, please use the man pages. VDE is far more flexible and powerful than what is described here.