Skip to content

Instantly share code, notes, and snippets.

@573
Created October 21, 2012 09:09
Show Gist options
  • Save 573/3926453 to your computer and use it in GitHub Desktop.
Save 573/3926453 to your computer and use it in GitHub Desktop.
To access services from the qemu client os from a microsoft os instance running qemu you can start a batch file containing
@echo off
pushd %qemudir%
:: This call is an example only, customize the paths:
call :start_the_machines "d:/grml_2009.05.iso" "d:/basehd.qc2" "d:/lvmhd.qc2"
goto :eof
:: start_the_machines isofile hdimage1 hdimage2
:start_the_machines %1 %2 %3
set hdX=-drive file=%2,index=0,media=disk -drive file=%3,index=1,media=disk
set srX=-drive file=%1,index=2,media=cdrom
set netopts=-net nic -net user,hostname=mywebserver
:: assume host is running a qemu instance with an OS image - the client - running inside it
:: -redir takes protocol:port-on-host::port-on-client as arguments (left the hostname part
:: out for readability)
set rediropts=-redir tcp:4430::443 -redir tcp:8080::80 -redir tcp:300::3000 -redir tcp:2222::22
set bootsel=-boot c
set kqemu=-no-kqemu
set memory=-m 256
set nographics=-serial null -nographic -monitor null
:: Machine 1:
start cmd.exe /c qemu.exe -L . -M pc %memory% %bootsel% %netopts% %rediropts% %kqemu% %hdX% %srX%
goto :eof
popd
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment