:!: Imo this does not belong into the toh, its rather a specific qemu use case. — Jo-Philipp Wich 2011/02/28 15:32

Qemu

Qemu home page.

  • qemu for a general howto

Qemu - fully virtualized x86_64

My goal is to run a complete enterprise network into my computer, all machines running as virtual ones, even the router. This howto will explain how install openwrt on this virtual router.

Host machine setup

  • install the bridge-utils package
  • Edit the file /etc/network/interfaces (debian or ubuntu)
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
# 
# Create a software bridge br0, and connect eth0 (the real ethernet adapter).
# Virtual machines connected to this bridge will be virtually connected to 
# the physical network, like eth0.
# 
auto br0
iface br0 inet dhcp
      bridge_ports eth0
      bridge_stp off
      bridge_maxwait 0
# Create the second software bridge br1, and connect the dummy0 interface.
# dummy0 will never be used, but the bridge needs at least one interface.
# At this time, there is no connection between br0 and br1.
auto br1
iface br1 inet manual
      bridge_maxwait 0
      bridge_ports dummy0

Virtual Machine Setup

Create a virtual machine

  • 2 network interface :
    • eth0 will be connected to the lan, of type e1000, connected to br1
    • eth1 will be connected to the wan, of type e1000, connected to br0
  • Storage : virtual IDE disk : openwrt-x86-generic-combined-ext2.vmdk

Virtual machine configuration

  • boot the virtual machine
  • hit enter to have a shell
  • execute this : (copied from oldwiki/alixport)
uci batch <<-EOF
  # Configure the eth1 NIC from the virtual machine to act as a WAN port and get the IP address via DHCP
  set network.wan=interface
  set network.wan.proto=dhcp
  set network.wan.ifname=eth1
  commit network
EOF
  • reboot the virtual router

Testing the router

  • Create a new virtual machine, connected to br1
  • Run a browser into it and enter 192.168.1.1, and now the openwrt web interface will show up ;)

Back to top

toh/qemu/qemu.txt · Last modified: 2011/02/28 15:33 (external edit)