-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Setup
152 lines (137 loc) · 3.85 KB
/
README.Setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
VTun Setup recommendations and Config samples.
1. General recommendations:
1.1 IP tunnel
type tun;
proto udp;
keepalive yes;
up {
ifconfig "%% xxxxxxx";
};
This will give you reliable and the fastest possible Point-to-Point
tunnel. Use this tunnel type whenever it's possible, especially
if performance and efficiency is concerned. If you need compression,
use LZO or TCP protocol and ZLIB.
1.2 Ethernet tunnel
type ether;
proto udp;
keepalive yes;
up {
ifconfig "%% xxxxxxx";
};
This will give you reliable and fast Ethernet tunnel. You can tunnel
any protocol that works with Ethernet IP, IPX, Appletalk, DECnet, etc
If you need compression, use LZO or TCP protocol and ZLIB.
1.3 PPP or SLIP tunnel
type tty;
proto tcp;
keepalive yes;
up {
ppp "xxxxxxxxxxx";
};
This will give you reliable and fast PPP or SLIP tunnel.
You can safely use compression.
1.4 Anything else :))
type pipe; or type tty; if it depends on TTYs
proto tcp;
keepalive yes;
up {
program /xx/xx "yyyyy";
}
Never use UDP with 'pipe' tunnel type. VTun allows it, but it is not
a good idea. Compression, encryption and shaping are safe for almost
everything.
2. Configuration samples.
2.1 Example 1.
We have to create virtual tunnels between 3 private IP networks in
different locations on the Internet. All networks are being serviced
by Linux boxes having dedicated links and a fixed IP address to the
Internet.
Network addresses and servers:
192.168.0.0 - Server S1
192.168.1.0 - Server S2
192.168.2.0 - Server S3
We can setup S1 as a VTun server for S2 and S3 and create 3 tunnels.
But in this case we'll get a star net topology with unreliable and
inefficient routing. That's why we will create 6 tunnels, each server
will have two tunnels with other servers.
S1 will have only server config, S2 will have server and client
config and S3 only client config.
Here are VTun configs for each server:
Server S1
default {
type tun;
proto udp;
comp lzo:1;
keepalive yes;
}
# Tunnel between S1 and S2 (192.168.0.0 <-> 192.168.1.0)
# Server entry
s2 {
pass XXXX;
up {
ifconfig "%% 192.168.0.1 pointopoint 192.168.0.2";
route "add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.0.2";
program /sbin/arp "-sD 192.168.0.2 eth0 pub";
};
}
# Tunnel between S1 and S3 (192.168.0.0 <-> 192.168.2.0)
# Server entry
s3_1 {
pass XXXX;
up {
ifconfig "%% 192.168.0.1 pointopoint 192.168.0.3";
route "add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.0.3";
program /sbin/arp "-sD 192.168.0.3 eth0 pub";
};
}
Start vtund as 'vtund -s'
Server S2
default {
type tun;
proto udp;
comp lzo:1;
keepalive yes;
}
# Tunnel between S2 and S1 (192.168.1.0 <-> 192.168.0.0)
# Client entry
s2 {
pass XXXX;
up {
ifconfig "%% 192.168.0.2 pointopoint 192.168.0.1";
route "add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1";
};
}
# Tunnel between S2 and S3 (192.168.1.0 <-> 192.168.2.0)
# Server entry
s3_2 {
pass XXXX;
up {
ifconfig "%% 192.168.0.2 pointopoint 192.168.0.3";
route "add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.0.3";
};
}
Start vtund as
'vtund -s'
'vtund s2 real_address_of_s1'
Server S3
# Tunnel between S3 and S1 (192.168.2.0 <-> 192.168.0.0)
# Client entry
s3_1 {
pass XXXX;
up {
ifconfig "%% 192.168.0.3 pointopoint 192.168.0.1";
route "add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1";
};
}
# Tunnel between S3 and S2 (192.168.2.0 <-> 192.168.1.0)
# Client entry
s3_2 {
pass XXXX;
up {
ifconfig "%% 192.168.0.3 pointopoint 192.168.0.2";
route "add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.0.2";
};
}
Start vtund as
'vtund s3_1 real_address_of_s1'
'vtund s3_2 real_address_of_s2'