redir patch for QEMU

| | Comments ()

Two weeks ago I installed some virtual boxes with QEMU in order to reduce the total number of physical servers hosting support projects in Igalia.

Reading about QEMU's networking support I chose redir option, it lets a private network with simple and easy host2guest redirection. Real traffic is handled by the host's networking stack and you can bind a port on all interfaces.

Binding all interfaces is not a very flexible approach adding some drawbacks such as extra administration with your firewall or non natural ports to connect.

This patch adds an extra parameter to bind a host's specific interface. Setting up IP aliases and patching the last source available (qemu-0.9.0) you can execute virtual boxes running services on different host's interfaces. This configuration adds flexible administration to map IPs and ports between your host and your virtual infrastructure.

Next lines patch, compile, install and launch a virtual box redirecting port 22 on host's loopback to port 22 on guest.

jmunhoz@devel:/tmp/ex$ ls
20071204-qemu-0.9.0-redir.patch.gz  qemu-0.9.0.tar.gz
jmunhoz@devel:/tmp/ex$ tar zxf qemu-0.9.0.tar.gz
jmunhoz@devel:/tmp/ex$ gunzip 20071204-qemu-0.9.0-redir.patch.gz
jmunhoz@devel:/tmp/ex$ patch -p0 < 20071204-qemu-0.9.0-redir.patch
patching file qemu-0.9.0/qemu-doc.texi
patching file qemu-0.9.0/slirp/libslirp.h
patching file qemu-0.9.0/slirp/slirp.c
patching file qemu-0.9.0/slirp/socket.c
patching file qemu-0.9.0/slirp/socket.h
patching file qemu-0.9.0/slirp/udp.c
patching file qemu-0.9.0/slirp/udp.h
patching file qemu-0.9.0/vl.c
jmunhoz@devel:/tmp/ex$ cd qemu-0.9.0
jmunhoz@devel:/tmp/ex/qemu-0.9.0$ ./configure --prefix=/tmp/qemu-bin
jmunhoz@devel:/tmp/ex$ make
jmunhoz@devel:/tmp/ex$ make install
jmunhoz@devel:/tmp/ex$ /tmp/qemu-bin/bin/qemu -hda /tmp/example.img \
> -redir tcp:


comments powered by Disqus

Recent Entries