vtun is an excellent little utility that can be used to create network tunnels from one network to another. It offers encryption options and can be used in lieu of IPSec in some situations, and I find it easier to configure for certain use cases such as bridging private internal networks across a public network.

The RPM is available off a link from the homepage and can be installed easily with.

Install vtun

An RPM package for vtun is available from sourceforge.net, you can either install directly from there, or download the RPM to your own yum repo, and install with yum.

If you go the yum repo route, the dependencies will be resolved automatically, however if you’re starting from a base minimal install and want to install via RPM, you’ll also need to install lzo and xinetd.

Bridging remote networks with vtund

Bridging remote networks in CentOS using vtund.

Vtun configuration

Now that we have the package installed, lets edit the configuration file /etc/vtund.conf

vi /etc/vtund.conf
# need to set the following
# server type
# port
# ip address or hostname to bind to
# interface
# The following are recommended options
# passwd
# syslog

The default vtund.conf has a lot of examples that are commented out, and you can also find some online.

This is a master server conf for a layer2 bridge

options {
  # Path to various programs
  ifconfig  /sbin/ifconfig;
  route     /sbin/route;
  firewall  /sbin/iptables;
korsar {
  pass  Pa$$Wd;     # Password
  type  ether;      # Ethernet tunnel
  up {
    # Connection is Up
    ifconfig "%% up";
    program "brctl addif br0 %%"
  down {
    # Connection is Down
    ifconfig "%% down";