| :: Setting up VPN using vTun (Vitual Tunnel) :: | |||
| HOME |

Can't allocate tun device . No such file or directory(2)In order to circumvent this, i executed #aclocal; autoconf commands in the source tree and then followed the normal installation instructions. These commands create a new configure script that will locate the said file. I did not use any RPM's as at the time of this writing as no RPM's were available for my system.
shashank@zidler:~> cat /etc/vtund.conf
options {
# type stand; # stand(default), inet (used only at server)
port 5000; # Server will listen on this port for incoming requests.
syslog daemon; # Syslog facility
# Path to various programs
ppp /usr/sbin/pppd; #Path to the pppd. Use "which pppd" to find this.
ifconfig /sbin/ifconfig;
route /sbin/route;
firewall /sbin/iptables;
ip /sbin/ip;
}
# Default session options
default {
# type tun; #tun, ether, tty(default), pipe (Used only at Server)
# proto tcp; #udp, tcp(default) (Used only at server)
# device tun0;
compress no; # no, yes, zlib:(1-9), lzo:(1-9); e.g. zlib:1 (default) (Used only at server)
encrypt yes; #yes, no (used only at server)
stat yes; #yes, no: check /var/log/vtund/SessionName_X
speed 0; #By default maximum speed, NO shaping (Used only at server)
# keepalive yes; #Used to keep alive the connection. (Used only at server)
}
# TUN example. Session 'cobra'.
IP-Tunnel {
passwd abcd1234; # Password
type tun; # IP tunnel
proto tcp; # UDP protocol
compress lzo:9; # LZO compression level 9
encrypt yes; # Encryption
keepalive yes; # Keep connection alive
stat yes; #yes, no
up {
# Connection is Up
# 10.3.0.1 - local, 10.3.0.2 - remote
ifconfig "%% 192.168.254.201 pointopoint 192.168.254.200 mtu 1450";
route "add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.254.200";
};
down {
# Connection is down
# 10.3.0.1 - local, 10.3.0.2 - remote
ifconfig "%% down";
route "del -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.254.200";
};
}
---------------------------------------------------------
shashank@mia:~> cat /etc/vtund.conf
options {
port 5000; # Listen on this port.
syslog 7; # Syslog facility
# Path to various programs
ppp /usr/sbin/pppd;
ifconfig /sbin/ifconfig;
route /sbin/route;
firewall /sbin/tables;
ip /sbin/ip;
}
# Default session options
default {
# type tun; #tun, ether, tty, pipe
# proto tcp; #udp, tcp
compress no; # no, yes, zlib, lzo
encrypt yes; #yes, no
stat yes; #yes, no
speed 0; # By default maximum speed, NO shaping
}
# TUN example. Session 'cobra'.
IP-Tunnel {
passwd abcd1234; # Password
type tun; # IP tunnel
proto udp; # UDP protocol
compress lzo:9; # LZO compression level 9
encrypt yes; # Encryption
keepalive yes; # Keep connection alive
# persist yes;
up {
# Connection is Up
ifconfig "%% 192.168.254.200 pointopoint 192.168.254.201 mtu 1450";
route "add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.254.201";
};
down {
# Connection is down
ifconfig "%% down";
route "del -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.254.201";
};
}
Note how I have added/deleted routes in the two files.
shashank@zidler:# vtund -s -f /etc/vtund.confNOTE THAT I am using the -f /etc/vtund.conf to specify the configuration file as vtund uses /usr/local/etc/vtund.conf by default(In the man page for vtund, the default configuration file is specified as "/etc/vtund.conf", which is erroneous). You don't need to specify this option, if you use /usr/local/etc/vtund.conf.
[shashank@mia shashank]# vtund -f /etc/vtund.conf IP-Tunnel zidler
shashank@zidler:/home/shashank# tail -n 5 /var/log/messages May 31 22:00:29 zidler vtund[5553]: VTUN server ver (Name,0) 05/31/2003 (stand) May 31 22:00:36 zidler vtund[5554]: Session IP-Tunnel[131.193.50.165:55142] opened May 31 22:00:36 zidler vtund[5554]: LZO compression[level 9] initialized May 31 22:00:36 zidler vtund[5554]: BlowFish encryption initialized May 31 22:00:36 zidler /etc/hotplug/net.agent: invoke ifup tun0 -------------------------------------------------------------------- [shashank@mia shashank]# tail -n 6 /var/log/messages May 31 21:51:21 mia vtund[1146]: VTun client ver 2.6 05/31/2003 started May 31 21:51:21 mia vtund[1146]: Connecting to zidler May 31 21:51:21 mia vtund[1146]: Session IP-Tunnel[zidler] opened May 31 21:51:21 mia /etc/hotplug/net.agent: invoke ifup tun0 May 31 21:51:21 mia vtund[1146]: LZO compression[level 9] initialized May 31 21:51:21 mia vtund[1146]: BlowFish encryption initialized
shashank@zidler:/home/shashank# ifconfig
--SNIP--
tun0 Link encap:Point-to-Point Protocol
inet addr:192.168.254.201 P-t-P:192.168.254.200 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1450 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

