OpenWRT unter VMWare

Aus Andor2Wiki
Wechseln zu: Navigation, Suche

Um ein unter VMWare lauffähiges Image zu bauen, braucht man ein Linux mit installiertem Paket qemu

Damit kann man aus den von OpenWRT angebotenen Images (http://downloads.openwrt.org/kamikaze/) eine VMDK bauen:

qemu-img convert -f raw openwrt-x86-ext2.image -O vmdk openwrt-x86-2.6-ext2.vmdk

Dies virtuelle Disk muss dann nur noch in einer funktionierenden VMX Datei eingebunden werden und schon hat man ein lauffähiges OpenWRT in einer VM.

Das entsprechende VMX file kann entweder generiert werden, oder man verwendet einfach das hier:

#!/usr/bin/vmplayer
config.version = "8"
virtualHW.version = "4"
displayName = "OpenWrt Kamikaze (x86-2.6)"
annotation = ""
guestinfo.vmware.product.long = ""
guestinfo.vmware.product.url = ""
guestOS = "other26xlinux"
nvram = "OpenWrt Kamikaze (x86-2.6).nvram"
MemTrimRate = "-1"
memsize = "128"
numvcpus = "1"
MemAllowAutoScaleDown = "FALSE"
uuid.action = "create"
checkpoint.vmState = ""
hints.hideAll = "TRUE"
serial0.pipe.endPoint = "server"
floppy0.present = "FALSE"
serial0.present = "TRUE"
serial0.fileType = "pipe"
serial0.fileName = "\\.\pipe\com_1"
serial0.hardwareFlowControl = "TRUE"
sound.present = "FALSE"
logging = "FALSE"
isolation.tools.hgfs.disable = "FALSE"
isolation.tools.dnd.disable = "FALSE"
isolation.tools.copy.enable = "TRUE"
isolation.tools.paste.enabled = "TRUE"
gui.restricted = "FALSE"
paevm = "TRUE"
gui.fullScreenAtPowerOn = "FALSE"
tools.syncTime = "TRUE"
ethernet0.present = "TRUE"
ethernet0.virtualDev = "e1000"
ethernet0.connectionType = "bridged"
ethernet0.addressType = "generated"
ethernet0.generatedAddress = "00:0c:29:90:a3:18"
ethernet0.generatedAddressOffset = "0"
ethernet1.present = "TRUE"
ethernet1.virtualDev = "e1000"
ethernet1.connectionType = "bridged"
ethernet1.generatedAddress = "00:0c:29:f3:81:22"
ethernet1.generatedAddressOffset = "0"
scsi0.present = "FALSE"
ide0:0.present = "TRUE"
ide0:0.fileName = "openwrt-x86-2.6-ext2.vmdk"
ide0:0.deviceType = "disk"
ide0:0.mode = "persistent"
ide0:0.redo = ""
ide0:0.startConnected = "TRUE"
ide0:0.writeThrough = "TRUE"
ide0:0.autodetect = "TRUE"
# USB settings
# This config activates USB
usb.present = "TRUE"
usb.generic.autoconnect = "FALSE"

Das System ist erst einmal kaum zu gebrauchen, da es weder per IP erreichbar ist noch den SSH port offen hat. Dazu:

iptables –I INPUT –p tcp –dport 22 –j ACCEPT
ifconfig br-lan 192.168.2.19 up
route add default gw 192.168.2.1
vi /etc/resolv.conf

Die IP-Adressen müssen natürlich entsprechend angepasst und als nameserver ein gültiger eingetragen werden.

Anschließend kann der Paketmanager (früher ipkg, jetzt opkg) normal verwendet werden um was auch immer zu tun, z.B.

root@OpenWrt:~# opkg update
Downloading http://downloads.openwrt.org/kamikaze/8.09.2/x86/packages/Packages.gz
Connecting to downloads.openwrt.org (78.24.191.177:80)
Packages.gz          100% |***************************|   147k 00:00:00 ETA
Inflating http://downloads.openwrt.org/kamikaze/8.09.2/x86/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/snapshots

root@OpenWrt:~# opkg upgrade

root@OpenWrt:~# opkg install perl
Installing perl (5.10.0-1) to root...
Downloading http://downloads.openwrt.org/kamikaze/8.09.2/x86/packages/perl_5.10.0-1_i386.ipk
Connecting to downloads.openwrt.org (78.24.191.177:80)
perl_5.10.0-1_i386.i 100% |***************************|   490k 00:00:00 ETA
Configuring perl