[Pkg-vsquare-changes] r40 - in vde2/trunk/debian: . network network/if-post-down.d network/if-pre-up.d

Ludovico Gardenghi garden-guest at alioth.debian.org
Wed Dec 20 12:32:40 CET 2006


Author: garden-guest
Date: 2006-12-20 12:32:40 +0100 (Wed, 20 Dec 2006)
New Revision: 40

Added:
   vde2/trunk/debian/README.Debian
   vde2/trunk/debian/network/
   vde2/trunk/debian/network/if-post-down.d/
   vde2/trunk/debian/network/if-post-down.d/vde2
   vde2/trunk/debian/network/if-pre-up.d/
   vde2/trunk/debian/network/if-pre-up.d/vde2
   vde2/trunk/debian/postinst
   vde2/trunk/debian/postrm
   vde2/trunk/debian/watch
Log:
Today I'm still asleep... added network scripts, post{inst,rm} scripts, watch script, Piotr's README

Added: vde2/trunk/debian/README.Debian
===================================================================
--- vde2/trunk/debian/README.Debian	2006-12-20 11:22:33 UTC (rev 39)
+++ vde2/trunk/debian/README.Debian	2006-12-20 11:32:40 UTC (rev 40)
@@ -0,0 +1,183 @@
+vde2 for Debian
+---------------
+
+
+/etc/network/interfaces
+
+  The Debian package provides an extension for iface sections in
+  /etc/network/interfaces file:
+  
+    * vde2-switch -|<parameters>
+    
+      Start TAP interface with vde_switch command which has control directory
+      /var/run/vde/$IFACE.ctl. The control directory is writtable by vde2-net
+      group. The additional parameters might be --macaddr MAC for switch MAC
+      address or other parameters. Call `vde_switch --help' for description.
+    
+    * vde2-slirp -|<parameters>
+
+      Start Slirp interface connected to the VDE switch with slirpvde command.
+      The additional parameter might be -dhcp for DHCP
+      server or -netaddr to specify the network address (default 10.0.2.0).
+      Call `slirpvde --help' for description.
+      
+    * vde2-plug <dpipe_arg2>
+    
+      Start VDE plug to be connected into a VDE switch controled by TAP device
+      and other switch called by second argument of dpipe command.
+      
+      I.e.
+      
+      The command
+      
+          vde2-plug vde_plug /tmp/vde2.ctl
+      
+      connects TAP interface to local switch.
+      
+      The command
+      
+          vde2-plug ssh remote.machine.org vde_plug /var/run/vde2/tap0.ctl
+      
+      connects TAP interface to remote switch by encrypted tunnel.
+
+
+USAGE
+
+  The encrypted tunnel
+  --------------------
+  
+  The VDE is the simplest VPN solution.
+  
+  On local system:
+  
+  iface tap0 inet static
+    address 10.0.2.2
+    netmask 255.255.255.0
+    vde2-switch -
+    vde2-plug ssh user at remote.machine.org vde_plug /var/run/vde2/tap0.ctl
+                    
+  On remote system:
+  
+  iface tap0 inet static
+    address 10.0.2.1
+    netmask 255.255.255.0
+    vde2-switch -
+
+  If vde2-slirp option is used, the connection works without NAT. The VDE can
+  be also started with non-root privileges:
+  
+  On local system:
+  
+  iface tap0 inet dhcp
+    vde2-switch -
+    pre-up ssh user at remote.machine.org LD_PRELOAD=/usr/lib/vde2/libvdetap.so vde_switch -s /tmp/vde.ctl -p /tmp/vde_switch.pid -d
+    pre-up sleep 1
+    pre-up ssh user at remote.machine.org slirpvde -D -s /tmp/vde.ctl -p /tmp/slirpvde.pid -d
+    vde2-plug ssh user at remote.machine.org vde_plug /tmp/vde.ctl
+    post-down ssh user at remote.machine.org 'test -f /tmp/vde_switch.pid && kill `cat /tmp/vde_switch.pid` || true'
+    post-down ssh user at remote.machine.org 'test -f /tmp/slirpvde.pid && kill `cat /tmp/slirpvde.pid` || true'
+    post-down ssh user at remote.machine.org rm -f /tmp/vde_switch.pid /tmp/slirpvde.pid
+  
+  
+  QEMU
+  ----
+
+  The VDE is very useful for connecting the QEMU virtual machines.
+
+  In this example each QEMU's systems have two interfaces. The first is
+  external interface with internet access and DHCP autoconfiguration. The
+  second interface is for internal networking, so virtual systems can access
+  each others and will be available from host system.
+
+  Enabling the VDE networking.
+
+  1. Configure tap1 and tap2 interface:
+  
+    auto tap1
+    iface tap1 inet dhcp
+        vde2-switch -
+        vde2-slirp -dhcp
+
+    auto tap2
+    iface tap2 inet static
+        address 10.0.3.1
+        netmask 255.255.255.0
+        vde2-switch -
+
+  2. Start interfaces:
+
+    # ifup tap1
+    # ifup tap2
+
+  3. Add the user to vde-net group:
+
+    # adduser user vde-net
+
+  3. Start the QEMUs with different MAC addresses:
+
+    $ vdeq qemu -m 660 -net nic,vlan=1,macaddr=52:54:00:12:01:00
+    -net vde,vlan=1,sock=/var/run/vde2/tap0.ctl
+    -boot c -hda Debian1.img
+
+    $ vdeq qemu -m 660 -net nic,vlan=1,macaddr=52:54:00:12:02:00
+    -net vde,vlan=1,sock=/var/run/vde2/tap0.ctl
+    -boot c -hda Debian2.img
+
+  4. Configure the network inside QEMUs' virtual systems:
+
+    debian1# cat > /etc/network/interfaces << END
+    auto lo
+
+    iface lo inet loopback
+    auto eth0
+    iface eth0 inet dhcp
+
+    auto eth1
+    iface eth1 inet static
+	address 10.0.3.101
+	netmask 255.255.255.0
+	broadcast 10.0.3.255
+    END
+
+    debian2# cat > /etc/network/interfaces << END
+    auto lo
+
+    iface lo inet loopback
+    auto eth0
+    iface eth0 inet dhcp
+
+    auto eth1
+    iface eth1 inet static
+	address 10.0.3.102
+	netmask 255.255.255.0
+	broadcast 10.0.3.255
+    END
+
+  5. Check if the systems are available:
+    
+    # ping 10.0.3.101
+    # ping 10.0.3.102
+
+  You can also start the VDE networking without root privileges:
+  
+    $ LD_PRELOAD=/usr/lib/vde2/libvdetap.so vde_switch -s /tmp/vde1.ctl -d
+    $ nohup slirpvde -s /tmp/vde1.ctl -dhcp &
+    $ vdeq qemu -net nic,vlan=1,macaddr=52:54:00:12:01:00
+    -net vde,vlan=1,sock=/tmp/vde1.ctl
+    -boot c -hda Debian1.img
+    $ vdeq qemu -net nic,vlan=1,macaddr=52:54:00:12:02:00
+    -net vde,vlan=1,sock=/tmp/vde1.ctl
+    -boot c -hda Debian2.img
+
+  In this case the networking is available only inside virtual machines.
+
+
+  Managment console
+  -----------------
+
+  You can connect to remote console with unixterm command:
+  
+    $ unixterm /var/run/vde2/tap0.mgmt
+
+
+ -- Piotr Roszatycki <dexter at debian.org>  Thu, 14 Dec 2006 10:22:19 +0100

