TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

SSH vs. OpenVPN for Tunneling

363 pointsby setraover 7 years ago

31 comments

DrPhishover 7 years ago
I used to maintain an ipsec VPN for road warrior type scenarios, but I&#x27;ve found that mostly I just wanted to get a remote desktop on a computer within the network.<p>So I&#x27;ve stopped mucking around with VPN and just published Apache Guacamole HTML5 VNC&#x2F;RDP tunnels. No plugins, no clients except a modern web browser and good security with certbot+auto redirect to https+simple auth to keep badguys away from possible exploits in the guacamole login form. Configs can be as simple as the NoAuth plugin, all the way to full integration with eg. AD. I&#x27;ve implemented this at a number of businesses, and it does what almost everyone in the organization wants. It also supports things like printing (to a pdf that comes thru the browser as a download) and file transfer. Super easy to set up and is much more responsive than VNC or RDP thru ssh.<p>The times when I actually want full IP access to a network from my laptop are so rare that it seemed silly to maintain IPSec.<p>What need do others have for full-connectivity VPNs? Not site-to-site VPNs of course, but these ad-hoc on the road type ones.<p>Honest question
评论 #15774669 未加载
评论 #15774979 未加载
评论 #15775370 未加载
评论 #15777535 未加载
评论 #15774570 未加载
评论 #15774590 未加载
评论 #15775694 未加载
ryanschneiderover 7 years ago
Wow a little googling on this subject led me to sshuttle, which I&#x27;ve never heard of before but looks awesome, will try it out on Monday:<p><a href="http:&#x2F;&#x2F;sshuttle.readthedocs.io&#x2F;en&#x2F;stable&#x2F;usage.html" rel="nofollow">http:&#x2F;&#x2F;sshuttle.readthedocs.io&#x2F;en&#x2F;stable&#x2F;usage.html</a><p>Basically &quot;vpn over ssh&quot; (not really, but close enough).
评论 #15774438 未加载
评论 #15775647 未加载
评论 #15773727 未加载
评论 #15773680 未加载
评论 #15773679 未加载
评论 #15773623 未加载
评论 #15777324 未加载
评论 #15774002 未加载
评论 #15773667 未加载
评论 #15777028 未加载
评论 #15775590 未加载
评论 #15774649 未加载
评论 #15773621 未加载
ajrossover 7 years ago
This has been known forever. Stream-based packet tunneling absolutely does outperform packet wrapping in good network conditions, for the simple reason that small packets can be combined by the transport layer and avoid the overhead.<p>The problem is that in the presence of any packet loss at all, every packet lost causes a stall of the <i>whole tunnel</i> until it gets retransmitted, which even in the best case recovery conditions requires two (three? I forget my SACK details) round trips. If one side is using traditional TCP retransmit timers it can be much, much longer.
评论 #15774255 未加载
评论 #15773784 未加载
评论 #15774507 未加载
skarapover 7 years ago
`ip link set qlen 1000 dev tun0` (so it matches the eth0 queue, instead of being an order of magnitude smaller) on both ends of the tunnel, and you get 90% of direct connection speed from openvpn:<p><pre><code> $ iperf3 -c 10.1.0.2 Connecting to host 10.1.0.2, port 5201 [ 4] local 10.1.0.1 port 38274 connected to 10.1.0.2 port 5201 [ ID] Interval Transfer Bandwidth Retr Cwnd [ 4] 0.00-1.00 sec 3.12 MBytes 26.1 Mbits&#x2F;sec 0 802 KBytes [ 4] 1.00-2.00 sec 22.3 MBytes 187 Mbits&#x2F;sec 0 2.24 MBytes [ 4] 2.00-3.00 sec 21.4 MBytes 179 Mbits&#x2F;sec 0 2.45 MBytes [ 4] 3.00-4.00 sec 23.3 MBytes 196 Mbits&#x2F;sec 0 2.39 MBytes [ 4] 4.00-5.00 sec 23.4 MBytes 196 Mbits&#x2F;sec 0 2.58 MBytes [ 4] 5.00-6.00 sec 21.5 MBytes 180 Mbits&#x2F;sec 0 2.70 MBytes [ 4] 6.00-7.00 sec 23.5 MBytes 197 Mbits&#x2F;sec 0 2.68 MBytes [ 4] 7.00-8.00 sec 22.6 MBytes 189 Mbits&#x2F;sec 0 2.78 MBytes [ 4] 8.00-9.00 sec 22.4 MBytes 188 Mbits&#x2F;sec 0 2.45 MBytes [ 4] 9.00-10.00 sec 23.5 MBytes 197 Mbits&#x2F;sec 0 2.69 MBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth Retr [ 4] 0.00-10.00 sec 207 MBytes 174 Mbits&#x2F;sec 0 sender [ 4] 0.00-10.00 sec 207 MBytes 174 Mbits&#x2F;sec receiver iperf Done.</code></pre>
jakobeggerover 7 years ago
Using SSH Tunnels is not TCP over TCP.<p>You have a TCP connection between local app and SSH client, then a second TCP connection between SSH client and SSH server, and a third TCP connection between SSH server and remote app.<p>There is no TCP over TCP when you use SSH tunnels. Lost packets between SSH client and SSH server do not cause retransmits on either application side.
评论 #15775479 未加载
andmariosover 7 years ago
There should be some catch in the setup. Maybe the CPUs he used are old and don&#x27;t support hardware AES acceleration?<p>I just run iperf3 over OpenVPN &#x2F; UDP with AES-256-GCM between two servers in the same DC (but different rooms, through their public network, 1gE links) and got an average of 750MBits&#x2F;sec. I don&#x27;t have any special setting.
评论 #15773771 未加载
评论 #15773835 未加载
whalesaladover 7 years ago
It’s really not an apples to apples comparison. For my teammates on the development team, yes an SSH tunnel is going to be easier for our needs due to the reduced overhead. But if I want to give my customer support team access to private web services in our production cluster, a VPN is the perfect solution.<p>At FarmLogs, each of our Kube clusters has a bastion VPN host that puts you inside the VPC and handles DNS to Route53 (and the VPC) so &lt;service&gt;.farmlogs “just works”<p>We use Foxpass to handle this with LDAP bridged to Google Apps so when an employee joins or leaves their VPN access is immediately updated.
mirimirover 7 years ago
A huge advantage of vpn tunnels is that they stay up indefinitely. I&#x27;ve had openvpn links stay up for months. With ssh, you&#x27;re lucky to get a few days. I&#x27;ve tried scripts and even autossh, and ssh has never been as reliable as openvpn or tinc.
评论 #15774115 未加载
评论 #15775277 未加载
ryan-cover 7 years ago
I found that OpenVPN benefited greatly from setting larger tunnel MTUs and then allowing the IP packets to be fragmented. I think it&#x27;s encrypting per-packet which is somewhat inefficient.
gerdesjover 7 years ago
A very intelligent write up with one small, possibly fatal flaw.<p>When you are comparing one thing to another and writing up your pearls of wisdom for the masses you need to control <i>every</i> variable (within reason).<p>I can&#x27;t see a LAN based test acting as a baseline.
评论 #15779958 未加载
nlyover 7 years ago
One thing I hate about OpenVPN is the ridiculous configuration. I&#x27;m a big fan of tinc[0] personally, although you have to use 1.1pre releases to get half decent encryption, it&#x27;s configuration is wonderful.<p>[0] <a href="https:&#x2F;&#x2F;www.tinc-vpn.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.tinc-vpn.org&#x2F;</a>
评论 #15774039 未加载
k_viover 7 years ago
SSH tunnel as proxy is easier and simpler to use if you have a VPS.<p>Setup the tunnel: ssh -D 8080 vv@xx.xx.xx.xxx<p>Change your system proxy settings: Socks proxy, 127.0.0.1, 8080<p>Done!
评论 #15775659 未加载
morpheuskafkaover 7 years ago
[Zerotier](<a href="https:&#x2F;&#x2F;zerotier.com" rel="nofollow">https:&#x2F;&#x2F;zerotier.com</a>) is far nicer than all of them, clients (Win, macOS, GNU\Linux, OpenWrt, iOS, Android, NAS) are open-source and the hosted service allows up to 100 devices on one of unlimited networks for free. Because it emulates the ethernet layer, there is no client side configuration required and it can be used for non-IP packets (ex. DHCP). By enabling the default route permission on the client it can also be used as a gateway to the internet through a remote host on the network. All communications are e2e AES-256 with certificate-based access for private networks. Oh, and they also run a public earth network with unlimited members billed as &quot;the global LAN party.&quot; It&#x27;s a really convenient service, and the performance is good enough to be used between private clouds.
评论 #15777230 未加载
评论 #15776617 未加载
staunchover 7 years ago
1. Doesn&#x27;t look like there were runs of iperf over UDP and TCP, with simulated buffer sizes, so hard to know what the network connection is even capable of.<p>2. Also, how reliable is the network connection? Maybe it fluctuates every minute in usable bandwidth due to congestion or jitter. VMs are subject to noisy neighbor issues.<p>3. It looks like the ciphers are different, which could of course affect throughput greatly if one is not hardware accelerated or if its CPU bound. Worth checking CPU and other system resource usage for differences.<p>4. You could try OpenVPN with encryption and&#x2F;or compression disabled entirely in UDP mode for best possible performance IIRC. This, at least, you would expect to beat an SSH tunnel.
评论 #15773641 未加载
评论 #15773655 未加载
评论 #15773694 未加载
评论 #15773635 未加载
j_sover 7 years ago
Worth looking at ZeroTier (commercial - actually running a hardware IndieGoGo right now) and WireGuard (IPSec - &#x27;The Next Generation&#x27; &#x2F; &#x27;Voyager&#x27; or whichever you thought was best) as modern options.
评论 #15775016 未加载
评论 #15774589 未加载
foxhopover 7 years ago
If you are a road warrior (or you want to bypass security filters at work) you can securely proxy Firefox web and DNS traffic over a VPN using just SSH.<p>All you need is an SSH server running at home or in the &quot;cloud&quot;.<p>I documented this a few years back:<p><a href="http:&#x2F;&#x2F;www.foxhop.net&#x2F;ssh-tunnel" rel="nofollow">http:&#x2F;&#x2F;www.foxhop.net&#x2F;ssh-tunnel</a><p>This is also a great way to access resources on the remote network, for example your router&#x2F;modem setup page or Jenkins, or whatever else is running on that remote Network.
antoniosover 7 years ago
spiped would also be interesting to compare. Ridiculously easy to set up, and made by cperciva.
jstewartmobileover 7 years ago
Didn&#x27;t see any mention of MTU in the post. If the defaults were sub-optimal for OpenVPN, that alone would account for the reduced throughput.
hardwaresoftonover 7 years ago
I recently had to set up a 3 computer SSH tunnel and wrote about it, maybe people will find it interesting:<p><a href="https:&#x2F;&#x2F;vadosware.io&#x2F;post&#x2F;ssh-tunneling-using-an-intermediary-computer&#x2F;" rel="nofollow">https:&#x2F;&#x2F;vadosware.io&#x2F;post&#x2F;ssh-tunneling-using-an-intermediar...</a><p>I first tried to setup OpenVPN and only wanted to use the the SSH tunnel for DNS purposes (I couldn&#x27;t use normal DDNS tools), but in the end, I ended up running a SOCKS proxy over the tunnel and it was stunningly effective, enough that watching Netflix despite intercontinental round trips.
unixheroover 7 years ago
Any love for Softether vpn here? I use it every day to connect gome and it just woeks. Always. It encapsulates ssh I think
qplexover 7 years ago
&gt;&quot;As long as you only need one TCP port forwarded, SSH is a much faster choice, because it has less overhead than SSH.&quot;<p>OpenVPN is way more robust solution for tunneling though.<p>I&#x27;ve found that UDP tunnels work sometimes better in when there is considerable packet loss and high latency (poor radio links).
acdover 7 years ago
IPSec on Linux has better performance than OpenVPN due to multi core support. That said setting up VPN tends to be time consuming and error prone. But what if the ssh connection drops, what restarts the tunnel then? IPSec has restart mechanism for when the net drops which it will do.
INTPenisover 7 years ago
I use both actually, where the best tool is applicable.<p>Some commenters have mentioned StrongSwan (or OpenSwan which is more known to me).<p>I&#x27;ve actually seen OpenSwan perform better than Cisco VPN tunnels. And I love pointing that out to our networking guys since we pay nothing for OpenSwan.
sireatover 7 years ago
What&#x27;s the fastest option when you do need UDP?<p>Generally I just use SSH, but for gaming i&#x27;ve resorted to 160bit OpenVPN.<p>Incidentally setting up a OpenVPN server on dd-wrt is a rather hellish experience.
throwaway2048over 7 years ago
The overhead of layer 2&#x2F;3 packet headers in OpenVPN did not cause such a huge slowdown, its much more likely that OpenVPN was operating in TCP mode, and thus subject to the tcp-in-tcp[1] problem with tunnel internal tcp sessions. Even an extraordinarily slow machine by modern standards can manage 100mbit openVPN without much of an issue.<p>EDIT: did not see UDP results. There is still something else going on here, thats still much too slow for openVPN (without tweaking).<p>[1] <a href="http:&#x2F;&#x2F;sites.inka.de&#x2F;bigred&#x2F;devel&#x2F;tcp-tcp.html" rel="nofollow">http:&#x2F;&#x2F;sites.inka.de&#x2F;bigred&#x2F;devel&#x2F;tcp-tcp.html</a>
评论 #15773585 未加载
sanborover 7 years ago
There is a very simple test: fast.com. I tried fast.com over sshuttle and OpenVPN and OpenVPN was faster while sshuttle kind of collapsed.
Yegoriusover 7 years ago
I wonder why nobody has mentioned StrongSwan (IPSec+IKEv2) or ShadowSocks, which are both performant and very secure.
评论 #15775038 未加载
throwaway613834over 7 years ago
How do you redirect DNS over SSH though?
评论 #15773884 未加载
评论 #15773868 未加载
评论 #15774854 未加载
评论 #15773836 未加载
josteinkover 7 years ago
They&#x27;re different beasts with different use-cases.<p>I rely on both, and like having both options around.
saasproductover 7 years ago
I use <a href="https:&#x2F;&#x2F;github.com&#x2F;apenwarr&#x2F;sshuttle" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;apenwarr&#x2F;sshuttle</a> but it&#x27;s often too slow. I am wonder if their exist any go&#x2F;rust equivalent of this project.
khanjahanzaib27over 7 years ago
Cool Keep it up.