How to bypass a connection from going through a VPN?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












Network setup looks like the following:



Internet --> Router1 doing PPPOE and VPN --> Switch --> Router2 + other stuff


Router 1 is running Linux with iptables, connects to my ISP and after a successful connection to a VPN. However, Router2 should not go through the VPN while everything else connected to Router1 should.



How to bypass a connection from going through a VPN?
I also don't know if the switch matters in this scenario.










share|improve this question























  • Presumably router2 is doing SNAT on traffic originating from behind it, to its IP address in the LAN range of router1?
    – wurtel
    Sep 27 at 14:26






  • 1




    what do you mean by router2 should not go through VPN ? Also providing some (even fake) IP and route table would be lovely so we have a bit more context.
    – Kiwy
    Sep 27 at 14:34










  • @wurtel : yes Everything on router1 will go through the VPN by default. Hence, all devices connected to router2 which again is connected to router1 would go through the VPN. But I don't want connections from devices connected to router2 to go through the VPN and I guess the only or likely easiest option would be to somehow bypass the VPN for everything coming from router2. I'll try to add some ip's and routing table but this might take a while. I guess it should be doable somehow with the prerouting table or adding another route for router2.
    – questo
    Sep 27 at 16:22














up vote
0
down vote

favorite












Network setup looks like the following:



Internet --> Router1 doing PPPOE and VPN --> Switch --> Router2 + other stuff


Router 1 is running Linux with iptables, connects to my ISP and after a successful connection to a VPN. However, Router2 should not go through the VPN while everything else connected to Router1 should.



How to bypass a connection from going through a VPN?
I also don't know if the switch matters in this scenario.










share|improve this question























  • Presumably router2 is doing SNAT on traffic originating from behind it, to its IP address in the LAN range of router1?
    – wurtel
    Sep 27 at 14:26






  • 1




    what do you mean by router2 should not go through VPN ? Also providing some (even fake) IP and route table would be lovely so we have a bit more context.
    – Kiwy
    Sep 27 at 14:34










  • @wurtel : yes Everything on router1 will go through the VPN by default. Hence, all devices connected to router2 which again is connected to router1 would go through the VPN. But I don't want connections from devices connected to router2 to go through the VPN and I guess the only or likely easiest option would be to somehow bypass the VPN for everything coming from router2. I'll try to add some ip's and routing table but this might take a while. I guess it should be doable somehow with the prerouting table or adding another route for router2.
    – questo
    Sep 27 at 16:22












up vote
0
down vote

favorite









up vote
0
down vote

favorite











Network setup looks like the following:



Internet --> Router1 doing PPPOE and VPN --> Switch --> Router2 + other stuff


Router 1 is running Linux with iptables, connects to my ISP and after a successful connection to a VPN. However, Router2 should not go through the VPN while everything else connected to Router1 should.



How to bypass a connection from going through a VPN?
I also don't know if the switch matters in this scenario.










share|improve this question















Network setup looks like the following:



Internet --> Router1 doing PPPOE and VPN --> Switch --> Router2 + other stuff


Router 1 is running Linux with iptables, connects to my ISP and after a successful connection to a VPN. However, Router2 should not go through the VPN while everything else connected to Router1 should.



How to bypass a connection from going through a VPN?
I also don't know if the switch matters in this scenario.







linux networking firewall vpn






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 27 at 14:24









Goro

6,62752865




6,62752865










asked Sep 27 at 14:03









questo

1




