summaryrefslogtreecommitdiff
path: root/network/vde2/rc.vde2
diff options
context:
space:
mode:
authorSean Donner <sean.donner@sbcglobal.net>2010-05-11 20:01:45 +0200
committerRobby Workman <rworkman@slackbuilds.org>2010-05-11 20:01:45 +0200
commit2f62f05d45b76d410ffdc91a6d3c1c413b7db759 (patch)
treed1693dda687153ae0b14be591ed24caa6ce89da0 /network/vde2/rc.vde2
parent31ed2c363fc98bc200244b4cf2356ccacf7e6771 (diff)
downloadslackbuilds-2f62f05d45b76d410ffdc91a6d3c1c413b7db759.tar.gz
network/vde2: Added to 12.0 repository
Diffstat (limited to 'network/vde2/rc.vde2')
-rw-r--r--network/vde2/rc.vde274
1 files changed, 74 insertions, 0 deletions
diff --git a/network/vde2/rc.vde2 b/network/vde2/rc.vde2
new file mode 100644
index 0000000000..9cc1beceb0
--- /dev/null
+++ b/network/vde2/rc.vde2
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+#=========================== EDIT THE FOLLOWING VARIABLES ==========================
+# _________________________________________________________________________________
+# | |
+# | Interface name to use for the TAP device |
+# | |
+ TAP_IF="tap0"
+# |_________________________________________________________________________________|
+# | |
+# | IP Address/Subnet in CIDR Notation for the Virtual Network |
+# | |
+ TAP_NET="10.10.10.1/24"
+# |_________________________________________________________________________________|
+#
+#=========================== DO NOT EDIT BELOW THIS LINE ============================
+
+start(){
+ echo -n "Starting VDE Switch..."
+
+ # Load tun module
+ modprobe tun || { echo "Error, cannot load 'tun' module. Exiting..." ; exit 1 ; }
+ sleep 1
+
+ # Start tap switch
+ vde_switch -tap ${TAP_IF} -daemon || { echo "Error, cannot assign IP to ${TAP_IF}. Exiting..." ; exit 1 ; }
+
+ # Bring tap interface up
+ ip addr add ${TAP_NET} dev ${TAP_IF}
+ ip link set ${TAP_IF} up
+
+ #chmod 666 /tmp/vde.ctl
+ chmod -R a+rwx /var/run/vde.ctl
+
+ # Apply workaround
+ echo 1024 > /proc/sys/dev/rtc/max-user-freq
+ echo
+}
+
+
+stop(){
+ echo -n "Stopping VDE Switch..."
+
+ # Bring tap interface down
+ ip addr flush dev ${TAP_IF}
+ ip link set ${TAP_IF} down
+
+ # Kill VDE switch
+ kill $(pgrep vde_switch)
+ sleep 1
+
+ # Remove tun module
+ modprobe -r tun
+ echo
+}
+
+
+case "$1" in
+ start)
+ start
+ ;;
+
+ stop)
+ stop
+ ;;
+
+ restart)
+ stop
+ start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ ;;
+esac