# WinXP in QEMU <- VDE switch -> dnsmasq

## deterenkelt

I have several virtual machines running in QEMU with kvm support. The machines are connected to VDE switch, which is part of the LAN bridge on my system, there is dnsmasq running, and VMs like fedora or debian have no problems accessing NFS server on my computer and freely update themselves via internet, since routing is done on the host. The problem machine is Windows XP which I cannot integrate into the network completely.

IPv4 are automatically given from the dnsmasq which is bound to the LAN bridge: br0. WinXP has a Red Hat VirtIO Ethernet Adaptor, with drivers installed from the iso image, Windows has no complaints about the device. When I start this VM, it starts to acquire IP and does it for several minutes. Finally it gets IPv4 from the dnsmasq, the IP address, the DNS server, the subnet mask are all correct and cannot be mistaken for some default setting. On the Gentoo I see the IPv4 assigned and the host being assigned the name. It looks like it works, but I cannot open any page on the internet, I cannot ping even the gateway. When I try to traceroute WinXP IP local address from my Gentoo, traceroute gives thirty asterisks then exits. Whatever’s happening it’s beyond I can comprehend.

Here are the settings:

Command running the VM:

```
alias qemu-graphic="qemu-system-x86_64 -daemonize -enable-kvm \

   -cpu host \

   -boot order=dc \

   -no-frame -no-quit "

alias vm-w="qemu-graphic   -smp 1,cores=1,threads=1 -m 1024 \

   -vga qxl -spice addr=192.168.0.1,port=5903,disable-ticketing \

   -qmp unix:$HOME/qmp-sock-shindaws,server,nowait \

   -name 'Win_XP,process=vm-winxp' -rtc base=localtime -usbdevice tablet \

   -drive file=$HOME/vm_winxp.img,if=ide \

   -netdev vde,id=taputapu,sock=/tmp/vde.ctl \

      -device virtio-net-pci,netdev=taputapu,mac=11:11:11:11:11:11"
```

/etc/conf.d/vde:

```
# load the tun module

VDE_MODPROBE_TUN="yes"

# virtual tap networking device to be used for vde

VDE_TAP="tap0"

# mode and group for the socket

VDE_SOCK_CHMOD="770"

VDE_SOCK_CHOWN=":kvm"

# This is the actual options string passed to VDE.  Change this at your own risk.

VDE_OPTS="-hub -mod 770 -group kvm -tap ${VDE_TAP} -daemon"
```

/etc/dnsmasq.conf

```
interface=br0

bind-interfaces

expand-hosts

domain=homenet

dhcp-range=set:v,192.168.0.2,192.168.0.6,255.255.255.248,12h
```

The script doing NAT is pretty much a copypaste of the http://wiki.gentoo.org/wiki/Home_Router guide

/etc/conf.d/net:

```
modules="iproute2"

dns_domain="homenet"

nis_domain="homenet"

config_eth0="null"

config_tap0="null"

tuntap_tap0="tap"

tunctl_tap0="-u root"

rc_net_br0_need="net.eth0 net.tap0"

bridge_br0="eth0 tap0"

config_br0="192.168.0.1/29"

brctl_br0="setfd 15  sethello 2  stp on"

config_eth1="null"

rc_net_br1_after="net.br0"

rc_net_br1_need="net.eth1"

bridge_br1="eth1"

brctl_br1="setfd 15  sethello 2  stp on"

dns_servers_br1="127.0.0.1"

config_br1="dhcp"
```

/var/log/messages:

```
Mar  9 19:03:30 home dnsmasq-dhcp[16290]: DHCPREQUEST(br0) 192.168.0.4 02:50:f2:00:01:81 

Mar  9 19:03:30 home dnsmasq-dhcp[16290]: DHCPACK(br0) 192.168.0.4 02:50:f2:00:01:81 vmshindaws

Mar  9 19:03:35 home dnsmasq-dhcp[16290]: DHCPREQUEST(br0) 192.168.0.4 02:50:f2:00:01:81 

Mar  9 19:03:35 home dnsmasq-dhcp[16290]: DHCPACK(br0) 192.168.0.4 02:50:f2:00:01:81 vmshindaws

Mar  9 19:03:43 home dnsmasq-dhcp[16290]: DHCPREQUEST(br0) 192.168.0.4 02:50:f2:00:01:81 

Mar  9 19:03:43 home dnsmasq-dhcp[16290]: DHCPACK(br0) 192.168.0.4 02:50:f2:00:01:81 vmshindaws

Mar  9 19:04:10 home dnsmasq-dhcp[16290]: DHCPDISCOVER(br0) 192.168.0.4 02:50:f2:00:01:81 

Mar  9 19:04:10 home dnsmasq-dhcp[16290]: DHCPOFFER(br0) 192.168.0.4 02:50:f2:00:01:81 

Mar  9 19:04:10 home dnsmasq-dhcp[16290]: DHCPREQUEST(br0) 192.168.0.4 02:50:f2:00:01:81 

Mar  9 19:04:10 home dnsmasq-dhcp[16290]: DHCPACK(br0) 192.168.0.4 02:50:f2:00:01:81 vmshindaws
```

----------

## deterenkelt

An attempt to change the networking device settings from vde to usual virtio

```
-netdev user,id=mynet0 \

-device virtio-net,netdev=mynet0"
```

Now it has 

IP 10.0.2.15

mask 255.255.255.0

gate 192.168.0.1 (which is one of the br0 IP addresses)

DHCP server 10.0.2.2

DNS 10.0.2.3

but still cannot ping 192.168.0.1—timeout exceeded.

----------