Added: vde2/trunk/debian/network/if-post-down.d/vde2
===================================================================
--- vde2/trunk/debian/network/if-post-down.d/vde2	2006-12-20 11:22:33 UTC (rev 39)
+++ vde2/trunk/debian/network/if-post-down.d/vde2	2006-12-20 11:32:40 UTC (rev 40)
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+VDE_SWITCH=/usr/bin/vde_switch
+SLIRPVDE=/usr/bin/slirpvde
+
+DAEMON=/usr/bin/daemon
+
+case $IFACE in
+    tap*)
+	# Remainder of script.
+    ;;
+    *)
+	# Not a tun/tap device.
+	exit 0
+    ;;
+esac	
+
+PIDFILE="/var/run/vde2/$IFACE-plug.pid"
+CTLFILE="/var/run/vde2/$IFACE.ctl"
+if [ -f $PIDFILE ]; then
+    if [ -x $DAEMON ]; then
+	$DAEMON -n "vde2_plug_$IFACE" -F $PIDFILE --stop
+    else
+	start-stop-daemon --stop --quiet --pidfile $PIDFILE
+    fi
+    rm -f $PIDFILE
+fi
+
+PIDFILE="/var/run/vde2/$IFACE-slirp.pid"
+if [ -f $PIDFILE ]; then
+    start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+    	--oknodo --exec $SLIRPVDE
+    rm -f $PIDFILE
+fi
+
+PIDFILE="/var/run/vde2/$IFACE.pid"
+CTLDIR="/var/run/vde2/$IFACE.ctl"
+if [ -f $PIDFILE ]; then
+    start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+	--oknodo --exec $VDE_SWITCH
+    rm -f $PIDFILE
+fi
+
+rm -rf $CTLDIR
+rm -f $CTLDIR.*


Property changes on: vde2/trunk/debian/network/if-post-down.d/vde2
___________________________________________________________________
Name: svn:executable
   + *

