# QEmu/Tap



## jims (Feb 27, 2010)

I have QEmu set up with TAP, but the guest won't see the network. The host runs on 192.168.1.2, and .3-.9 are for jails/VMs. Do the bolded sections look correct for setting up TAP networking with Qemu on FreeBSD?.


```
[sjss@elrond /data/vm/windowxp]$ ifconfig
[U]nfe0:[/U] flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8<VLAN_MTU>
        ether 6c:f0:49:2c:6d:20
        inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.1.3 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.1.4 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.1.5 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.1.6 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.1.7 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.1.8 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.1.9 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
[U]lo0:[/U] flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
[B][U]tap0:[/U] flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:bd:ac:20:00:00
        Opened by PID 94449
[U]bridge0:[/U] flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether da:94:ad:f7:86:9d
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0[/B]
```



I have the following setup in /etc/rc.conf (unbolded should be irrelevant, but kept for completeness)

```
[B]hostname="elrond.mydomain.net"
ifconfig_nfe0="inet 192.168.1.2 netmask 255.255.255.0"
ifconfig_nfe0_alias0="inet 192.168.1.3 netmask 255.255.255.0"
ifconfig_nfe0_alias1="inet 192.168.1.4 netmask 255.255.255.0"
ifconfig_nfe0_alias2="inet 192.168.1.5 netmask 255.255.255.0"
ifconfig_nfe0_alias3="inet 192.168.1.6 netmask 255.255.255.0"
ifconfig_nfe0_alias4="inet 192.168.1.7 netmask 255.255.255.0"
ifconfig_nfe0_alias5="inet 192.168.1.8 netmask 255.255.255.0"
ifconfig_nfe0_alias6="inet 192.168.1.9 netmask 255.255.255.0"
defaultrouter="192.168.1.1"[/b]

#for NFS
rpcbind_enable="YES"
nfs_server_enable="YES"
mountd_enable="YES"
mountd_flags="-r"
#for jail/i386chroot port tree mounting
nfs_client_enable="YES"
amd_enable="YES"

#for X
hald_enable="YES"
dbus_enable="YES"

linux_enable="YES"

#start jails on startup
bilbo_web_enable="YES"
legolas_mail_enable="YES"

[b]
cloned_interfaces="tap0 bridge0"
ifconfig_bridge0="addm nfe0_alias6 addm tap0 up"[/b]
```

/boot/loader.conf

```
[b]if_tap_load="YES"
if_bridge_load="YES"
aio_load="YES"
kqemu_load="YES"[/b]
nvidia_load="YES"
linprocfs_load="YES"
linsysfs_load="YES"
linux_load="YES"
lindev_load="YES"
snd_hda_load="YES"
```


----------



## aragon (Feb 27, 2010)

Is there any reason you don't use VirtualBox instead?


----------



## jims (Feb 28, 2010)

(1) I want to try both and compare
(2) VirtualBox uses about 50% more memory accordiing to TOP (about 1.7GB for a 768MB mem VM vs 1.1GB for Qemu)
(3) I was reading that VirtualBox doesn't seem to handle freebsd clients well.


----------



## jims (Feb 28, 2010)

Err, I meant Guest, not client.


----------



## gpatrick (Mar 2, 2010)

VirtualBox on OpenSolaris used quite a bit of memory and was a CPU hog from my experience.  VirtualBox on FreeBSD appears to perform better and when I had 4 guests running my load average was under .5 while on OpenSolaris the load average would have been well into double digits, although I don't have any hard data to provide.

I haven't experienced any problems with FreeBSD guests in VirtualBox.  My only problem was with OpenBSD getting segmentation faults, until one of the more recent versions of VirtualBox.  Although on the VB forum, there are still some people getting segmentation faults, leading me to believe it has to be hardware related.

All in all, if I was to use VirtualBox it would be on FreeBSD, and ironically, not on OpenSolaris.


----------



## jims (Mar 2, 2010)

well, I certainly can't complain about the performance of VirtualBox, it's definetly less stuttery than QEmu on this machine, or VMWare on my work machine, but the work machine is a completely different hardware/software setup, and not appropriate for much comparison.


----------

