Host-to-host VPN HOWTO
How to create a VPN between two machines running Virtualbricks
Step 1: Configuring the VPN server
A Virtualbricks VPN server will require three bricks:
- A Tap brick, that will provide a new network interface to your system
- A Tunnel server brick, that will listen for UDP traffic on a specific port and authenticate the clients
- A Switch brick, that will connect the other two bricks together.
Configuring a VPN server then is just a matter of creating these three bricks and connecting them together. First of all, start Virtualbricks on the server and click on the button "New Brick".
This simple operation will be repeated for all the bricks we want to create. We will start creating a switch called "local switch":
In the same way we can create a Tap. The name we give to the tap will be used also to create the network interface in you system, so it is a good idea to choose a simple and short, like "vbt0" in the example.
And in the same way we create the Tunnel Server:
The configuration for the two bricks we just created is simple. We want for instance that the TAP device is connected to the local_switch and we also want to provide a fixed IP configuration to the associated interface:
The configuration for the Tunnel Server brick is also very simple. Connect the tunnel to the switch, set a listening port and a password that will be used to generate the symmetrical key used for authenticating and encrypting data:
The VPN server configuration is done! Now you can start the bricks by using the "Start all bricks" button on the toolbar, to get your VPN server up and running.
Step 2: Configuring the VPN client
Also for the client, you will need three Bricks. Create a Switch and a Tap as you did for the server, then add a Tunnel Client brick:
The configuration interface for the Tunnel Client brick will ask the endpoint and the shared password used to connect to the server previously created:
Don't forget to configure the Tap brick so it has an IP address on the same subnet as the server:
Done! If everything was set up correctly, you should be able to run all the bricks on the client side too, and the two machines will be connected in a VPN!
Easy, isn't it? No more painful Op*nVPN configuration! Your VPN is just a few clicks away. Let's have a look to the bricks topology on the server:
And on the client:
This kind of VPN can be extended also to connect together Qemu/KVM virtual machines on different hosts through the same network. Very useful every time you have to run a single, big topology and you have a bunch of hosts available!
Have you enjoyed this tutorial? Stay tuned for more coming.






