Slackware 13.1 - Installing vtund (with epkg) ================================= Public domain ******************************************************************************** ### Installation cd /usr/src wget http://sourceforge.net/projects/vtun/files/vtun/3.0.2/vtun-3.0.2.tar.gz su - install cd /usr/src tar xf vtun-3.0.2.tar.gz cd vtun-3.0.2 ./configure --prefix=/usr/ --sysconfdir=/etc/vtun/ --localstatedir=/var/ make sed -ie 's,-o root -g 0,,' Makefile make install DESTDIR=/usr/local/encap/vtun-3.0.2 cd /usr/local/encap mkencap vtun-3.0.2/ logout cd /usr/local/encap epkg vtun-3.0.2 ******************************************************************************** ### Server config: /etc/vtun/vtund.conf options { port 7051; bindaddr { iface eth0; }; } default { #type ether; type tun; proto tcp; keepalive yes; compress no; speed 0; } user1 { device tap-user1; passwd 12345678; persist yes; stat yes; up { ifconfig "%d up"; ifconfig "eth3 0.0.0.0 up"; program /sbin/brctl "addbr br-user1" wait; program /sbin/brctl "addif br-user1 eth3" wait; program /sbin/brctl "addif br-user1 %d" wait; ifconfig "br-user1 up"; }; down { ifconfig "%d down"; #ifconfig "br-user1 down"; #program /sbin/brctl "delbr br-user1" wait; }; } user2 { passwd 654321; stat yes; up { ifconfig "%d up"; ifconfig "eth1 0.0.0.0 up"; program /sbin/brctl "addbr br0" wait; program /sbin/brctl "addif br0 eth1" wait; program /sbin/brctl "addif br0 %d" wait; ifconfig "br0 8.11.14.3 netmask 255.255.255.240"; ifconfig "br0:0 72.3.98.2 netmask 255.255.255.0"; ifconfig "br0:1 72.3.98.4 netmask 255.255.255.0"; route "add default gw 80.191.194.17"; route "add -net 10.103.20.80/28 gw 80.191.194.28"; }; down { ifconfig "%d down"; ifconfig "br0 down"; program /sbin/brctl "delbr br0" wait; }; } ******************************************************************************** ### Server invocation modprobe tun vtund -s -f /etc/vtun/vtund.conf ******************************************************************************** ### Client config: /etc/vtun/vtund.conf options { port 7051; } default { type tun; proto tcp; keepalive yes; } user1 { device tun-user1; persist yes; passwd 123456; up { ifconfig "%% 8.11.22.6 pointopoint 8.19.22.7"; route "del default"; route "add default dev %%"; program "/bin/echo 1 > /proc/sys/net/ipv4/ip_forward"; }; down { ifconfig "%% down"; route "del default"; route "add default gw 10.10.1.6"; program "/bin/echo 0 > /proc/sys/net/ipv4/ip_forward"; }; } ******************************************************************************** ### Client invocation route add -host 10.10.20.6 gw 10.10.1.6 modprobe tun modprobe nf_nat_ftp iptables -t nat -A POSTROUTING -o tun-user1 -j MASQUERADE vtund user1 10.10.2.6 ******************************************************************************** ### Debug invocation with -n modprobe tun vtund -n -s -f /etc/vtun/vtund.conf ******************************************************************************** _BY: Pejman Moghadam_ _TAG: epkg, vtun, tap, tun_ _DATE: 2011-05-10 11:41:36_