Sunday, September 16, 2007

Qemu with networking

1.Building the enviorenment:
  • apt-get install qemu
  • apt-get install uml-utilities
  • apt-get install bridge-utils
2.Configuring HostOS:
  • modprobe tun
  • mkdir /dev/net
  • mknod /dev/net/tun c 10 200
  • tunctl
  • brctl addbr br0
  • create /etc/qemu-ifup file and make it executable
echo "Executing /etc/qemu-ifup"
echo "Bringing up $1 for bridged mode..."
ifconfig $1 promisc up
echo "Adding $1 to br0..."
brctl addif br0 $1
sleep 2

  • Create script and make it executable

ARGS="-hda /dev/sda -boot c -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=/etc/qemu-ifup -m 256 -localtime"
echo "Loading kqemu kernel module..."
modprobe kqemu
echo "...."
echo "Starting QEMU with..."
echo $ARGS
echo "...."
echo "Setting memory"
umount /dev/shm
mount -t tmpfs -o size=272m none /dev/shm
exec qemu $ARGS

  • host ip is =>
  • ifconfig tap0 up
  • Start qemu with
3.Configuring GuestOS:
  • ifconfig eth0 up
  • route add default gw
  • ping

No comments:

Post a Comment