Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an openvpn (version 2.1_rc15 at both ends) connection setup between two gentoo boxes using shared keys. it works fine for the most part. I use mysql, http, ftp, scp over the vpn with no problems. But when I ssh from the client to the server over the vpn, weird things happen. I can login, i can execute some commands. But if i try to run an ncurses application like top, or i try to cat a file, the connection will stall and I'll have to sever the ssh session.

I can, for example, execute "echo blah; echo .; echo blah" and it will output the three lines of text over the ssh session fine. But if i execute "cat /etc/motd" the session will freeze the moment I press enter.

I compiled openvpn 2.1.1 on my mac and copied over my config directory from my gentoo client. The mac connected and ssh sessions worked fine without freezing.

I then compiled it on my older gentoo box (2.6.26 kernel) which I am retiring due to a dying hard drive, and ssh over it also works perfectly.

Why does it fail on my brand new gentoo box ? I've tried compiling three different kernels in case it was that, but other than that there should be no difference between my older and my newer gentoo boxes that I can think of.

Any suggestions on what's wrong ?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

smells like mtu issue. try to lower it as described in official manual or in this blog post.

share|improve this answer
2  
Thanks. I had tried dropping the MTU of the ethernet interface with no result, but adding "fragment 1400" to the client and server as in the post you mentioned worked great. I wonder why the older gentoo box worked fine but the newer one didn't. Oh well, fixed now. Thanks –  Pawz May 3 '10 at 6:45
    
Thanks. This fixed my issue. At the office I have the exact same setup without any issues, but at my home, it has some hangs in cases. If I curl a url of a file with a - in it, it hangs. Without a -, it works :D, and if I break up long lines in the file, it also works. It makes no sense, but thanks for the solution. –  Peter Jul 18 '13 at 6:54

This command solves it for me:

$ sudo ip link set dev tun0 mtu 1350 && echo ":)"

You can Verify tun0 settings with

$ ip a s

Cheers!

share|improve this answer

I had simillar issue when OpenVPN was connecting over 3g with bad coverage and lost of packet loss. Switching to TCP instead of UDP fixed all issues I had after that. Hope this helps you out.

share|improve this answer
    
Running a VPN over TCP comes with its own set of problems. Fixing the MTU problem and staying with UDP is likely to work better than using TCP will. –  kasperd Nov 26 at 10:22
    
For OP changing only MTU is probably better suggestion than changing from TCP to UDP. If you have extremely bad, so bad that OpenVPN won't even establish stable connection connection, then you should try TCP instead of UDP. In extremely bad 3G cases changing to TCP was only thing that worked for me. –  valentt Nov 28 at 14:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.