Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Aug 2007 15:14:37 -0500
From:      Matt <datahead4@gmail.com>
To:        "Trent Nelson" <tnelson@onresolve.com>
Cc:        freebsd-emulation@freebsd.org
Subject:   Re: Qemu networking issue
Message-ID:  <cd6b4a5b0708021314p6545b9acvfceb8e15ccf660a9@mail.gmail.com>
In-Reply-To: <AB1BB4CF81B9214682079EB55A7125ED0215D210@mapibe05.exchange.xchg>
References:  <AB1BB4CF81B9214682079EB55A7125ED0215D210@mapibe05.exchange.xchg>

next in thread | previous in thread | raw e-mail | index | archive | help
On 8/2/07, Trent Nelson <tnelson@onresolve.com> wrote:
> [ Please CC me on replies as I'm not subscribed to this list. ]
>
> I've got a 6.2-STABLE box that I'm running qemu 0.9.0 on, hosting a
> Windows 2003 guest OS.  I've got an em0 interface configured with the IP
> address 216.203.62.30 (default route: 216.203.62.29), as well as ten
> aliased (public) IPs, one of which happens to be 205.97.38.47, which I
> want to dedicate to this particular virtual machine, as if it were a
> jail.
>
> How do I get the Windows guest to use the 205.97.38.47 IP address?
> After a day of googling and trying half a dozen different approaches,
> nothing I try seems to work.
>
> I've tried the sysctl net.link.ether.bridge and ifconfig bridge0
> approaches mentioned in [1-4].  This initially involved having a tap0
> inet 0.0.0.0 broadcast 0.255.255.255 interface, and a bridge0 with
> em0,tap0 (and no assigned IP for the bridge), but when I tried to tell
> the Windows box to use IP 205.97.38.47 (after I've removed this aliased
> IP from em0), subnet 0xffffff00, gateway 216.203.62.29, the local
> connection properties dialog would hang with 'Acquiring address...' then
> eventually fail.  If I picked an IP address like 192.168.0.1, it would
> go through, but there wouldn't actually be any network connectivity
> between the host/guest.
>
> When 205.97.38.47 was aliased to em0, Windows would complain that there
> was another IP on the network with the same IP (which is to be expected
> I guess), and dmesg would have a bunch of arp messages about the qemu
> guest mac address '52:54:00:12:34:56' trying to use em0's 205.97.38.47,
> also to be expected.  I tried a few things like using the qemu mac
> address for tap0, setting tap0's inet to 205.97.38.47 instead of
> 0.0.0.0, keeping 0.0.0.0 but having 205.97.38.47 as an alias, setting
> bridge0's inet to 205.97.38.47 and playing with the arp table to coerce
> things further, but nothing resulted in traffic between the host/guest.
>
> Anyone have any insight?
>
>         Trent.
>
>  [1]: http://www.nabble.com/Virtual-network-with-qemu-t3940434.html
>  [2]:
> http://docs.freebsd.org/cgi/getmsg.cgi?fetch=111250+0+archive/2007/freeb
> sd-emulation/20070603.freebsd-emulation
>  [3]: http://forums.bsdnexus.com/viewtopic.php?id=1563
>  [4]: http://acidos.bandwidth-junkies.net/index.php?Sect=qemu
> _______________________________________________
> freebsd-emulation@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-emulation
> To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@freebsd.org"
>

I use the bridge/tap networking approach on my FreeBSD host for WinXP
guests and it seems to work well.

General config is as follows:

1. On host, issue commands to create the bridge interface and populate
it with one of your physical network interfaces and one tap interface
(make sure the if_bridge and if_tap kernel modules are loaded if
they're not compiled into your kernel already).  E.g. "ifconfig
bridge0 create"  "ifconfig bridge0 addm eth0 addm tap0"  "ifconfig
bridge0 up"

2. For qemu command line, include something like this: "-net nic -net
tap,ifname=tap0,script=/<path-to-vmhome>/if-up".

3. The if-up script mentioned above should be something like this:

#!/bin/sh

ext_if="eth1"
tap_if="$1"

sudo ifconfig $tap_if up

4. As long as you have the sysctl value "net.link.tap.user_open=1"
set, you should be able to launch the qemu program with normal user
creds.

5. Configure the Windows guest to have the static IP address that you
are after, first ensuring that that IP is not used by any of your
interfaces or anyone else on the network.

HTH

Matt



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cd6b4a5b0708021314p6545b9acvfceb8e15ccf660a9>