Run ocserv OpenConnect VPN server
Install ocserv
Debian
$ apt-get install ocserv
CentOS or RHEL
$ yum install ocserv
Config ocserv Server
Make following changes and override the values in /etc/ocserv.conf
default-domain = <your-host-name> auth = "plain[passwd=/opt/kbvpn/test1.passwd]" tcp-port = 2143 udp-port = 2143 server-cert = /opt/kbvpn/server-cert.pem server-key = /opt/kbvpn/server-key.pem ipv4-network = 10.12.0.0 ipv4-netmask = 255.255.255.0 cert-user-oid = 0.9.2342.19200300.100.1.1 route = 10.12.0.0/255.255.255.0
Restart ocserv Server
$ systemctl restart ocserv
Setup IP Forwarding using iptables
Uncomment or add following lines to /etc/sysctl.conf
net.ipv4.ip_forward=1 net.ipv4.conf.all.proxy_arp=1 net.ipv6.conf.all.forwarding=1
Then reload above rules using following command
$ sysctl -p
Use following iptables command add ip forwarding rules to your linux machine
$ iptables -t nat -A POSTROUTING -o <your-network-adapter-interface-name> -j MASQUERADE
Refer to following page for more information:
http://ocserv.gitlab.io/www/manual.html