1











  • Presumably router2 is doing SNAT on traffic originating from behind it, to its IP address in the LAN range of router1?
    – wurtel
    Sep 27 at 14:26






  • 1




    what do you mean by router2 should not go through VPN ? Also providing some (even fake) IP and route table would be lovely so we have a bit more context.
    – Kiwy
    Sep 27 at 14:34










  • @wurtel : yes Everything on router1 will go through the VPN by default. Hence, all devices connected to router2 which again is connected to router1 would go through the VPN. But I don't want connections from devices connected to router2 to go through the VPN and I guess the only or likely easiest option would be to somehow bypass the VPN for everything coming from router2. I'll try to add some ip's and routing table but this might take a while. I guess it should be doable somehow with the prerouting table or adding another route for router2.
    – questo
    Sep 27 at 16:22
















  • Presumably router2 is doing SNAT on traffic originating from behind it, to its IP address in the LAN range of router1?
    – wurtel
    Sep 27 at 14:26






  • 1




    what do you mean by router2 should not go through VPN ? Also providing some (even fake) IP and route table would be lovely so we have a bit more context.
    – Kiwy
    Sep 27 at 14:34










  • @wurtel : yes Everything on router1 will go through the VPN by default. Hence, all devices connected to router2 which again is connected to router1 would go through the VPN. But I don't want connections from devices connected to router2 to go through the VPN and I guess the only or likely easiest option would be to somehow bypass the VPN for everything coming from router2. I'll try to add some ip's and routing table but this might take a while. I guess it should be doable somehow with the prerouting table or adding another route for router2.
    – questo
    Sep 27 at 16:22















Presumably router2 is doing SNAT on traffic originating from behind it, to its IP address in the LAN range of router1?
– wurtel
Sep 27 at 14:26




Presumably router2 is doing SNAT on traffic originating from behind it, to its IP address in the LAN range of router1?
– wurtel
Sep 27 at 14:26




1




1




what do you mean by router2 should not go through VPN ? Also providing some (even fake) IP and route table would be lovely so we have a bit more context.
– Kiwy
Sep 27 at 14:34




what do you mean by router2 should not go through VPN ? Also providing some (even fake) IP and route table would be lovely so we have a bit more context.
– Kiwy
Sep 27 at 14:34












@wurtel : yes Everything on router1 will go through the VPN by default. Hence, all devices connected to router2 which again is connected to router1 would go through the VPN. But I don't want connections from devices connected to router2 to go through the VPN and I guess the only or likely easiest option would be to somehow bypass the VPN for everything coming from router2. I'll try to add some ip's and routing table but this might take a while. I guess it should be doable somehow with the prerouting table or adding another route for router2.
– questo
Sep 27 at 16:22




@wurtel : yes Everything on router1 will go through the VPN by default. Hence, all devices connected to router2 which again is connected to router1 would go through the VPN. But I don't want connections from devices connected to router2 to go through the VPN and I guess the only or likely easiest option would be to somehow bypass the VPN for everything coming from router2. I'll try to add some ip's and routing table but this might take a while. I guess it should be doable somehow with the prerouting table or adding another route for router2.
– questo
Sep 27 at 16:22










1 Answer
1






active

oldest

votes

















up vote
0
down vote













What you need is policy based routing. See man ip-rule



Set up a rule to match router2



ip rule add from router2 table 200


Set up a route for that rule that points to the correct gateway. $GATEWAY should be the default gateway or router1 before VPN is started.



ip route add default via $GATEWAY table 200





share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    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',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471833%2fhow-to-bypass-a-connection-from-going-through-a-vpn%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    What you need is policy based routing. See man ip-rule



    Set up a rule to match router2



    ip rule add from router2 table 200


    Set up a route for that rule that points to the correct gateway. $GATEWAY should be the default gateway or router1 before VPN is started.



    ip route add default via $GATEWAY table 200





    share|improve this answer
























      up vote
      0
      down vote













      What you need is policy based routing. See man ip-rule



      Set up a rule to match router2



      ip rule add from router2 table 200


      Set up a route for that rule that points to the correct gateway. $GATEWAY should be the default gateway or router1 before VPN is started.



      ip route add default via $GATEWAY table 200





      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        What you need is policy based routing. See man ip-rule



        Set up a rule to match router2



        ip rule add from router2 table 200


        Set up a route for that rule that points to the correct gateway. $GATEWAY should be the default gateway or router1 before VPN is started.



        ip route add default via $GATEWAY table 200





        share|improve this answer












        What you need is policy based routing. See man ip-rule



        Set up a rule to match router2



        ip rule add from router2 table 200


        Set up a route for that rule that points to the correct gateway. $GATEWAY should be the default gateway or router1 before VPN is started.



        ip route add default via $GATEWAY table 200






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 27 at 17:30









        RalfFriedl

        4,2481725




        4,2481725



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471833%2fhow-to-bypass-a-connection-from-going-through-a-vpn%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            Peggy Mitchell

            Palaiologos

            The Forum (Inglewood, California)