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

    Configuring openvpn server and client

    Scheduled Pinned Locked Moved OpenVPN
    43 Posts 4 Posters 10.4k 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.
    • J
      jerryxLinuX
      last edited by

      peer to peer ssl/tls
      my server.conf

      dev ovpns2
      verb 1
      dev-type tun
      tun-ipv6
      dev-node /dev/tun2
      writepid /var/run/openvpn_server2.pid
      #user nobody
      #group nobody
      script-security 3
      daemon
      keepalive 10 60
      ping-timer-rem
      persist-tun
      persist-key
      proto udp
      cipher AES-128-CBC
      auth SHA256
      up /usr/local/sbin/ovpn-linkup
      down /usr/local/sbin/ovpn-linkdown
      local xxxx.xxx.xxx.xxx
      tls-server
      server 10.0.8.0 255.255.255.0
      client-config-dir /var/etc/openvpn-csc
      ifconfig 10.0.8.1 10.0.8.2
      tls-verify "/usr/local/sbin/ovpn_auth_verify tls 'cantonpfs' 1 "
      lport 1194
      management /var/etc/openvpn/server2.sock unix
      push "route 192.168.114.0 255.255.255.0"
      ca /var/etc/openvpn/server2.ca
      cert /var/etc/openvpn/server2.cert
      key /var/etc/openvpn/server2.key
      dh /etc/dh-parameters.1024
      tls-auth /var/etc/openvpn/server2.tls-auth 0
      comp-lzo adaptive
      persist-remote-ip
      float
      push "route 192.168.114.0 255.255.255.0"
      route 192.168.140.0 255.255.255.0

      client.conf

      dev ovpnc1
      verb 1
      dev-type tun
      tun-ipv6
      dev-node /dev/tun1
      writepid /var/run/openvpn_client1.pid
      #user nobody
      #group nobody
      script-security 3
      daemon
      keepalive 10 60
      ping-timer-rem
      persist-tun
      persist-key
      proto udp
      cipher AES-128-CBC
      auth SHA256
      up /usr/local/sbin/ovpn-linkup
      down /usr/local/sbin/ovpn-linkdown
      local 10.1.10.11
      tls-client
      client
      lport 0
      management /var/etc/openvpn/client1.sock unix
      remote xxx.xxxx.xxxx.xxxx 1194
      ifconfig 10.0.8.2 10.0.8.1
      ca /var/etc/openvpn/client1.ca
      cert /var/etc/openvpn/client1.cert
      key /var/etc/openvpn/client1.key
      tls-auth /var/etc/openvpn/client1.tls-auth 1
      comp-lzo adaptive
      resolv-retry infinite

      so my server ip is : 192.168.114.254
      my client ip is : 192.168.140.254

      i can ping from client(140.254) to server(114.254) , but not from server(114.254) to client(140.254)

      any other info needed , sorry for giving less details

      1 Reply Last reply Reply Quote 0
      • johnpozJ
        johnpoz LAYER 8 Global Moderator
        last edited by

        please just post up a gui shot of your client config and server config..  Your not editing the .conf manually are you?

        What do you have in your outbound nat on the client?  On the server?  What is the routing table on pfsense of the client look like and on the server side..  On the client you should be putting in what networks are remote..

        clientvpnsettings.png
        clientvpnsettings.png_thumb

        An intelligent man is sometimes forced to be drunk to spend time with his fools
        If you get confused: Listen to the Music Play
        Please don't Chat/PM me for help, unless mod related
        SG-4860 24.11 | Lab VMs 2.8, 24.11

        1 Reply Last reply Reply Quote 0
        • J
          jerryxLinuX
          last edited by

          herewith i have attached all the config screenshots

          server.conf1.jpg
          server.conf1.jpg_thumb
          server.conf2.jpg
          server.conf2.jpg_thumb
          clent.conf1.jpg
          clent.conf1.jpg_thumb
          client.conf2.jpg
          client.conf2.jpg_thumb
          ![clentspecific overrides.jpg](/public/imported_attachments/1/clentspecific overrides.jpg)
          ![clentspecific overrides.jpg_thumb](/public/imported_attachments/1/clentspecific overrides.jpg_thumb)
          server.nat.outbound.jpg
          server.nat.outbound.jpg_thumb
          client.nat.outbound.jpg
          client.nat.outbound.jpg_thumb

          1 Reply Last reply Reply Quote 0
          • johnpozJ
            johnpoz LAYER 8 Global Moderator
            last edited by

            so your not natting anything through your vpn interfaces.. Fine since your just all local networks..  But you don't have anything in your remote or local networks  You don't normally have to push routes.. Unless your doing something specific odd..

            Where are you routing tables from pfsense?

            An intelligent man is sometimes forced to be drunk to spend time with his fools
            If you get confused: Listen to the Music Play
            Please don't Chat/PM me for help, unless mod related
            SG-4860 24.11 | Lab VMs 2.8, 24.11

            1 Reply Last reply Reply Quote 0
            • J
              jerryxLinuX
              last edited by

              Routing table means? how to get that?

              1 Reply Last reply Reply Quote 0
              • J
                jerryxLinuX
                last edited by

                I think you are asking about this

                routing.jpg
                routing.jpg_thumb

                1 Reply Last reply Reply Quote 0
                • J
                  jerryxLinuX
                  last edited by

                  hey success man , i just made an entry in client specific overrides as " iroute 192.168.140.0 255.255.255.0" my client ip . it was success.
                  Thanks dude.
                  i have another question how to add multiple client in the server , do i want to continue my post in same thread or want to raise a new thread

                  1 Reply Last reply Reply Quote 0
                  • johnpozJ
                    johnpoz LAYER 8 Global Moderator
                    last edited by

                    no that is not your routing table…  under diagnostics routes, it will list out your routing table.

                    Why should you have to put it in overrides if you would just setup the server and client correctly in the first place?  With the local and remote network fields.

                    An intelligent man is sometimes forced to be drunk to spend time with his fools
                    If you get confused: Listen to the Music Play
                    Please don't Chat/PM me for help, unless mod related
                    SG-4860 24.11 | Lab VMs 2.8, 24.11

                    1 Reply Last reply Reply Quote 0
                    • D
                      divsys
                      last edited by

                      SSL/TLS still needs an iroute via the CSC section for each client.

                      Much easier in 2.2.5 than it used to be, but that iroute is often a last Gotcha in S2S links.

                      -jfp

                      1 Reply Last reply Reply Quote 0
                      • J
                        jerryxLinuX
                        last edited by

                        ok then its necessary right.

                        1 Reply Last reply Reply Quote 0
                        • D
                          divsys
                          last edited by

                          Definitely necessary, in the current pfSense versions, you simply enter into the server screen a comma delimited list of all the subnet "LANs" on all the client OpenVPN's you want to reach.

                          Then in the Client Specific Overrides section you make an entry for each client and list the LAN subnets that client will use.

                          It seems a little convoluted for a single S2S connection, but it lets you setup a single server and easily connect many (I have a link that uses 20+) clients each with more than one subnet.

                          The only hitch is that the client subnets can't overlap -  takes a little planning, but welcome to networking  ;)

                          -jfp

                          1 Reply Last reply Reply Quote 0
                          • J
                            jerryxLinuX
                            last edited by

                            Thank you all for helping me out . see you in next thread soon. going to configure multiple client ,if any error occurs reach you guys , please provide support….  ;D ;D 8) 8) ??? ??? ??? :P :P :P :P

                            1 Reply Last reply Reply Quote 0
                            • J
                              jerryxLinuX
                              last edited by

                              Dude another issue .
                              I cant export client .
                              there is no option in remote server what to do?

                              Screenshot_4.jpg
                              Screenshot_4.jpg_thumb

                              1 Reply Last reply Reply Quote 0
                              • D
                                divsys
                                last edited by

                                Client export is only for Remote access type OpenVPN servers ("Roadwarriors").

                                If you need both S2S and Remote access on the same pfSense box, I normally just create a second server instance listening on a different port and using different CA's and Server Certs.

                                Personally I prefer to keep them separate anyway, easier to track who's logging in remotely.

                                -jfp

                                1 Reply Last reply Reply Quote 0
                                • J
                                  jerryxLinuX
                                  last edited by

                                  my requirement is
                                  one vpn server have multiple clients ==> so that users can have access all regions
                                  if i want to work from home i need vpn key
                                  so users from other network should connect this server using openvpn. so client export is necessary.

                                  so what type of vpn server i have to use S2S or remote access open vpn server .

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    divsys
                                    last edited by

                                    When you create an OpenVPN server you have to specify the "Server Mode":

                                    Peer to Peer (SSL/TLS)  - Used for pfSense to pfSense connections, two routers that are connected 24/7
                                    or
                                    Remote Access (SSL/TLS) - Used for mobile or sporadic devices, laptops, cell phones, users at home computers.  They connect when needed.

                                    As I said before, you create the type (or both) that you need for your situation.

                                    Perhaps it would be worthwhile to draw a simple diagram of your envisioned setup so we can all be clear as to what you're trying to accomplish.

                                    -jfp

                                    1 Reply Last reply Reply Quote 0
                                    • J
                                      jerryxLinuX
                                      last edited by

                                      I am not good at networking , but i tried my level best . Please acknowledge

                                      topology.jpg
                                      topology.jpg_thumb

                                      1 Reply Last reply Reply Quote 0
                                      • D
                                        divsys
                                        last edited by

                                        OK, that's a good start.

                                        If we label these starting with your OpenVPN server and going clockwise:

                                        Site1 LAN:192.168.114.0/24 OpenVPN tunnel:10.0.8.0/24

                                        Site2 LAN:192.168.140.0/24

                                        Site3 LAN:192.168.141.0/24 (just my guess I didn't see it posted)

                                        Site4 LAN:192.168.142.0/24 (just my guess I didn't see it posted)

                                        (You could add the labels and LAN subnets to your diagram to further improve the picture)

                                        You have two different types of client connecting to your OpenVPN Server, the 3 Peer-Peer connections (Site2,Site3,Site4) and the Remote access connections (RoadWarriors -laptops, cell phones, etc.)

                                        The easiest way to handle these IMHO is with two different OpenVPN instances on Site1.

                                        The first you've mostly setup already with the main Peer-Peer instance.

                                        You just need to make sure that instance has two lists entered properly:

                                        1)  "IPv4 Local Network/s" listed as: "192.168.114.0/24"
                                        2)  "IPv4 Remote Network/s" listed as: "192.168.140.0/24,192.168.141.0/24,192.168.142.0/24"

                                        You then make individual "Client Specific Overrides" for each of Site2, Site3, and Site4 and specify in the "IPv4 Remote Network/s" which of the subnets applies to that Site.

                                        If you've set things up properly you should have all 4 sites communicating.

                                        For the Remote access connections (RoadWarriors) you create a second OpenVPN server on Site1.
                                        First create a new Certificate of Authority and a new Server Certificate using that CA.
                                        Then make a new OpenVPN server and choose "Remote Access (SSL/TLS)" for the "Server Mode"
                                        Choose a different "Port" than you used for the Peer-Peer server (1195 will work)
                                        Use the new Peer CA and Server certificate you just created.
                                        Pick a different "IPv4 Tunnel Network" eg:10.0.9.0/24
                                        List ALL the connected subnets in "IPv4 Local Network/s" : "192.168.114.0/24,192.168.140.0/24,192.168.141.0/24,192.168.142.0/24"
                                        Save your new server and make sure you add a rule allow UDP on WAN at the port you chose.

                                        Make certificates for your clients using the new CA and then export the packages you need for the clients.
                                        Install the clients on your devices, connect and test.

                                        -jfp

                                        1 Reply Last reply Reply Quote 0
                                        • J
                                          jerryxLinuX
                                          last edited by

                                          Hi ,

                                          Sorry for the late reply . i was offline .

                                          i have tried as per your suggestion , its working but

                                          server :192.168.114.0
                                          can access both clients : (A)192.168.140.0 , (B)192.168.116.0 .

                                          Client A & B can access server 192.168.114.0

                                          but client A cant able to communicate with Client B
                                          Client B cant able to communicate with Client A

                                          is that anything i want to add in advanced section link " route 192.168.140.0 255.255.255.0;" in client B aswell as in client A

                                          suggest an idea.

                                          1 Reply Last reply Reply Quote 0
                                          • D
                                            divsys
                                            last edited by

                                            If you want Site2 to talk to Site3's LAN through their mutual Site1 connection , you have to add Site3's LAN subnet to the list of "Local IPv4 Network(s)" in Site1's OpenVPN server configuration.

                                            Similarly for Site3 to talk to Site2 you add Site2's Subnet to the list.

                                            Any chance you can upgrade these sites to 2.2.4?  2.1.4 is (getting?) old…...

                                            -jfp

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.