openvpn client override default gateway for vpn severCorrect Network IP addressing if your users have ability to VPN inOpenVPN with two gateway and DNS serverOpenVPN doesn't use remote gateway by defaultOpenVPN client as gateway for other clientsOpenVPN client nslookup failure after disconnectopenvpn client restarts if default gateway is changedOpenVPN server sending bogus default gateway information to client?ubuntu network manager openvpn overwrites default routeOpenVPN needs a gateway parameter fo a --route optionApply OpenVPN gateway to a single interface

Why doesn't Iron Man's action affect this person in Endgame?

Is this possible when it comes to the relations of P, NP, NP-Hard and NP-Complete?

How do I adjust encounters to challenge my lycanthrope players without negating their cool new abilities?

How can we allow remote players to effectively interact with a physical tabletop battle-map?

Substring join or additional table, which is faster?

Why are solar panels kept tilted?

How do I identify the partitions of my hard drive in order to then shred them all?

Polynomial division: Is this trick obvious?

Is 12 minutes connection in Bristol Temple Meads long enough?

Can multiple outlets be directly attached to a single breaker?

Meaning of "work with shame"

AMPScript Lookup From Child Business Unit

Why does SSL Labs now consider CBC suites weak?

Would life always name the light from their sun "white"

Source of the Wildfire?

Single word that parallels "Recent" when discussing the near future

Motorola 6845 and bitwise graphics

Who commanded or executed this action in Game of Thrones S8E5?

Is there any way to adjust the damage type of the Eldritch Blast cantrip so that it does fire damage?

What was the ring Varys took off?

Why can't I share a one use code with anyone else?

How to not get blinded by an attack at dawn

Is there any good reason to write "it is easy to see"?

Segmentation fault when popping x86 stack



openvpn client override default gateway for vpn sever


Correct Network IP addressing if your users have ability to VPN inOpenVPN with two gateway and DNS serverOpenVPN doesn't use remote gateway by defaultOpenVPN client as gateway for other clientsOpenVPN client nslookup failure after disconnectopenvpn client restarts if default gateway is changedOpenVPN server sending bogus default gateway information to client?ubuntu network manager openvpn overwrites default routeOpenVPN needs a gateway parameter fo a --route optionApply OpenVPN gateway to a single interface






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















When openvpn client connects to a vpn server it creates a route for server ip with old default gateway. How can I tell openvpn not to use old default gateway but use my provided custom gateway ip.



I.e. when I have vpn server in another vpn network which is not default route on my machine.










share|improve this question






















  • Please elaborate. Currently, I'm unable to understand what you would like to achieve.

    – gf_
    Dec 23 '16 at 15:26











  • @gf_ when I run openvpn it uses comman /sbin/route add -net [VPN_SERVER_IP] [OLD_DEFAULT_GATEWAY] 255.255.255.255, right? so I need way to specify my own [OLD_DEFAULT_GATEWAY] value

    – igor
    Dec 23 '16 at 17:47






  • 1





    If you remove the old default gateway from your routing table when bringing up the first VPN, won't the second one use the default set by the first one? You should be able to use --redirect-gateway without the def1 flag (which preserves the old gateway), or write and run a script which has the same effect after the first VPN is brought up.

    – user4556274
    Dec 23 '16 at 18:10











  • @user4556274 I also don't want the first VPN to be default gateway. I just need it only for certain subnet.

    – igor
    Dec 25 '16 at 14:14











  • @kitty No, openvpn uses command /sbin/route add -net [VPN_SERVER_IP] [OLD_GATEWAY_FOR_VPN_SERVER_IP] 255.255.255.255. So, while connecting to second vpn, if the vpnserver2 is routed through first VPN, then the correct route will automatically be added by openvpn.

    – Tanmay
    Dec 28 '16 at 11:47

















2















When openvpn client connects to a vpn server it creates a route for server ip with old default gateway. How can I tell openvpn not to use old default gateway but use my provided custom gateway ip.



I.e. when I have vpn server in another vpn network which is not default route on my machine.










