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

    Startup script

    Scheduled Pinned Locked Moved OpenVPN
    12 Posts 6 Posters 6.5k 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.
    • 0
      0tt0
      last edited by

      I need to have a few commands run after the tunnel is started.

      How do I do this most easily, I guess it's easy to do.
      I looked in a few of the files in /var/etc/ like the .conf and it mentions rc.filter_configure but I'm somewhat unsure how this is best done.

      So basically what I need to do is remove the 0.0.0.0/1 and 128.0.0.0/1 routes from the routing table.

      What I do now is issuing commands route del 0.0.0.0/1 and route del 128.0.0.0/1 manually and reset states.

      The problem is that if and when the tunnel is restarted, like if the box gets rebooted from a temp power failure those route entries sucks all traffic in the tunnel and hence disables policy routing.

      So basically I need to put those two commands in a script and have that script run after the tunnel is up.

      1 Reply Last reply Reply Quote 0
      • G
        geyser
        last edited by

        Is this so you can then do policy based routing after the OpenVPN link is up?

        1 Reply Last reply Reply Quote 0
        • GruensFroeschliG
          GruensFroeschli
          last edited by

          Why are you telling the openVPN to even add these routes?
          I assume you've set the "redirect def1" option.
          Just disable this and those routes wont be added.

          We do what we must, because we can.

          Asking questions the smart way: http://www.catb.org/esr/faqs/smart-questions.html

          1 Reply Last reply Reply Quote 0
          • G
            geyser
            last edited by

            I think 0tt0 is connecting to StrongVPN, same as what I am trying to do.  Even if you don't specify redirect-gateway def1; it still puts in those routes.  I think it is being sent down by the remote server.

            1 Reply Last reply Reply Quote 0
            • GruensFroeschliG
              GruensFroeschli
              last edited by

              The redirect def1 is a server option.

              But even if you have these routes in place.
              They only affect traffic if you're using the "default" gateway on a firewall rule.
              Policy routing forces traffic directly to an interface/gateway and bypasses the routing table.

              Could you show a screenshot of the rules you think are not working with these routes in place?

              Even another alternative would be, that you add on top of these rules another 4 rules (0.0.0.0/2, 64.0.0.0/2, 128.0.0.0/2, 192.0.0.0/2)

              We do what we must, because we can.

              Asking questions the smart way: http://www.catb.org/esr/faqs/smart-questions.html

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

                @geyser:

                I think 0tt0 is connecting to StrongVPN, same as what I am trying to do.  Even if you don't specify redirect-gateway def1; it still puts in those routes.  I think it is being sent down by the remote server.

                This is exactly correct yes.

                1 Reply Last reply Reply Quote 0
                • C
                  cmb
                  last edited by

                  If you specify:

                  route-nopull
                  

                  in your custom options it should prevent that route from being pulled. Someone else is doing that with StrongVPN.

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

                    @cmb:

                    If you specify:

                    route-nopull
                    

                    in your custom options it should prevent that route from being pulled. Someone else is doing that with StrongVPN.

                    Thanks for the info, don't think I've seen that one before.

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

                      @cmb:

                      If you specify:

                      route-nopull
                      

                      in your custom options it should prevent that route from being pulled. Someone else is doing that with StrongVPN.

                      It seems this only works in OpenVPN 2.1.x or later so it shouldn't work in pfs 1.2.3-R then I guess.

                      1 Reply Last reply Reply Quote 0
                      • M
                        m4rcu5
                        last edited by

                        I think its replaced by "route-noexec". This worked for me until last week i upgraded to RC3.
                        Now pfSense wont see my OpenVPN gateway anymore.

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

                          @m4rcu5:

                          I think its replaced by "route-noexec". This worked for me until last week i upgraded to RC3.
                          Now pfSense wont see my OpenVPN gateway anymore.

                          Thanks for the info, I'll check it up.

                          1 Reply Last reply Reply Quote 0
                          • jimpJ
                            jimp Rebel Alliance Developer Netgate
                            last edited by

                            Upgrade to a recent snapshot if you aren't seeing an OpenVPN dynamic gateway (or if you see it but it's always "gathering data"). There were some bug fixes a week or so ago, after the official RC3.

                            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
                            • First post
                              Last post
                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.