Score:0

QEMU VM with tap interface sees all packages coming from hypervisor instead of real source IP

in flag

I have set up a very simple Hypervisor using Alpine Linux and my VM sees all traffic coming from the IP of the hypervisor.

Which also means if fail2ban tries to block attacks, it always blocks the hypervisors IP

How can I have the VM see the real IP Adresses and not just the IP of the hypervisor?

Interface setup

On the HV (192.168.5.5) I have a bridged interface br0 which is working fine

# tun1 setup script on Hypervisor
iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
iptables -P FORWARD ACCEPT
ip tuntap add dev tap1 mode tap user root
ip link set dev tap1 up
ip link set tap1 master br0

qemu-system-x86_64 [..non related parameters removed ..] \
-device virtio-net-pci,netdev=network0,mac=02:1f:ba:26:d7:56 \
-netdev tap,id=network0,ifname=tap1,script=no,downscript=no

The VM has internet access but all traffic it sees comes from the IP of the hypervisor.

VM seeing only HV IPs

Someone is even trying to use my Server for an DNS amplification attack (blocked outgoing on my PFSense Firewall though) DNS amplification attacks

Fail2ban also blocking the wrong IP fail2ban log showing blocked HV ip

Score:0
in flag

The reason for this is the postrouting iptable rule.

After removing iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE using the command iptables -t nat -D POSTROUTING -o br0 -j MASQUERADE it works.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.