How to bypass a connection from going through a VPN?

Clash 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.
linux networking firewall vpn
add a comment |Â
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.
linux networking firewall vpn
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
add a comment |Â
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.
linux networking firewall vpn
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
linux networking firewall vpn
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
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
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
answered Sep 27 at 17:30
RalfFriedl
4,2481725
4,2481725
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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