Access web server behind OpenVPN client











up vote
1
down vote

favorite












Okay so:




  • I have a machine running an OpenVPN client (it's connecting to a server elsewhere, the machine does not act as the server)

  • The machine also has an Nginx web server

  • When the OpenVPN client is disconnected, my web server is accessible externally and internally (as desired)

  • When the OpenVPN client is connected, my web server is accessible only internally


    • Oddly it can still be accessed over its FQDN so I presume there's some weird internal DNS loopback caching happening? How does this work?




I would like all outgoing traffic to be forwarded through the VPN, or to exclude Nginx from the VPN.



Is this at all possible? How would I achieve this?










share|improve this question


















  • 1




    What OS and router setup? The abreviated answer is to do policy based routing on the device with the VPN client so that traffic to/from the web server (at least on port 80/443) goes through a different route table which does not have the VPN as a default gateway.
    – davidgo
    Nov 23 at 23:00










  • Ubuntu server, the router is a Sky Hub so nothing fancy at all. I'll look into that and report back if I get something working, cheers.
    – Jake Stanger
    Nov 27 at 20:16










  • Where is the OpenVPN client running? (Ubuntu or Sky Hub?)
    – davidgo
    Nov 27 at 20:20










  • Ubuntu. Should have specified that, sorry. The hub does nothing more than basic home firewall and port forwarding (plus acting as a router...).
    – Jake Stanger
    Nov 27 at 20:34















up vote
1
down vote

favorite












Okay so:




  • I have a machine running an OpenVPN client (it's connecting to a server elsewhere, the machine does not act as the server)

  • The machine also has an Nginx web server

  • When the OpenVPN client is disconnected, my web server is accessible externally and internally (as desired)

  • When the OpenVPN client is connected, my web server is accessible only internally


    • Oddly it can still be accessed over its FQDN so I presume there's some weird internal DNS loopback caching happening? How does this work?




I would like all outgoing traffic to be forwarded through the VPN, or to exclude Nginx from the VPN.



Is this at all possible? How would I achieve this?










share|improve this question


















  • 1




    What OS and router setup? The abreviated answer is to do policy based routing on the device with the VPN client so that traffic to/from the web server (at least on port 80/443) goes through a different route table which does not have the VPN as a default gateway.
    – davidgo
    Nov 23 at 23:00










  • Ubuntu server, the router is a Sky Hub so nothing fancy at all. I'll look into that and report back if I get something working, cheers.
    – Jake Stanger
    Nov 27 at 20:16










  • Where is the OpenVPN client running? (Ubuntu or Sky Hub?)
    – davidgo
    Nov 27 at 20:20










  • Ubuntu. Should have specified that, sorry. The hub does nothing more than basic home firewall and port forwarding (plus acting as a router...).
    – Jake Stanger
    Nov 27 at 20:34













up vote
1
down vote

favorite









up vote
1
down vote

favorite











Okay so:




  • I have a machine running an OpenVPN client (it's connecting to a server elsewhere, the machine does not act as the server)

  • The machine also has an Nginx web server

  • When the OpenVPN client is disconnected, my web server is accessible externally and internally (as desired)

  • When the OpenVPN client is connected, my web server is accessible only internally


    • Oddly it can still be accessed over its FQDN so I presume there's some weird internal DNS loopback caching happening? How does this work?




I would like all outgoing traffic to be forwarded through the VPN, or to exclude Nginx from the VPN.



Is this at all possible? How would I achieve this?










share|improve this question













Okay so:




  • I have a machine running an OpenVPN client (it's connecting to a server elsewhere, the machine does not act as the server)

  • The machine also has an Nginx web server

  • When the OpenVPN client is disconnected, my web server is accessible externally and internally (as desired)

  • When the OpenVPN client is connected, my web server is accessible only internally


    • Oddly it can still be accessed over its FQDN so I presume there's some weird internal DNS loopback caching happening? How does this work?




I would like all outgoing traffic to be forwarded through the VPN, or to exclude Nginx from the VPN.



Is this at all possible? How would I achieve this?







vpn proxy openvpn webserver nginx






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 at 21:00









Jake Stanger

1116




1116








  • 1




    What OS and router setup? The abreviated answer is to do policy based routing on the device with the VPN client so that traffic to/from the web server (at least on port 80/443) goes through a different route table which does not have the VPN as a default gateway.
    – davidgo
    Nov 23 at 23:00










  • Ubuntu server, the router is a Sky Hub so nothing fancy at all. I'll look into that and report back if I get something working, cheers.
    – Jake Stanger
    Nov 27 at 20:16










  • Where is the OpenVPN client running? (Ubuntu or Sky Hub?)
    – davidgo
    Nov 27 at 20:20










  • Ubuntu. Should have specified that, sorry. The hub does nothing more than basic home firewall and port forwarding (plus acting as a router...).
    – Jake Stanger
    Nov 27 at 20:34














  • 1




    What OS and router setup? The abreviated answer is to do policy based routing on the device with the VPN client so that traffic to/from the web server (at least on port 80/443) goes through a different route table which does not have the VPN as a default gateway.
    – davidgo
    Nov 23 at 23:00










  • Ubuntu server, the router is a Sky Hub so nothing fancy at all. I'll look into that and report back if I get something working, cheers.
    – Jake Stanger
    Nov 27 at 20:16










  • Where is the OpenVPN client running? (Ubuntu or Sky Hub?)
    – davidgo
    Nov 27 at 20:20










  • Ubuntu. Should have specified that, sorry. The hub does nothing more than basic home firewall and port forwarding (plus acting as a router...).
    – Jake Stanger
    Nov 27 at 20:34








1




1




What OS and router setup? The abreviated answer is to do policy based routing on the device with the VPN client so that traffic to/from the web server (at least on port 80/443) goes through a different route table which does not have the VPN as a default gateway.
– davidgo
Nov 23 at 23:00




What OS and router setup? The abreviated answer is to do policy based routing on the device with the VPN client so that traffic to/from the web server (at least on port 80/443) goes through a different route table which does not have the VPN as a default gateway.
– davidgo
Nov 23 at 23:00












Ubuntu server, the router is a Sky Hub so nothing fancy at all. I'll look into that and report back if I get something working, cheers.
– Jake Stanger
Nov 27 at 20:16




Ubuntu server, the router is a Sky Hub so nothing fancy at all. I'll look into that and report back if I get something working, cheers.
– Jake Stanger
Nov 27 at 20:16












Where is the OpenVPN client running? (Ubuntu or Sky Hub?)
– davidgo
Nov 27 at 20:20




Where is the OpenVPN client running? (Ubuntu or Sky Hub?)
– davidgo
Nov 27 at 20:20












Ubuntu. Should have specified that, sorry. The hub does nothing more than basic home firewall and port forwarding (plus acting as a router...).
– Jake Stanger
Nov 27 at 20:34




Ubuntu. Should have specified that, sorry. The hub does nothing more than basic home firewall and port forwarding (plus acting as a router...).
– Jake Stanger
Nov 27 at 20:34















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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: 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%2fsuperuser.com%2fquestions%2f1377886%2faccess-web-server-behind-openvpn-client%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • 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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2fsuperuser.com%2fquestions%2f1377886%2faccess-web-server-behind-openvpn-client%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

Probability when a professor distributes a quiz and homework assignment to a class of n students.

Aardman Animations

Are they similar matrix