• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Help to set up OpenVPN server

Scheduled Pinned Locked Moved OpenVPN
6 Posts 4 Posters 3.0k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N
    nikkilocke
    last edited by Feb 18, 2013, 8:29 PM

    I have pfSense set up as a LAN->Multi-WAN firewall/load balancing router, with 3 WAN ports.

    I want to set up an OpenVPN server on the pfSense, so I can connect in to the network from outside (e.g. on my Android phone), and manage the internal network and pfSense.

    I have set up a server with the following settings:
    Remote Access (SSL/TLS)
    Protocol TCP
    Device mode tun
    Interface any
    Local port 1194
    TLS Authentication
    Peer certificate authority - a root certificate I created in pfSense
    DH Parameters length 1024
    Encryption algorithm AES-128-CBC (128 bit)
    Certificate depth One (Client + Server)
    Tunnel network 192.168.6.0/24
    Compression on
    Inter client on
    Duplicate connections on
    Dynamic IP on
    Address pool on

    I created firewall rules for all my WAN ports to allow TCP & UDP traffic for port 1194

    I then used the Client export wizard to download an Android ovpn file, and imported that into OpenVPN for Android

    I can use my phone to connect to the VPN via wireless from the LAN side of the network. However, most of the time I cannot use it to connect via GPRS to the WAN side.

    I get the following log entries in pfSense:

    
    Feb 18 20:32:33	openvpn[13284]: Re-using SSL/TLS context
    Feb 18 20:32:33	openvpn[13284]: LZO compression initialized
    Feb 18 20:32:33	openvpn[13284]: TCP connection established with [AF_INET]31.111.99.130:52364
    Feb 18 20:32:33	openvpn[13284]: TCPv4_SERVER link local: [undef]
    Feb 18 20:32:33	openvpn[13284]: TCPv4_SERVER link remote: [AF_INET]31.111.99.130:52364
    Feb 18 20:32:51	openvpn[13284]: 31.111.99.130:52364 Authenticate/Decrypt packet error: packet HMAC authentication failed
    Feb 18 20:32:51	openvpn[13284]: 31.111.99.130:52364 TLS Error: incoming packet authentication failed from [AF_INET]31.111.99.130:52364
    Feb 18 20:32:51	openvpn[13284]: 31.111.99.130:52364 Fatal TLS error (check_tls_errors_co), restarting
    
    

    Very occasionally it does connect via GPRS, but not usually for long enough to load the pfSense dashboard - it usually drops out, and fails as above when trying to reconnect.

    Is there anything I can do to fix this?

    1 Reply Last reply Reply Quote 0
    • P
      phil.davis
      last edited by Feb 19, 2013, 1:00 AM

      I am not sure if "ïnterface any" really works like it is imagined (I imagine that it should listen on all interfaces, but I suspect it listens on 1 determined by some scheme?).
      In multi-WAN situations, I make my OpenVPN server listen on LAN. Then I port-forward the port from each WAN IP to the LAN IP. That way, an incoming connect on any WAN gets forwarded to LAN, where the OpenVPN server is listening. It happily responds and the response gets routed back out on the WAN it came from.

      As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
      If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

      1 Reply Last reply Reply Quote 0
      • C
        cmb
        last edited by Feb 19, 2013, 3:21 AM

        "any" binds to *:1194 or whichever port you choose. That isn't very multi-WAN friendly, doing the port forward Phil described is the best solution for multi-WAN in most scenarios.

        1 Reply Last reply Reply Quote 0
        • N
          nikkilocke
          last edited by Feb 19, 2013, 3:47 PM

          I find this advice confusing.

          With everything set up as I said, interface "any", it works fine from my laptop, connected to a different ADSL line, connecting to any of the WAN ports from outside (or, indeed, to the LAN port, if I plug it in to the LAN instead).

          I can see no reason why listening on all ports should be multi-WAN unfriendly.

          I suspect the problem is the GPRS connection, which may be flaky enough to drop the connection (and maybe change IP address). I note that you can set OpenVPN up to use UDP instead of TCP - would this make it any more resilient to dropped connections?

          1 Reply Last reply Reply Quote 0
          • J
            jimp Rebel Alliance Developer Netgate
            last edited by Feb 19, 2013, 6:25 PM

            Multi-WAN with "any" works with TCP because of how the connections are handled in TCP and pf.

            UDP does not work with "any" on Multi-WAN because OpenVPN will source the reply traffic from the IP of the interface that has the default route, so it does not return the proper path.

            Bind to one interface + port forward the rest, it works fine that way.

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

            1 Reply Last reply Reply Quote 0
            • N
              nikkilocke
              last edited by Feb 19, 2013, 7:31 PM

              Thanks, that's clearer.

              I'll do the redirecting bit, so if I decide to change to UDP later (unlikely, but you never know) it won't bite me.

              1 Reply Last reply Reply Quote 0
              6 out of 6
              • First post
                6/6
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                This community forum collects and processes your personal information.
                consent.not_received