Openwrt使用Qemu仿真

本文档介绍如何在QEMU虚拟环境中运行OpenWrt x86版本。包括在Ubuntu Linux及Windows环境下安装所需软件、下载OpenWrt镜像、配置网络接口等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

OpenWrt in QEMU

This document descripes howto run the OpenWrt x86 port in QEMU.

  • qemu an example setup

It is mixed descriptions from windows and linux, so please read through all of it before starting.

Ubuntu Linux version

Confirmed to work on Ubuntu 10.10 both x86_64 and x86

* Install qemu-kvm and kvm-pxe

sudo apt-get install qemu-kvm kvm-pxe

* Download an openwrt image of your choise.

sudo su -
mkdir -p /var/lib/libvirt/images
cd /var/lib/libvirt/images
http://downloads.openwrt.org/backfire/10.03/x86/openwrt-x86-ext2.image.gz
gunzip openwrt-x86-ext2.image.gz

Before starting it under qemu/kvm. I had to set a network driver model to make a network interface appear in OpenWrt.

model=ne2k_pci

Start the image:

sudo su -
cd /var/lib/libvirt/images
qemu -net nic,model=ne2k_pci -hda openwrt-x86-ext2.image

You should now get a "terminal like" (vnc) window popup which shows the boot of OpenWrt.

Good luck!

Windows version

QEMU is an an open source processor emulator (and virtualizer). Start at QEMU download page which should have a link where QEMU prebuild binaries for Windows. You can also find other (newer) builds of QEMU for Windows by googlling. In this example download the qemu-0.9.0-windows.zip and unzip to a directory.

Download OpenWrt raw image (ex. kamikaze/8.09.1/x86/) and copy the raw image into the qemu directory.

Run QEMU by using following command:

C:\qemu-0.9.0-windows>qemu.exe -L . -hda openwrt-x86-ext2.image

Which shall result in a command window as shown below:

Start QEMU with OpenWrt

QEMU may issue warning message as following:

Could not open '\\.\kqemu' - QEMU acceleration layer not activated

You may correct this warning by installing KQEMU driver which provides better performance for the VM, but this is not as relevant to OpenWrt.

Upon execution of the above command new window shall appear with booting OpenWrt:

OpenWrt boot up

And in several seconds OpenWrt VM shall be up and running:

OpenWrt running in QEMU


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值