OpenVPN over ssh tunnel
I'm trying to connect to my home network using OpenVPN. My router is behind the ISP's router so I'm having a double NAT problem (IP address on WAN port of my router is 10.x.x.x
). ISP cannot provide me with public IP address directly as they don't have such an option so incoming connections are not possible.
My network configuration
I want to have access to the computers on my home network from the Internet.
What I think to do is to create ssh tunnel from my home server that runs OpenVPN server to my VPS that has public IP with something like
autossh -M 10984 -i /root/.ssh/pubkey -R 1194:localhost:1194 me@myvps
Then configure OpenVPN server/clients to use tcp
over udp
and connect to myvps:1194
So my questions are:
- Is there a better way to do this?
- What are the security/performance implications of such a solution?
networking ssh vpn openvpn nat
add a comment |
I'm trying to connect to my home network using OpenVPN. My router is behind the ISP's router so I'm having a double NAT problem (IP address on WAN port of my router is 10.x.x.x
). ISP cannot provide me with public IP address directly as they don't have such an option so incoming connections are not possible.
My network configuration
I want to have access to the computers on my home network from the Internet.
What I think to do is to create ssh tunnel from my home server that runs OpenVPN server to my VPS that has public IP with something like
autossh -M 10984 -i /root/.ssh/pubkey -R 1194:localhost:1194 me@myvps
Then configure OpenVPN server/clients to use tcp
over udp
and connect to myvps:1194
So my questions are:
- Is there a better way to do this?
- What are the security/performance implications of such a solution?
networking ssh vpn openvpn nat
add a comment |
I'm trying to connect to my home network using OpenVPN. My router is behind the ISP's router so I'm having a double NAT problem (IP address on WAN port of my router is 10.x.x.x
). ISP cannot provide me with public IP address directly as they don't have such an option so incoming connections are not possible.
My network configuration
I want to have access to the computers on my home network from the Internet.
What I think to do is to create ssh tunnel from my home server that runs OpenVPN server to my VPS that has public IP with something like
autossh -M 10984 -i /root/.ssh/pubkey -R 1194:localhost:1194 me@myvps
Then configure OpenVPN server/clients to use tcp
over udp
and connect to myvps:1194
So my questions are:
- Is there a better way to do this?
- What are the security/performance implications of such a solution?
networking ssh vpn openvpn nat
I'm trying to connect to my home network using OpenVPN. My router is behind the ISP's router so I'm having a double NAT problem (IP address on WAN port of my router is 10.x.x.x
). ISP cannot provide me with public IP address directly as they don't have such an option so incoming connections are not possible.
My network configuration
I want to have access to the computers on my home network from the Internet.
What I think to do is to create ssh tunnel from my home server that runs OpenVPN server to my VPS that has public IP with something like
autossh -M 10984 -i /root/.ssh/pubkey -R 1194:localhost:1194 me@myvps
Then configure OpenVPN server/clients to use tcp
over udp
and connect to myvps:1194
So my questions are:
- Is there a better way to do this?
- What are the security/performance implications of such a solution?
networking ssh vpn openvpn nat
networking ssh vpn openvpn nat
asked Jan 18 at 11:20
hurlenkohurlenko
31
31
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
What are the security/performance implications of such a solution?
You have two layers of encryption (SSH and OpenVPN), which might reduce performance – higher CPU usage and lower throughput, especially if one of your three involved devices doesn't have hardware crypto acceleration. (Even then, the SSH software rarely provides top performance.)
You also have three layers of nested TCP flow control (your regular traffic, inside the OpenVPN layer, inside the SSH layer). This might not work well.
Finally, throughput will be reduced by the tunnel overhead alone (SSH and OpenVPN packet headers eating into the available baseline 1500-byte MTU). Of course, one layer is unavoidable for a VPN, but doubling it might be noticeable.
direct: IPv4 <20> | | TCP <20> | application
vpn: IPv4 <20> | UDP <8> | OpenVPN <41> | IPv4 <20> | TCP <20> | application
yours: IPv4 <20> | TCP <20> | SSH <~20–40> | OpenVPN <41> | IPv4 <20> | TCP <20> | application
Is there a better way to do this?
As you already have a VPS, put the OpenVPN server there – and have your home system connect "out" to the VPS instead of the reverse. (Yes, the OpenVPN server will forward data between your 'home' and 'roaming' clients with no problems.)
This way you'll even be able to use UDP without any NAT-related problems, as long as you enable periodic ping in the client or otherwise maintain frequent traffic over the tunnel.
If you're using tun-mode VPN, the server just needs a kernel route for your LAN subnet through tun0
, and then an OpenVPN iroute for the same subnet through the home VPN client's address. (With tap-mode VPN it's just a single kernel route combining both.)
Thanks for your answer! If I configure my home router (it has OpenVPN support) to connect to my VPS and then connect to the same VPS from outside my home network (eg using my phone with 3g) will I be able to access my home server by its dns name configured on the router (using dnsmasq) or I would need to do some additional routing?
– hurlenko
Jan 18 at 12:34
add a comment |
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',
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
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1395719%2fopenvpn-over-ssh-tunnel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
What are the security/performance implications of such a solution?
You have two layers of encryption (SSH and OpenVPN), which might reduce performance – higher CPU usage and lower throughput, especially if one of your three involved devices doesn't have hardware crypto acceleration. (Even then, the SSH software rarely provides top performance.)
You also have three layers of nested TCP flow control (your regular traffic, inside the OpenVPN layer, inside the SSH layer). This might not work well.
Finally, throughput will be reduced by the tunnel overhead alone (SSH and OpenVPN packet headers eating into the available baseline 1500-byte MTU). Of course, one layer is unavoidable for a VPN, but doubling it might be noticeable.
direct: IPv4 <20> | | TCP <20> | application
vpn: IPv4 <20> | UDP <8> | OpenVPN <41> | IPv4 <20> | TCP <20> | application
yours: IPv4 <20> | TCP <20> | SSH <~20–40> | OpenVPN <41> | IPv4 <20> | TCP <20> | application
Is there a better way to do this?
As you already have a VPS, put the OpenVPN server there – and have your home system connect "out" to the VPS instead of the reverse. (Yes, the OpenVPN server will forward data between your 'home' and 'roaming' clients with no problems.)
This way you'll even be able to use UDP without any NAT-related problems, as long as you enable periodic ping in the client or otherwise maintain frequent traffic over the tunnel.
If you're using tun-mode VPN, the server just needs a kernel route for your LAN subnet through tun0
, and then an OpenVPN iroute for the same subnet through the home VPN client's address. (With tap-mode VPN it's just a single kernel route combining both.)
Thanks for your answer! If I configure my home router (it has OpenVPN support) to connect to my VPS and then connect to the same VPS from outside my home network (eg using my phone with 3g) will I be able to access my home server by its dns name configured on the router (using dnsmasq) or I would need to do some additional routing?
– hurlenko
Jan 18 at 12:34
add a comment |
What are the security/performance implications of such a solution?
You have two layers of encryption (SSH and OpenVPN), which might reduce performance – higher CPU usage and lower throughput, especially if one of your three involved devices doesn't have hardware crypto acceleration. (Even then, the SSH software rarely provides top performance.)
You also have three layers of nested TCP flow control (your regular traffic, inside the OpenVPN layer, inside the SSH layer). This might not work well.
Finally, throughput will be reduced by the tunnel overhead alone (SSH and OpenVPN packet headers eating into the available baseline 1500-byte MTU). Of course, one layer is unavoidable for a VPN, but doubling it might be noticeable.
direct: IPv4 <20> | | TCP <20> | application
vpn: IPv4 <20> | UDP <8> | OpenVPN <41> | IPv4 <20> | TCP <20> | application
yours: IPv4 <20> | TCP <20> | SSH <~20–40> | OpenVPN <41> | IPv4 <20> | TCP <20> | application
Is there a better way to do this?
As you already have a VPS, put the OpenVPN server there – and have your home system connect "out" to the VPS instead of the reverse. (Yes, the OpenVPN server will forward data between your 'home' and 'roaming' clients with no problems.)
This way you'll even be able to use UDP without any NAT-related problems, as long as you enable periodic ping in the client or otherwise maintain frequent traffic over the tunnel.
If you're using tun-mode VPN, the server just needs a kernel route for your LAN subnet through tun0
, and then an OpenVPN iroute for the same subnet through the home VPN client's address. (With tap-mode VPN it's just a single kernel route combining both.)
Thanks for your answer! If I configure my home router (it has OpenVPN support) to connect to my VPS and then connect to the same VPS from outside my home network (eg using my phone with 3g) will I be able to access my home server by its dns name configured on the router (using dnsmasq) or I would need to do some additional routing?
– hurlenko
Jan 18 at 12:34
add a comment |
What are the security/performance implications of such a solution?
You have two layers of encryption (SSH and OpenVPN), which might reduce performance – higher CPU usage and lower throughput, especially if one of your three involved devices doesn't have hardware crypto acceleration. (Even then, the SSH software rarely provides top performance.)
You also have three layers of nested TCP flow control (your regular traffic, inside the OpenVPN layer, inside the SSH layer). This might not work well.
Finally, throughput will be reduced by the tunnel overhead alone (SSH and OpenVPN packet headers eating into the available baseline 1500-byte MTU). Of course, one layer is unavoidable for a VPN, but doubling it might be noticeable.
direct: IPv4 <20> | | TCP <20> | application
vpn: IPv4 <20> | UDP <8> | OpenVPN <41> | IPv4 <20> | TCP <20> | application
yours: IPv4 <20> | TCP <20> | SSH <~20–40> | OpenVPN <41> | IPv4 <20> | TCP <20> | application
Is there a better way to do this?
As you already have a VPS, put the OpenVPN server there – and have your home system connect "out" to the VPS instead of the reverse. (Yes, the OpenVPN server will forward data between your 'home' and 'roaming' clients with no problems.)
This way you'll even be able to use UDP without any NAT-related problems, as long as you enable periodic ping in the client or otherwise maintain frequent traffic over the tunnel.
If you're using tun-mode VPN, the server just needs a kernel route for your LAN subnet through tun0
, and then an OpenVPN iroute for the same subnet through the home VPN client's address. (With tap-mode VPN it's just a single kernel route combining both.)
What are the security/performance implications of such a solution?
You have two layers of encryption (SSH and OpenVPN), which might reduce performance – higher CPU usage and lower throughput, especially if one of your three involved devices doesn't have hardware crypto acceleration. (Even then, the SSH software rarely provides top performance.)
You also have three layers of nested TCP flow control (your regular traffic, inside the OpenVPN layer, inside the SSH layer). This might not work well.
Finally, throughput will be reduced by the tunnel overhead alone (SSH and OpenVPN packet headers eating into the available baseline 1500-byte MTU). Of course, one layer is unavoidable for a VPN, but doubling it might be noticeable.
direct: IPv4 <20> | | TCP <20> | application
vpn: IPv4 <20> | UDP <8> | OpenVPN <41> | IPv4 <20> | TCP <20> | application
yours: IPv4 <20> | TCP <20> | SSH <~20–40> | OpenVPN <41> | IPv4 <20> | TCP <20> | application
Is there a better way to do this?
As you already have a VPS, put the OpenVPN server there – and have your home system connect "out" to the VPS instead of the reverse. (Yes, the OpenVPN server will forward data between your 'home' and 'roaming' clients with no problems.)
This way you'll even be able to use UDP without any NAT-related problems, as long as you enable periodic ping in the client or otherwise maintain frequent traffic over the tunnel.
If you're using tun-mode VPN, the server just needs a kernel route for your LAN subnet through tun0
, and then an OpenVPN iroute for the same subnet through the home VPN client's address. (With tap-mode VPN it's just a single kernel route combining both.)
edited Jan 18 at 12:03
answered Jan 18 at 11:43
grawitygrawity
237k37504558
237k37504558
Thanks for your answer! If I configure my home router (it has OpenVPN support) to connect to my VPS and then connect to the same VPS from outside my home network (eg using my phone with 3g) will I be able to access my home server by its dns name configured on the router (using dnsmasq) or I would need to do some additional routing?
– hurlenko
Jan 18 at 12:34
add a comment |
Thanks for your answer! If I configure my home router (it has OpenVPN support) to connect to my VPS and then connect to the same VPS from outside my home network (eg using my phone with 3g) will I be able to access my home server by its dns name configured on the router (using dnsmasq) or I would need to do some additional routing?
– hurlenko
Jan 18 at 12:34
Thanks for your answer! If I configure my home router (it has OpenVPN support) to connect to my VPS and then connect to the same VPS from outside my home network (eg using my phone with 3g) will I be able to access my home server by its dns name configured on the router (using dnsmasq) or I would need to do some additional routing?
– hurlenko
Jan 18 at 12:34
Thanks for your answer! If I configure my home router (it has OpenVPN support) to connect to my VPS and then connect to the same VPS from outside my home network (eg using my phone with 3g) will I be able to access my home server by its dns name configured on the router (using dnsmasq) or I would need to do some additional routing?
– hurlenko
Jan 18 at 12:34
add a comment |
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.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1395719%2fopenvpn-over-ssh-tunnel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
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