Since I started working at my internship, I needed a way to fully access my virtual machines via a network. I tried to setup a bridge with NetworkManager, but this failed miserably and I couldn’t find any documentation online on how to achieve this. After some browsing I soon found out I could use VDE2 to create a “private” virtual network, where I can access my virtual machines directly via an internal ip. And uses dnsmasq for dhcp for the VM’s since I’m too lazy to setup static ip addresses.
The solution requires the vde2 and dnsmasq packages and a simple (optional) vde2 service for setting up vde2.
Now we configure dnsmasq to service as dhcp server and use the correct interface and dhcp-range.
With the vde service and dnsmasq running, we can start our VM using for example the following command. The important part for vde is qemu-system-x86_64 -net vde and if you use multiple VM’s wit dhcp, a different macaddr per VM.
Now we can connect to the VM using it’s own IP address, an easy way to find the address is checking dnsmasq’s service. Which also shows the log and thus the offered IP address.