11. (non necessario) usare guessnet o similare per configurare in modo
2   automatico le interfacce di rete
3
42. lanciare vde_switch (spanning tree ON)
5
6        vde_switch -F -tap tap0 -sock /tmp/test.ctl -M /tmp/test.mgmt
7
83. lanciare vde_autolink
9
10	vde_autolink -s /tmp/test.ctl -S /tmp/test.mgmt -M /tmp/test.alink
11
124. definire il link in vde_autolink
13  (tappo6 e tappo sono due entry di /etc/hosts che ho settato per comodita',
14   ovviamente si possono usare i nomi o gli indirizzi ip)
15
16	addwire SSH dpipe ssh lbigliar@$remotehost vde_plug = vde_plug -p $myport $mysock
17        addlink VDEUNI tappo6 tappo
18        addtypelink VDEUNI SSH
19        linkonoff VDEUNI 1
20
215. scriptino di esempio che tira su e giu' l'interfaccia del tunnel
22   (necessita superuser)
23
24	#!/bin/sh
25
26	ALINKMGMT="/tmp/test.alink"
27	QUERYCMD="unixtermcmd"
28	UPTUNN="ifup tap0"
29	DOWNTUNN="ifdown tap0"
30
31	TUNNEL=0
32
33	while [ 0 ]
34	do
35		OUTPUT=`$QUERYCMD $ALINKMGMT runninglinks`
36		RET=$?
37		if [ $RET -eq 255 ]; then
38			if [ $TUNNEL -eq 1 ]; then
39				$DOWNTUNN
40			fi
41			exit
42		fi
43		if [ ! $RET -eq 0 ]; then
44			continue
45		fi
46		echo "$OUTPUT" | grep RHOST > /dev/null
47		if [ $? -eq 0 ]; then
48			if [ $TUNNEL -eq 0 ]; then
49				echo ---$UPTUNN---
50				$UPTUNN 2>&1 > /dev/null
51				TUNNEL=1
52			fi
53		else
54			if [ $TUNNEL -eq 1 ]; then
55				echo ---$DOWNTUNN---
56				$DOWNTUNN 2>&1 > /dev/null
57				TUNNEL=0
58			fi
59		fi
60		sleep 30
61	done
62
63
64
65
66