share|improve this question






















  • Please elaborate. Currently, I'm unable to understand what you would like to achieve.

    – gf_
    Dec 23 '16 at 15:26











  • @gf_ when I run openvpn it uses comman /sbin/route add -net [VPN_SERVER_IP] [OLD_DEFAULT_GATEWAY] 255.255.255.255, right? so I need way to specify my own [OLD_DEFAULT_GATEWAY] value

    – igor
    Dec 23 '16 at 17:47






  • 1





    If you remove the old default gateway from your routing table when bringing up the first VPN, won't the second one use the default set by the first one? You should be able to use --redirect-gateway without the def1 flag (which preserves the old gateway), or write and run a script which has the same effect after the first VPN is brought up.

    – user4556274
    Dec 23 '16 at 18:10











  • @user4556274 I also don't want the first VPN to be default gateway. I just need it only for certain subnet.

    – igor
    Dec 25 '16 at 14:14











  • @kitty No, openvpn uses command /sbin/route add -net [VPN_SERVER_IP] [OLD_GATEWAY_FOR_VPN_SERVER_IP] 255.255.255.255. So, while connecting to second vpn, if the vpnserver2 is routed through first VPN, then the correct route will automatically be added by openvpn.

    – Tanmay
    Dec 28 '16 at 11:47













2












2








2


2






When openvpn client connects to a vpn server it creates a route for server ip with old default gateway. How can I tell openvpn not to use old default gateway but use my provided custom gateway ip.



I.e. when I have vpn server in another vpn network which is not default route on my machine.










share|improve this question














When openvpn client connects to a vpn server it creates a route for server ip with old default gateway. How can I tell openvpn not to use old default gateway but use my provided custom gateway ip.



I.e. when I have vpn server in another vpn network which is not default route on my machine.







openvpn






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 7 '16 at 17:59









igorigor

48128




48128












  • Please elaborate. Currently, I'm unable to understand what you would like to achieve.

    – gf_
    Dec 23 '16 at 15:26











  • @gf_ when I run openvpn it uses comman /sbin/route add -net [VPN_SERVER_IP] [OLD_DEFAULT_GATEWAY] 255.255.255.255, right? so I need way to specify my own [OLD_DEFAULT_GATEWAY] value

    – igor
    Dec 23 '16 at 17:47






  • 1





    If you remove the old default gateway from your routing table when bringing up the first VPN, won't the second one use the default set by the first one? You should be able to use --redirect-gateway without the def1 flag (which preserves the old gateway), or write and run a script which has the same effect after the first VPN is brought up.

    – user4556274
    Dec 23 '16 at 18:10











  • @user4556274 I also don't want the first VPN to be default gateway. I just need it only for certain subnet.

    – igor
    Dec 25 '16 at 14:14











  • @kitty No, openvpn uses command /sbin/route add -net [VPN_SERVER_IP] [OLD_GATEWAY_FOR_VPN_SERVER_IP] 255.255.255.255. So, while connecting to second vpn, if the vpnserver2 is routed through first VPN, then the correct route will automatically be added by openvpn.

    – Tanmay
    Dec 28 '16 at 11:47

















  • Please elaborate. Currently, I'm unable to understand what you would like to achieve.

    – gf_
    Dec 23 '16 at 15:26











  • @gf_ when I run openvpn it uses comman /sbin/route add -net [VPN_SERVER_IP] [OLD_DEFAULT_GATEWAY] 255.255.255.255, right? so I need way to specify my own [OLD_DEFAULT_GATEWAY] value

    – igor
    Dec 23 '16 at 17:47






  • 1





    If you remove the old default gateway from your routing table when bringing up the first VPN, won't the second one use the default set by the first one? You should be able to use --redirect-gateway without the def1 flag (which preserves the old gateway), or write and run a script which has the same effect after the first VPN is brought up.

    – user4556274
    Dec 23 '16 at 18:10











  • @user4556274 I also don't want the first VPN to be default gateway. I just need it only for certain subnet.

    – igor
    Dec 25 '16 at 14:14











  • @kitty No, openvpn uses command /sbin/route add -net [VPN_SERVER_IP] [OLD_GATEWAY_FOR_VPN_SERVER_IP] 255.255.255.255. So, while connecting to second vpn, if the vpnserver2 is routed through first VPN, then the correct route will automatically be added by openvpn.

    – Tanmay
    Dec 28 '16 at 11:47
















