Build OpenConnect VPN server AnyConnect (ocserv)

This article had written the,But never had a chance to do the experiment too--estimation,Anyway, writing,I will come,Everyone if necessary in conjunction with a look at ... ...?note,Please refer to theLatest notes

To build on the server ocserv,Should first install dependency

Download ocserv

access To view the latest version,Then according to the versions to download,So far,The latest version number is 0.10.4

Compile and install

Create a user

Created user will be saved to the "/etc/ocserv/ocpasswd"

Creating a certificate

Generate a CA certificate

Locally generated server certificate

Generate a client certificate

To import a certificate

Modify the configuration

Main changes are as follows

Other,You can refer tothis projectDirectly to your profile to add routing table:

modify"/etc/ocserv/profile.xml""HostAddress"The IP address for your server。

Opening NAT forwarding address

If you use the UFW to control iptables,Can moveOpen nat masquerading and port forwarding on ufw,If you prefer the traditional method of configuration,Then:

Automatically adjust the MTU

Open NAT

(Remember your network card eth0,OpenVZ is the venet0

Turn on IPv4 forwarding

Admit 443 port

Create a service file

"/etc/init.d"Create file"ocserv”,Then write


Such,You can use the following commands to control ocserv The:

At last

Use the following command to temporarily enable debug mode

Further reading

[Reprint]AnyConnect ( ocserv ) Build tutorials

Installation configuration OpenConnect VPN server AnyConnect (ocserv)

Notes on building OpenConnect server on Ubuntu Server

Original article written by Gerber drop-off:R0uter's Blog » Build OpenConnect VPN server AnyConnect (ocserv)

Reproduced Please keep the source and description link:

About the Author


The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Leave a Reply

Your email address will not be published. Required fields are marked *