[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Qemu, Networking and F7



On 8/1/07, Charles Curley <charlescurley charlescurley com> wrote:
> Has anyone got qemu working on F7 with networking? I've googled and
> read the docs, but nothing I've tried produces a working network.

If you want your host and other hosts to have unfettered access to the
guest, then tap and bridging is the way to go.  I achive this with the
following in /etc/qemu-ifup.  Not sure where I found this originally,
so the credit should go elsewhere, but its been modified a couple of
times so you can credit me with the bugs:

#!/bin/sh
DEV=eth1
/sbin/ifconfig $1 promisc 0.0.0.0
if ! /sbin/ifconfig br0 > /dev/null
then
        /usr/sbin/brctl addbr br0
        /usr/sbin/brctl addif br0 $DEV
        /sbin/ifconfig br0 up
        addr=`/sbin/ip addr | grep $DEV | grep inet | sed -e
's/$DEV/dev br0/' -e s/inet//`
        /sbin/ip addr add $addr
fi
/usr/sbin/brctl addif br0 $1
/usr/sbin/brctl stp br0 off
/sbin/ip route | grep $DEV | while read route
do
    newroute=`echo $route | sed s/$DEV/br0/ `
    /sbin/ip route del $route
    /sbin/ip route add $newroute
done


Make sure you chmod a+x it and set DEV to the NIC that you want to
bridge it with.

You can qemu as follows:

    qemu -net nic -net tap image.img

In your guest OS you'll need to set up the networking.  If you have a
DHCP server on the DEV NIC you're good to go otherwise you'll have to
set up a static IP on the same subnet as the DEV NIC.

The only down side of this is that you need to run qemu as root,
although I am sure that its possible to get round it, I've just never
got round to it.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]