# VTUN alternative



## LoZio (Nov 4, 2009)

Hi 
 i'm experimenting with VTUN to have my local and remote networks connected via a compressed tunnel over a wan link.
I'm wondering if someone is using something more up-to-date than vtun (it seems a dead project) or something that will do a more aggressive compression. I don't care about latency, since it is a remote backup site (I need a tunnel, rsync and others are not an option).
Thanks


----------



## SirDice (Nov 4, 2009)

How about tunneling tar and/or dump over ssh?


----------



## varda (Nov 4, 2009)

Yes, SirDice is completely right. Why are you tring some strange piece of software and ignore ssh. If you have on both sides of  OpenSSH and exactly needs a tunnel then I'm breefly explain to you.

Enable sshd at least on remote system. Create with ssh-keygen and exchange a private key between systems. Then run on intitiating side command something like:

```
ssh -C -i /path/to/key -w 1001:1002 RE_MO_TE_IP
```
This will create tun1001 on one system and tun1002 on remote system. Then configure interfaces and routing. For example:

```
ifconfig tun1001 10.0.0.1 10.0.0.2
route add 192.168.2.0/24 10.0.0.2
```
And remote side:

```
ifconfig tun1002 10.0.0.2 10.0.0.1
route add 192.168.1.0/24 10.0.0.1
```
Where 192.168 local networks on each side.

But your remote side will be reachable by 10.0.0.2 even if you do not need LAN's. Also you can execute command to ifconfig remote side when ssh session establishes if generated key will provide root access:

```
ssh -C -i /path/to/key -w 1001:1002 RE_MO_TE_IP ifconfig tun1002 10.0.0.2 10.0.0.1 netmask 255.255.255.255 up
```

It's on your creativity how to automate tunneling.

Anyway you'll get encrypted and compressed tunnel between systems very easily. 

Read man ssh and take a look at -w key for detaied explanations. Explore ssh-keygen how to generate keys.


----------



## SirDice (Nov 4, 2009)

I was more or less thinking about doing something like:

```
tar -zcvf - -C /some/dir thisdir | ssh backup@remote.machine "cat > /backup/backup.tgz"
```

This would backup /some/dir/thisdir and store it on remote.machine as /backup/backup.tgz.


----------



## LoZio (Nov 5, 2009)

varda said:
			
		

> Yes, SirDice is completely right. Why are you [...]
> Read man ssh and take a look at -w key for detaied explanations. Explore ssh-keygen how to generate keys.



Thanks for the reply. I had to cut it short, but using tar is not appropriate since I have some applications needing a routed path.
I'll try the ssh method to see if compression is more effective than vtun, but I suspect it will use the same (lzo or zlib) libraries as vtun.
Encryption is not a problem since my wan link is a dedicated MPLS.
Now I'll dive into manpages 
Thanks


----------



## SirDice (Nov 5, 2009)

LoZio said:
			
		

> Encryption is not a problem since my wan link is a dedicated MPLS.


You do realize that the ISPs in between can see that traffic?


----------



## varda (Nov 5, 2009)

LoZio said:
			
		

> I'll try the ssh method to see if compression is more effective than vtun, but I suspect it will use the same (lzo or zlib) libraries as vtun.



You can try to use 7z or lzma which achieves maximum compression level presently. Look for it Google and ports collection. Just pipe output of archiver to tar as SirDice suggested. Something like

```
tar -cvf - ./ | 7z a -si archive.tar.7z
```

There are number of usage ways to your preference.


----------



## LoZio (Nov 6, 2009)

SirDice said:
			
		

> You do realize that the ISPs in between can see that traffic?



Yes I do, but it's a kind of "special" provider.
Thanks, in any case.


----------



## LoZio (Nov 6, 2009)

varda said:
			
		

> You can try to use 7z or lzma which achieves maximum compression level presently. Look for it Google and ports collection. Just pipe output of archiver to tar as SirDice suggested. Something like
> 
> ```
> tar -cvf - ./ | 7z a -si archive.tar.7z
> ...



This is more or less the method I'm using now, but it does not match with my problem, that is to have a routed-compressed path.
I saw in ssh man page that it can use GZIP that seems to be more effective than LZO or ZLIB used in VTUN.
I'll try with my own data to see which best matches my needs.
Thanks


----------