--------------------------------------------------------------------------------------------
Source File Purpose Function Name
--------------------------------------------------------------------------------------------
lfd_encrypt.c Handles Encryptions int encrypt_buf(...), int int decrypt_buf(...)
lfd_lzo.c Handles Compression(lzo) int comp_lzo(...), int decomp_lzo(...)
lfd_zlib.c Handles Compression(zlib) int zlib_comp(...), int zlib_decomp(...)
lfd_shaper.c Was't doing much at this
time, but will be modified
in future.
--------------------------------------------------------------------------------------------
ushort packet_len (2 Bytes) int padding (1-8 bytes), with first bytes specifying the length of padding. n1-bytes payloadThus vtun adds a minimum of (1 (padding) + 2) = 3 bytes and Maximum of (8(padding) + 2) = 10 bytes of overhead. If compression is used then this overhead will be further reduced.
seq_no: 0
Y%*i%|\NU]\Dw-5jOba4Q@D8`?5t#"iBFna^M1OF)t?6++f)m6ZIR:aOY3EvO1Tu!7UhI&0R6O%\uked#BIpvGARZfd+3;
"Olq9Q3J@J5E(,2m,5KVA^}bLse2 4gcVI}C\ccB4*J[VTg(;YIyr.Gg/Z#C]Y)OBs{AXYU}&2Ut6w1+CG kn#zdA?D6H/
U&$lGwG9vgeg]7a+C@R]-\z)]=b=nGLEMQ31dtJ\^K_Wc\b(|Pe+I{N(;3EEtqjC^9nD/:)"|aeZ_)s2n ['i}\8D#.7)k2B\Vl2su4q
This data was generated using
modudpgen, a synonym for Modified UDP generator and
sniffed using ethereal.
--------------------------------------------------------
Application Data Data on wire Overhead
(No comp)
--------------------------------------------------------
100 204 104
275 372 97
350 452 102
502 604 102
613 716 103
750 852 102
849 948 99
917 1020 103
1010 1108 98
1200 1300 100
--------------------------------------------------------
Average Overhead: 101
--------------------------------------------------------
seq_no: 0
Y%*i%|\NU]\Dw-5jOba4Q@D8`?5t#"iBFna^M1OF)t?6++f)m6ZIR:aOY3EvO1Tu!7UhI&0R6O%\uked#BIpvGARZfd+3;
"Olq9Q3J@J5E(,2m,5KVA^}bLse2 4gcVI}C\ccB4*J[VTg(;YIyr.Gg/Z#C]Y)OBs{AXYU}&2Ut6w1+CG kn#zdA?D6H/
U&$lGwG9vgeg]7a+C@R]-\z)]=b=nGLEMQ31dtJ\^K_Wc\b(|Pe+I{N(;3EEtqjC^9nD/:)"|aeZ_)s2n ['i}\8D#.7)k2B\Vl2su4q
This data was generated using
modudpgen, a synonym for Modified UDP generator and
sniffed using ethereal.
----------------------------------------------------------------------------------------
Application Data Data on wire Overhead Data on Wire Overhead
(full Comp) (Full Comp)
lzo:9 zlib:9
----------------------------------------------------------------------------------------
100 204 104 180 80
275 380 105 348 73
350 460 110 412 62
502 612 110 540 38
613 724 111 636 23
750 860 110 748 -2
849 956 107 828 -21
917 1028 111 884 -33
1010 1116 106 964 -46
1200 1308 108 1116 -84
----------------------------------------------------------------------------------------
Average Overhead: 108.2 9
----------------------------------------------------------------------------------------
route add -net network/netmask gw gateway-ipAlthough this method is simple for small networks, it becomes exceedingly difficult to maintain such routes once your network reaches a decent size (> 5 nodes, say). Hence one should avoid using this method, unless you have a very small network.
struct lfd_mod {
char *name;
int (*alloc)(struct vtun_host *host);
int (*encode)(int len, char *in, char **out);
int (*avail_encode)(void);
int (*decode)(int len, char *in, char **out);
int (*avail_decode)(void);
int (*free)(void);
struct lfd_mod *next;
struct lfd_mod *prev;
};