You are not logged in.

#1 2020-11-12 09:23:07

runvia
Member
Registered: 2020-11-12
Posts: 2

[solved] QEMU/KVM Networking (NAT)

Hello,

I try to set up a virtual machine on my server. I want the VMs in a subnet where I route specific ports from the host to the virtual machine.

The network stuff should be handled by systemd-networkd. Currently the network from the guest (vm) is working. The VM gets the IP 10.10.10.4 and I can ping external ips and can also connect to them. But the DNS resolution doesn't work. If I try 'dig google.com' the DNS query reach the DNS server (1.1.1.1), but the answer never comes back (monitored with tcpdump).

This is my systemd-networkd config of the bridge interface:

[Match]
Name=br0

[Network]
Address=10.10.10.1/27
DHCPServer=true
IPMasquerade=true
IPForward=true

[DHCPServer]
PoolOffset=1
PoolSize=29
EmitDNS=yes
DNS=1.1.1.1

And I start my VM with this parameters:

sudo qemu-system-x86_64 -enable-kvm -cpu host -m 1G -nic bridge -runas user -hda image.qcow2

Thanks to everyone who helps me!
runvia

Last edited by runvia (2020-11-12 10:47:32)

Offline

#2 2020-11-12 10:46:40

runvia
Member
Registered: 2020-11-12
Posts: 2

Re: [solved] QEMU/KVM Networking (NAT)

I figured out that udp traffic didn't come through.

Then I also saw in the log from systemd-resolved the following lines:

Using degraded feature set UDP instead of UDP+EDNS0 for DNS server 1.1.1.1.

Then I noticed that my hosting provider enables a default firewall on udp. After disabling the firewall in the dashboard (I use manual iptables rules anyway) it is working now.

Offline

Board footer

Powered by FluxBB