DigitalOcean上已经有很详细的介绍了,按照这个配置就可以。
其中注意的点:有些云服务器商提供的 Ubuntu Server 14.04 LTS 镜像是不带ufw
的,那一步可以根据实际遇到的情况处理。
服务器端搭好以后,在自己电脑上就可以作为客户端愉快的使用了。
我的情况是Windows
下直接使用没有问题,Linux
能连接,但是DNS存在问题。
在ArchWiki
上找到了原因,
The DNS servers used by the system are defined in /etc/resolv.conf. Traditionally, this file is the responsibility of whichever program deals with connecting the system to the network (e.g. Wicd, NetworkManager, etc…) However, OpenVPN will need to modify this file if you want to be able to resolve names on the remote side. To achieve this in a sensible way, install openresolv, which makes it possible for more than one program to modify resolv.conf without stepping on each-other’s toes.
Before continuing, test openresolv by restarting your network connection and ensuring that resolv.conf states that it was generated by resolvconf, and that your DNS resolution still works as before. You should not need to configure openresolv; it should be automatically detected and used by your network system.
For Linux, OpenVPN can send DNS host information, but expects an external process to act on it. This can be done with a openvpn-update-resolv-conf script, which can be saved for example at /etc/openvpn/update-resolv-conf and make it executable with chmod. There is also an AUR package: openvpn-update-resolv-confAUR which will take care of the script installation for you.
解决方法实在ovpn
配置文件后添加以下三行:
1 | script-security 2 |
现在一切是如此美好,Enjoy!
Reference: