diff options
author | Eric Hameleers <alien@slackware.com> | 2005-08-31 19:49:34 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2005-08-31 19:49:34 +0000 |
commit | da193c2d950cf88e6124d27fc49e9f2a84e4debd (patch) | |
tree | e01acd6f9faaa1229355be53e8955c02b93add8f /vde/build | |
parent | 8530ccfa273e63279e439548d5720fed2874c069 (diff) | |
download | asb-da193c2d950cf88e6124d27fc49e9f2a84e4debd.tar.gz asb-da193c2d950cf88e6124d27fc49e9f2a84e4debd.tar.xz |
Make the script work out of the box.
Diffstat (limited to 'vde/build')
-rwxr-xr-x | vde/build/rc.vdenetwork | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/vde/build/rc.vdenetwork b/vde/build/rc.vdenetwork index da73a646..b5e55db4 100755 --- a/vde/build/rc.vdenetwork +++ b/vde/build/rc.vdenetwork @@ -1,4 +1,5 @@ #!/bin/sh +# $Id$ # Qemu environment preparation script # --------------------------------------------------------------------------- # @@ -20,12 +21,16 @@ TAP_MASK=255.255.255.0 TAP_BCAST=`/bin/ipmask ${TAP_MASK} ${TAP_IP} | cut -f 1 -d ' '` +# Host interfaces that need to be NAT-ed (in case we're nog bridging): +NAT_IFS="eth+" + # Definitions for the LAN segment the Qemu virtual machines will be in. -# These definitions will be fed to dnsmasq - this program will provide DNS and DHCP to the -# Qemu LAN. +# These definitions will be fed to dnsmasq - this program will provide DNS +# and DHCP to the Qemu LAN. -# The VM_IPLOW and VM_IPHIGH addresses must agree with the definitions for the tap0 device -# above. These 'low' and 'high' values are the IP address range for the DHCP server to use. +# The VM_IPLOW and VM_IPHIGH addresses must agree with the definitions for +# the tap0 device above. These 'low' and 'high' values are the IP address +# range for the DHCP server to use. VM_DOMAIN=qemu.lan VM_IPLOW=10.111.111.128 @@ -34,9 +39,8 @@ VM_BCAST=${TAP_BCAST} VM_MASK=${TAP_MASK} # For additional options to dnsmasq: - -DNSMASQ_OPTIONS="--server /barrier.lan/192.168.0.11 \ - --server /ibm.com/9.132.41.1" +#DNSMASQ_OPTIONS="--server /my.net/192.168.1.1" +DNSMASQ_OPTIONS="" # See how we were called. @@ -44,6 +48,12 @@ case "$1" in start) echo -n "Starting VDE network for QEMU: " + # If we are running 2.6, load tun module + if uname -r | grep '^2.6'; then + /sbin/modprobe tun 2>/dev/null + sleep 1 + fi + # Start tap switch vde_switch -tap ${TAP_DEV} -daemon @@ -52,13 +62,14 @@ case "$1" in # Start IP Forwarding echo "1" > /proc/sys/net/ipv4/ip_forward - iptables -t nat -A POSTROUTING -o eth+ -j MASQUERADE - iptables -t nat -A POSTROUTING -o ath+ -j MASQUERADE + for NIC in ${NAT_IFS}; do + iptables -t nat -A POSTROUTING -o ${NIC} -j MASQUERADE + done # Change pipe permission chmod 666 /tmp/vde.ctl - # If we are running 2.6, apply workaround + # If we are not running 2.6, apply workaround if uname -r | grep '^2.4'; then echo 1024 > /proc/sys/dev/rtc/max-user-freq fi @@ -78,6 +89,10 @@ case "$1" in stop) echo -n "Stopping VDE network for QEMU: " { + # Delete the NAT rules + for NIC in ${NAT_IFS}; do + iptables -t nat -D POSTROUTING -o ${NIC} -j MASQUERADE + done # Bring tap interface down ifconfig ${TAP_DEV} down # Kill VDE switch |