Added: vde2/trunk/debian/network/if-pre-up.d/vde2
===================================================================
--- vde2/trunk/debian/network/if-pre-up.d/vde2	2006-12-20 11:22:33 UTC (rev 39)
+++ vde2/trunk/debian/network/if-pre-up.d/vde2	2006-12-20 11:32:40 UTC (rev 40)
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+VDE_SWITCH=/usr/bin/vde_switch
+VDE_PLUG=/usr/bin/vde_plug
+SLIRPVDE=/usr/bin/slirpvde
+DPIPE=/usr/bin/dpipe
+
+USER=vde2-net
+GROUP=vde2-net
+DAEMON=/usr/bin/daemon
+
+if [ ! -x $VDE2_SWITCH ] || [ ! -x $SLIRPVDE ]; then
+  exit 0
+fi
+
+case $IFACE in
+    tap*)
+	# Remainder of script.
+    ;;
+    *)
+	# Not a tun/tap device.
+	exit 0
+    ;;
+esac	
+
+# Create directory if missing
+if ! [ -d /var/run/vde2 ]; then
+    mkdir -p /var/run/vde2
+    chown vde2-net:vde2-net /var/run/vde2
+    chmod 2770 /var/run/vde2
+fi
+
+# vde2-switch [-|<args>]
+if [ -n "$IF_VDE2_SWITCH" ]; then
+    set -- $IF_VDE2_SWITCH
+    test "$1" = "-" && shift
+    PIDFILE="/var/run/vde2/$IFACE.pid"
+    CTLDIR="/var/run/vde2/$IFACE.ctl"
+    MGMTFILE="/var/run/vde2/$IFACE.mgmt"
+    start-stop-daemon --start --quiet --pidfile $PIDFILE \
+        --exec $VDE_SWITCH -- \
+	    -s $CTLDIR -m 660 -g $GROUP -p $PIDFILE -t $IFACE \
+	    -M $MGMTFILE --mgmtmode 660 -d "$@"
+fi
+
+# vde2-plug <dpipe_cmd2>
+if [ -n "$IF_VDE2_PLUG" ]; then
+    set -- $IF_VDE2_PLUG
+    PIDFILE="/var/run/vde2/$IFACE-plug.pid"
+    CTLDIR="/var/run/vde2/$IFACE.ctl"
+    if [ -x $DAEMON ]; then
+	$DAEMON -n "vde2_plug_$IFACE" -F $PIDFILE -- $DPIPE $VDE_PLUG -g vde2-net -m 660 $CTLDIR = "$@"
+    else
+	start-stop-daemon --start --quiet --pidfile $PIDFILE \
+	    --make-pidfile --background \
+	    --exec $DPIPE -- $VDE_PLUG -g $GROUP -m 660 $CTLDIR = "$@"
+    fi
+fi
+
+# vde2-slirp [-|<args>]
+if [ -n "$IF_VDE2_SLIRP" ]; then
+    set -- $IF_VDE2_SLIRP
+    test "$1" = "-" && shift
+    PIDFILE="/var/run/vde2/$IFACE-slirp.pid"
+    CTLDIR="/var/run/vde2/$IFACE.ctl"
+    start-stop-daemon --start --quiet --pidfile $PIDFILE \
+	--chuid $USER \
+	--exec $SLIRPVDE -- \
+	    -s $CTLDIR -m 660 -p $PIDFILE -d "$@"
+fi


Property changes on: vde2/trunk/debian/network/if-pre-up.d/vde2
___________________________________________________________________
Name: svn:executable
   + *

Added: vde2/trunk/debian/postinst
===================================================================
--- vde2/trunk/debian/postinst	2006-12-20 11:22:33 UTC (rev 39)
+++ vde2/trunk/debian/postinst	2006-12-20 11:32:40 UTC (rev 40)
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "configure" ]; then
+    if ! getent passwd vde2-net >/dev/null; then
+        adduser --quiet --system --group --no-create-home --home /var/run/vde2 vde2-net
+    fi
+
+    if ! [ -d /var/run/vde2 ]; then
+        mkdir -p /var/run/vde2
+    fi
+
+    if ! dpkg-statoverride --list /var/run/vde2 >/dev/null; then
+        chown vde2-net:vde2-net /var/run/vde2
+        chmod 2770 /var/run/vde2
+    fi
+
+    if [ ! -e /dev/.devfsd ] && [ ! -e /dev/net/tun ]; then
+        (cd /dev && MAKEDEV tun)
+    fi
+fi

Added: vde2/trunk/debian/postrm
===================================================================
--- vde2/trunk/debian/postrm	2006-12-20 11:22:33 UTC (rev 39)
+++ vde2/trunk/debian/postrm	2006-12-20 11:32:40 UTC (rev 40)
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "purge" ] ; then
+    deluser --quiet vde2-net 2>/dev/null || true
+    delgroup --quiet vde2-net 2>/dev/null || true
+fi

Added: vde2/trunk/debian/watch
===================================================================
--- vde2/trunk/debian/watch	2006-12-20 11:22:33 UTC (rev 39)
+++ vde2/trunk/debian/watch	2006-12-20 11:32:40 UTC (rev 40)
@@ -0,0 +1,5 @@
+# format version number, currently 2; this line is compulsory!
+version=2
+
+# Automatically generated by cvsdebuscan at Thu, 07 Dec 2006 12:21:28 +0100
+http://sf.net/vde/vde2-([0-9.]*)\.tar\.bz2




More information about the Pkg-vsquare-changes mailing list