I have two offices connected to each other using pfSense and OpenVPN. In the main office, OpenVPN is used as the server and in the branch office, OpenVPN as the client. Both LAN has visibility of the other one.

Now, the pfSense of the branch office must be replaced by a Raspberry Pi. Is it possible to configure OpenVPN in Raspbian to do Site 2 Site VPN with the main office?



The pi is pretty much link any other linux system in this regard. It's difficult to give further advice without knowing more details of your setup.

  • The main office uses pfSense firewall, which includes OpenVPN. It is configured as Peer to Peer (shared key), UDP protocol, over 1194 port. The encryption is AES-128-CBC adn auth digest is SHA1 160bit. The main office lan is and the branch office lan is The IPv4 tunnel network is – Xuti Nov 27 '15 at 15:23
  • Doesn't sound massively difficult to set up. I would suggest trying it and if you get stuck either editing your question or posting a seperate question with more information on where you got stuck. Take the setup a step at a time, first get the VPN tunnel up and running, then worry about routing so that the networks can see each other. – Peter Green Nov 27 '15 at 15:52
  • 1
    I have done this steps: 1-Edit this file: nano /etc/sysctl.conf 2-Uncomment this line: net.ipv4.ip_forward = 1 3-sysctl -p /etc/sysctl.conf 4-Install openvpn: sudo apt-get install openvpn 5-Create a conf file: sudo nano /etc/openvpn/vpn.conf 6-Edit this file: nano /etc/default/openvpn 7-Uncomment this line: AUTOSTART=all 8-Run: sudo iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE 9- Run: sudo apt-get install iptables-persistent sudo /etc/init.d/iptables-persistent save sudo /etc/init.d/iptables-persistent reload – Xuti Dec 16 '15 at 19:38
  • Now my problem resides in the conf file. I want to use static.key, shared between server ( / 24) and the branch office ( / 24). Please, can you show me an example of it? – Xuti Dec 16 '15 at 19:39
  • 1
    @Xuti you mean TLS key? There's an official step-by-step guide – Alexey Vesnin Mar 26 '16 at 15:29

Finally, I have solved my problem. Here are the steps:

  1. Connect to my server pfSense via SSH and open the openvpn.conf file.
  2. Copy entire content to openvpn.conf file in my raspberry Pi.
  3. Invert the network configuration (local lan and remote lan)
  4. Configure openvpn to connect at startup.

Voila! Everything worked perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.