Please elaborate. Currently, I'm unable to understand what you would like to achieve.

– gf_
Dec 23 '16 at 15:26





Please elaborate. Currently, I'm unable to understand what you would like to achieve.

– gf_
Dec 23 '16 at 15:26













@gf_ when I run openvpn it uses comman /sbin/route add -net [VPN_SERVER_IP] [OLD_DEFAULT_GATEWAY] 255.255.255.255, right? so I need way to specify my own [OLD_DEFAULT_GATEWAY] value

– igor
Dec 23 '16 at 17:47





@gf_ when I run openvpn it uses comman /sbin/route add -net [VPN_SERVER_IP] [OLD_DEFAULT_GATEWAY] 255.255.255.255, right? so I need way to specify my own [OLD_DEFAULT_GATEWAY] value

– igor
Dec 23 '16 at 17:47




1




1





If you remove the old default gateway from your routing table when bringing up the first VPN, won't the second one use the default set by the first one? You should be able to use --redirect-gateway without the def1 flag (which preserves the old gateway), or write and run a script which has the same effect after the first VPN is brought up.

– user4556274
Dec 23 '16 at 18:10





If you remove the old default gateway from your routing table when bringing up the first VPN, won't the second one use the default set by the first one? You should be able to use --redirect-gateway without the def1 flag (which preserves the old gateway), or write and run a script which has the same effect after the first VPN is brought up.

– user4556274
Dec 23 '16 at 18:10













@user4556274 I also don't want the first VPN to be default gateway. I just need it only for certain subnet.

– igor
Dec 25 '16 at 14:14





@user4556274 I also don't want the first VPN to be default gateway. I just need it only for certain subnet.

– igor
Dec 25 '16 at 14:14













@kitty No, openvpn uses command /sbin/route add -net [VPN_SERVER_IP] [OLD_GATEWAY_FOR_VPN_SERVER_IP] 255.255.255.255. So, while connecting to second vpn, if the vpnserver2 is routed through first VPN, then the correct route will automatically be added by openvpn.

– Tanmay
Dec 28 '16 at 11:47





@kitty No, openvpn uses command /sbin/route add -net [VPN_SERVER_IP] [OLD_GATEWAY_FOR_VPN_SERVER_IP] 255.255.255.255. So, while connecting to second vpn, if the vpnserver2 is routed through first VPN, then the correct route will automatically be added by openvpn.

– Tanmay
Dec 28 '16 at 11:47










4 Answers
4






active

oldest

votes


















0














Adding this two line to the Server Config File will force all traffic to go through your VPN



push "redirect-gateway def1"
push "dhcp-option DNS 8.8.8.8"





share|improve this answer


















  • 1





    sorry this is not what I'm asking :)

    – igor
    Dec 8 '16 at 11:04











  • I have two vpns and I want second vpn go through first vpn instead of going to real interface, which is default gateway

    – igor
    Dec 8 '16 at 11:06











  • I don't know how a client computer to have 2 openvpn connections at the same time but it is more likely to work if you use 2 different vpn services

    – akgren_soar
    Dec 8 '16 at 12:05


















0














If you want to set a next-hop router for a specific subnet after both VPNs are established, use something like



ip -4 route add $DESTINATION_SUBNET via $NEXT_HOP dev $INTERFACE_NAME


for example



ip -4 route add 10.0.0.0/8 via 172.16.0.1 dev eth0


You don't need to modify either default gateway; the more specific route will be chosen over the default route.






share|improve this answer























  • that is exactly what I don't want to do - do something manually after establishing vpn connections. I want it to be inside openvpn client config file

    – igor
    Dec 25 '16 at 22:37


















0














The redirect-gateway option may or may not change the gateway for reaching the OpenVPN server, depending on the flags provided to it.



According to man page of openvpn:




Option flags:



local -- Add the local flag if both OpenVPN servers are directly connected via a common subnet, such as with wireless. The local flag will cause step 1 above (Creation of a static route for the --remote address which forwards to the pre-existing default gateway) to be omitted.




So, just add a redirect-gateway local option in client config file, to override the pushed option. This will cause openvpn to just add a new default route, and not a specific route for the server. So the current route being used to connect to ther server will continue to be used.



