Navigation

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

    OpenVPN routing problem upon rebooting

    OpenVPN
    2
    9
    1898
    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.
    • T
      toverfee last edited by

      Hello everyone,

      I'm a student and I'm hosting my own vp-network. I host openvpn on a pfsense (an old laptop) with only one WAN interface.
      The tunnel gets forwarded from my router –> pfsense and then I redirect traffic too my router again, this all works great I get my home IP etc, but I'm having this issue.
      Whenever I shut down the machine, and restart it when I go to school, the vpn doesn't seem to redirect traffic to my router (although I get an openvpn IP address). It can be solved when I log onto pfSense, go to my openvpn server, and just click the save button (no settings changed) and then I just works as intented.
      Can anyone help me on this matter? Please tell me what information I should post in order for you guys to help me figure this out.

      Thanks in advance,
      T

      EDIT:
      I'll post some results.
      After reboot / no saving of openvpn:

      $ netstat -nr
      Routing tables

      Internet:
      Destination        Gateway            Flags    Refs      Use  Netif Expire
      default            192.168.0.1        UGS        0    2663  bge0
      10.8.0.0/24        192.168.0.1        UGS        0      849 ovpns1
      10.8.0.1          link#9            UHS        0        0    lo0
      127.0.0.1          link#7            UH          0      25    lo0
      192.168.0.0/24    link#1            U          0    1017  bge0
      192.168.0.157      link#1            UHS        0        0    lo0

      –> not able to browse the web

      After reboot / with saving:
      $ netstat -nr
      Routing tables

      Internet:
      Destination        Gateway            Flags    Refs      Use  Netif Expire
      default            192.168.0.1        UGS        0    3899  bge0
      10.8.0.0/24        link#9            U          0      250 ovpns1
      10.8.0.1          link#9            UHS        0        0    lo0
      127.0.0.1          link#7            UH          0      39    lo0
      192.168.0.0/24    link#1            U          0    1516  bge0
      192.168.0.157      link#1            UHS        0        0    lo0

      –> able to browse the web with my home ip

      Does the gateway has anything to do with it? These are my OpenVPN options:
      Server mode: remote access (ssl/tls + user auth)
      prot: tcp
      device mode: tap
      interface: WAN
      local port: default
      IPv4 tunnel network: 10.8.0.0/24
      IPv4 Local Network/s: 192.168.0.0/24
      Concurrent conn: 10
      Compression: LZO enabled
      Type-of-Service: disabled
      Inter-client comms: enabled
      dupe conns: disabled
      Dynamic IP: enabled
      address pool: enabled
      dns default domain: disabled
      dns servers: enabled (8.8.8.8 and 8.8.4.4)
      ntp servers: disabled
      netbios options: disabled
      Advanced configuration:
      push "route 192.168.0.0 255.255.255.0 vpn_gateway";route 192.168.0.0 255.255.255.0;push "redirect-gateway def1 bypass-dhcp";

      1 Reply Last reply Reply Quote 0
      • T
        toverfee last edited by

        Bumping my own post, sorry.

        I've added an interface for ovpns1 and noticed something odd, it's using a 255.255.255.0 gateway, which seems to be a subnet from one of the networks?
        Here is the gateways table:
        Name                 Interface   Gateway         Monitor IP         Description
        WANGW (default) WAN 192.168.0.1         192.168.0.1         WAN Gateway
        OVPN_VPNV4         OVPN 255.255.255.0 255.255.255.0 Interface OVPN_VPNV4 Gateway

        When I save it though, the gateway address of ovpn if does not change yet I'm able to browse the web then.

        1 Reply Last reply Reply Quote 0
        • T
          toverfee last edited by

          Friendly bump.

          Can anyone help me figure this out? Am I not providing enough information on the matter?
          Is there a way to force save it after boot? So I don't have to do that manually?

          Thanks,
          T

          1 Reply Last reply Reply Quote 0
          • T
            toverfee last edited by

            Reviving my topic:
            I used the following lines of code on startup:
            killall openvpn
            openvpn <forgot path="">/server1.conf

            Although that these work when I enter them manually, they won't work when ran with bash, which is odd… It will say that the daemon is not running.

            I made sure that script runs after openvpn has been started.

            Regards,
            T.</forgot>

            1 Reply Last reply Reply Quote 0
            • T
              toverfee last edited by

              Sorry for resurrecting my post but this issue still hasn't been resolved…
              When I enter the commands manually they do the trick but not while in a script, which is odd, I think.
              Can anyone please help me on this one? It's really annoying, here's what I have to do:

              • Login

              • Go to OpenVPN Tab

              • Click on the edit button

              • Save the settings (without changing anything)

              • It now works…

              1 Reply Last reply Reply Quote 0
              • KOM
                KOM last edited by

                I'm no expert, but the first thing I would do would be to stop arguing with difficult, contrary computers and redo it.  It takes 5 minutes to blow away your existing OpenVPN config and recreate it.  I found the following video tutorial to be short & sweet:

                https://www.youtube.com/watch?v=VdAHVSTl1ys

                I assume you're using 2.1?

                1 Reply Last reply Reply Quote 0
                • T
                  toverfee last edited by

                  @KOM:

                  I'm no expert, but the first thing I would do would be to stop arguing with difficult, contrary computers and redo it.  It takes 5 minutes to blow away your existing OpenVPN config and recreate it.  I found the following video tutorial to be short & sweet:

                  https://www.youtube.com/watch?v=VdAHVSTl1ys

                  I assume you're using 2.1?

                  Hello KOM and thanks for the reply,

                  I used this video for initial setup and this does work but the problem is when I restart pfSense (I don't keep it running 24/7 since I'm just a student).
                  It says daemon is not running, I can connect to it for some reason, but then the traffic from the vpn server doesn't get routed to my LAN.
                  I click on the button to edit settings, don't change anything and just click save and now it tells me it's running correctly and my traffic does get routed to my LAN.
                  I have no idea to solve this since running scripts doesn't work either (but then again it works when I enter the commands manually).

                  1 Reply Last reply Reply Quote 0
                  • KOM
                    KOM last edited by

                    You're using the 2.1 release?

                    1 Reply Last reply Reply Quote 0
                    • T
                      toverfee last edited by

                      @KOM:

                      You're using the 2.1 release?

                      Yes I am.
                      Here's just a screenshot before I edit the settings (Please note that I can connect, but my traffic doesn't get routed to my LAN and thus I can't browse the web)
                      And a screenshot after I edit it without changing anything.
                      And the screenshots of the actual script, which works when I enter it manually…



                      ![the script exec.png](/public/imported_attachments/1/the script exec.png)
                      ![the script exec.png_thumb](/public/imported_attachments/1/the script exec.png_thumb)
                      ![the script.png](/public/imported_attachments/1/the script.png)
                      ![the script.png_thumb](/public/imported_attachments/1/the script.png_thumb)

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post