If you want this behavior for all clients, edit the server config file and change the option push "redirect-gateway" to push "redirect-gateway local".






share|improve this answer






























    0















    I also don't want the first VPN to be default gateway. I just need it
    only for certain subnet.




    On the client side you can ignore any routes from vpn server with the following options



    script-security 2
    route-noexec
    route-up setup-routing.sh


    and configure your own routes with route-up script, that could be something like this



    $ cat setup-routing.sh 

    #!/bin/bash

    ip ro add 192.168.10.0/24 via $route_vpn_gateway


    Where route_vpn_gateway is environment variable that points to the default gateway used by --route options, as specified in either the --route-gateway option or the second parameter to --ifconfig when --dev tun is specified.






    share|improve this answer























      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "2"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f819339%2fopenvpn-client-override-default-gateway-for-vpn-sever%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Adding this two line to the Server Config File will force all traffic to go through your VPN



      push "redirect-gateway def1"
      push "dhcp-option DNS 8.8.8.8"





      share|improve this answer


















      • 1





        sorry this is not what I'm asking :)

        – igor
        Dec 8 '16 at 11:04











      • I have two vpns and I want second vpn go through first vpn instead of going to real interface, which is default gateway

        – igor
        Dec 8 '16 at 11:06











      • I don't know how a client computer to have 2 openvpn connections at the same time but it is more likely to work if you use 2 different vpn services

        – akgren_soar
        Dec 8 '16 at 12:05















      0














      Adding this two line to the Server Config File will force all traffic to go through your VPN



      push "redirect-gateway def1"
      push "dhcp-option DNS 8.8.8.8"





      share|improve this answer


















      • 1





        sorry this is not what I'm asking :)

        – igor
        Dec 8 '16 at 11:04











      • I have two vpns and I want second vpn go through first vpn instead of going to real interface, which is default gateway

        – igor
        Dec 8 '16 at 11:06











      • I don't know how a client computer to have 2 openvpn connections at the same time but it is more likely to work if you use 2 different vpn services

        – akgren_soar
        Dec 8 '16 at 12:05













      0












      0








      0







      Adding this two line to the Server Config File will force all traffic to go through your VPN



      push "redirect-gateway def1"
      push "dhcp-option DNS 8.8.8.8"





      share|improve this answer













      Adding this two line to the Server Config File will force all traffic to go through your VPN



      push "redirect-gateway def1"
      push "dhcp-option DNS 8.8.8.8"






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Dec 8 '16 at 4:23









      akgren_soarakgren_soar

      4927




      4927







      • 1





        sorry this is not what I'm asking :)

        – igor
        Dec 8 '16 at 11:04











      • I have two vpns and I want second vpn go through first vpn instead of going to real interface, which is default gateway

        – igor
        Dec 8 '16 at 11:06











      • I don't know how a client computer to have 2 openvpn connections at the same time but it is more likely to work if you use 2 different vpn services

        – akgren_soar
        Dec 8 '16 at 12:05












      • 1





        sorry this is not what I'm asking :)

        – igor
        Dec 8 '16 at 11:04











      • I have two vpns and I want second vpn go through first vpn instead of going to real interface, which is default gateway

        – igor
        Dec 8 '16 at 11:06











      • I don't know how a client computer to have 2 openvpn connections at the same time but it is more likely to work if you use 2 different vpn services

        – akgren_soar
        Dec 8 '16 at 12:05







      1




      1





      sorry this is not what I'm asking :)

      – igor
      Dec 8 '16 at 11:04





      sorry this is not what I'm asking :)

      – igor
      Dec 8 '16 at 11:04













      I have two vpns and I want second vpn go through first vpn instead of going to real interface, which is default gateway

      – igor
      Dec 8 '16 at 11:06





      I have two vpns and I want second vpn go through first vpn instead of going to real interface, which is default gateway

      – igor
      Dec 8 '16 at 11:06













      I don't know how a client computer to have 2 openvpn connections at the same time but it is more likely to work if you use 2 different vpn services

      – akgren_soar
      Dec 8 '16 at 12:05





      I don't know how a client computer to have 2 openvpn connections at the same time but it is more likely to work if you use 2 different vpn services

      – akgren_soar
      Dec 8 '16 at 12:05













      0














      If you want to set a next-hop router for a specific subnet after both VPNs are established, use something like



      ip -4 route add $DESTINATION_SUBNET via $NEXT_HOP dev $INTERFACE_NAME


      for example



      ip -4 route add 10.0.0.0/8 via 172.16.0.1 dev eth0


      You don't need to modify either default gateway; the more specific route will be chosen over the default route.






      share|improve this answer























      • that is exactly what I don't want to do - do something manually after establishing vpn connections. I want it to be inside openvpn client config file

        – igor
        Dec 25 '16 at 22:37















      0














      If you want to set a next-hop router for a specific subnet after both VPNs are established, use something like



      ip -4 route add $DESTINATION_SUBNET via $NEXT_HOP dev $INTERFACE_NAME


      for example



      ip -4 route add 10.0.0.0/8 via 172.16.0.1 dev eth0


      You don't need to modify either default gateway; the more specific route will be chosen over the default route.






      share|improve this answer























      • that is exactly what I don't want to do - do something manually after establishing vpn connections. I want it to be inside openvpn client config file

        – igor
        Dec 25 '16 at 22:37













      0












      0








      0







      If you want to set a next-hop router for a specific subnet after both VPNs are established, use something like



      ip -4 route add $DESTINATION_SUBNET via $NEXT_HOP dev $INTERFACE_NAME


      for example



      ip -4 route add 10.0.0.0/8 via 172.16.0.1 dev eth0


      You don't need to modify either default gateway; the more specific route will be chosen over the default route.






      share|improve this answer













      If you want to set a next-hop router for a specific subnet after both VPNs are established, use something like



      ip -4 route add $DESTINATION_SUBNET via $NEXT_HOP dev $INTERFACE_NAME


      for example



      ip -4 route add 10.0.0.0/8 via 172.16.0.1 dev eth0


      You don't need to modify either default gateway; the more specific route will be chosen over the default route.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Dec 25 '16 at 14:20









      user4556274user4556274

      22315




      22315












      • that is exactly what I don't want to do - do something manually after establishing vpn connections. I want it to be inside openvpn client config file

        – igor
        Dec 25 '16 at 22:37

















      • that is exactly what I don't want to do - do something manually after establishing vpn connections. I want it to be inside openvpn client config file

        – igor
        Dec 25 '16 at 22:37
















      that is exactly what I don't want to do - do something manually after establishing vpn connections. I want it to be inside openvpn client config file

      – igor
      Dec 25 '16 at 22:37





      that is exactly what I don't want to do - do something manually after establishing vpn connections. I want it to be inside openvpn client config file

      – igor
      Dec 25 '16 at 22:37











      0














      The redirect-gateway option may or may not change the gateway for reaching the OpenVPN server, depending on the flags provided to it.



      According to man page of openvpn:




      Option flags:



      local -- Add the local flag if both OpenVPN servers are directly connected via a common subnet, such as with wireless. The local flag will cause step 1 above (Creation of a static route for the --remote address which forwards to the pre-existing default gateway) to be omitted.




      So, just add a redirect-gateway local option in client config file, to override the pushed option. This will cause openvpn to just add a new default route, and not a specific route for the server. So the current route being used to connect to ther server will continue to be used.



      If you want this behavior for all clients, edit the server config file and change the option push "redirect-gateway" to push "redirect-gateway local".






      share|improve this answer



























        0














        The redirect-gateway option may or may not change the gateway for reaching the OpenVPN server, depending on the flags provided to it.



        According to man page of openvpn:




        Option flags:



        local -- Add the local flag if both OpenVPN servers are directly connected via a common subnet, such as with wireless. The local flag will cause step 1 above (Creation of a static route for the --remote address which forwards to the pre-existing default gateway) to be omitted.




        So, just add a redirect-gateway local option in client config file, to override the pushed option. This will cause openvpn to just add a new default route, and not a specific route for the server. So the current route being used to connect to ther server will continue to be used.



        If you want this behavior for all clients, edit the server config file and change the option push "redirect-gateway" to push "redirect-gateway local".






        share|improve this answer

























          0












          0








          0







          The redirect-gateway option may or may not change the gateway for reaching the OpenVPN server, depending on the flags provided to it.



          According to man page of openvpn:




          Option flags:



          local -- Add the local flag if both OpenVPN servers are directly connected via a common subnet, such as with wireless. The local flag will cause step 1 above (Creation of a static route for the --remote address which forwards to the pre-existing default gateway) to be omitted.




          So, just add a redirect-gateway local option in client config file, to override the pushed option. This will cause openvpn to just add a new default route, and not a specific route for the server. So the current route being used to connect to ther server will continue to be used.



          If you want this behavior for all clients, edit the server config file and change the option push "redirect-gateway" to push "redirect-gateway local".






          share|improve this answer













          The redirect-gateway option may or may not change the gateway for reaching the OpenVPN server, depending on the flags provided to it.



          According to man page of openvpn:




          Option flags:



          local -- Add the local flag if both OpenVPN servers are directly connected via a common subnet, such as with wireless. The local flag will cause step 1 above (Creation of a static route for the --remote address which forwards to the pre-existing default gateway) to be omitted.




          So, just add a redirect-gateway local option in client config file, to override the pushed option. This will cause openvpn to just add a new default route, and not a specific route for the server. So the current route being used to connect to ther server will continue to be used.



          If you want this behavior for all clients, edit the server config file and change the option push "redirect-gateway" to push "redirect-gateway local".







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 1 '17 at 19:26









          TanmayTanmay

          18519




          18519





















              0















              I also don't want the first VPN to be default gateway. I just need it
              only for certain subnet.




              On the client side you can ignore any routes from vpn server with the following options



              script-security 2
              route-noexec
              route-up setup-routing.sh


              and configure your own routes with route-up script, that could be something like this



              $ cat setup-routing.sh 

              #!/bin/bash

              ip ro add 192.168.10.0/24 via $route_vpn_gateway


              Where route_vpn_gateway is environment variable that points to the default gateway used by --route options, as specified in either the --route-gateway option or the second parameter to --ifconfig when --dev tun is specified.






              share|improve this answer



























                0















                I also don't want the first VPN to be default gateway. I just need it
                only for certain subnet.




                On the client side you can ignore any routes from vpn server with the following options



                script-security 2
                route-noexec
                route-up setup-routing.sh


                and configure your own routes with route-up script, that could be something like this



                $ cat setup-routing.sh 

                #!/bin/bash

                ip ro add 192.168.10.0/24 via $route_vpn_gateway


                Where route_vpn_gateway is environment variable that points to the default gateway used by --route options, as specified in either the --route-gateway option or the second parameter to --ifconfig when --dev tun is specified.






                share|improve this answer

























                  0












                  0








                  0








                  I also don't want the first VPN to be default gateway. I just need it
                  only for certain subnet.




                  On the client side you can ignore any routes from vpn server with the following options



                  script-security 2
                  route-noexec
                  route-up setup-routing.sh


                  and configure your own routes with route-up script, that could be something like this



                  $ cat setup-routing.sh 

                  #!/bin/bash

                  ip ro add 192.168.10.0/24 via $route_vpn_gateway


                  Where route_vpn_gateway is environment variable that points to the default gateway used by --route options, as specified in either the --route-gateway option or the second parameter to --ifconfig when --dev tun is specified.






                  share|improve this answer














                  I also don't want the first VPN to be default gateway. I just need it
                  only for certain subnet.




                  On the client side you can ignore any routes from vpn server with the following options



                  script-security 2
                  route-noexec
                  route-up setup-routing.sh


                  and configure your own routes with route-up script, that could be something like this



                  $ cat setup-routing.sh 

                  #!/bin/bash

                  ip ro add 192.168.10.0/24 via $route_vpn_gateway


                  Where route_vpn_gateway is environment variable that points to the default gateway used by --route options, as specified in either the --route-gateway option or the second parameter to --ifconfig when --dev tun is specified.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 13 '18 at 18:43









                  ALex_hhaALex_hha

                  5,69011832




                  5,69011832



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Server Fault!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f819339%2fopenvpn-client-override-default-gateway-for-vpn-sever%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

                      Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

                      Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020