{"id":1213,"date":"2020-04-15T12:29:28","date_gmt":"2020-04-15T12:29:28","guid":{"rendered":"http:\/\/kabiliravi.com\/?page_id=1213"},"modified":"2020-04-16T19:43:42","modified_gmt":"2020-04-16T19:43:42","slug":"run-ocserv-openconnect-vpn-server","status":"publish","type":"page","link":"http:\/\/kabiliravi.com\/index.php\/software\/miscellaneous\/setting-up-a-vpn-server-using-openconnect\/run-ocserv-openconnect-vpn-server\/","title":{"rendered":"Run ocserv OpenConnect VPN server"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Install ocserv<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">Debian<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">$ apt-get install ocserv<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">CentOS or RHEL<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">$ yum install ocserv<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Config ocserv Server<\/h2>\n\n\n\n<p>Make following changes and override the values in <strong>\/etc\/ocserv.conf <\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">default-domain = &lt;your-host-name&gt;\nauth = \"plain[passwd=\/opt\/kbvpn\/test1.passwd]\"\n\ntcp-port = 2143\nudp-port = 2143\n\nserver-cert = \/opt\/kbvpn\/server-cert.pem\nserver-key = \/opt\/kbvpn\/server-key.pem\n\nipv4-network = 10.12.0.0\nipv4-netmask = 255.255.255.0\n\ncert-user-oid = 0.9.2342.19200300.100.1.1\n\nroute = 10.12.0.0\/255.255.255.0<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Restart ocserv Server<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">$ systemctl restart ocserv<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Setup IP Forwarding using iptables<\/h2>\n\n\n\n<p>Uncomment or add following lines to \/etc\/sysctl.conf<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">net.ipv4.ip_forward=1\nnet.ipv4.conf.all.proxy_arp=1\nnet.ipv6.conf.all.forwarding=1<\/pre>\n\n\n\n<p>Then reload above rules using following command<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sysctl -p<\/pre>\n\n\n\n<p>Use following iptables command add ip forwarding rules to your linux machine<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ iptables -t nat -A POSTROUTING -o &lt;your-network-adapter-interface-name> -j MASQUERADE<\/pre>\n\n\n\n<p>Refer to following page for more information: <br><a href=\"http:\/\/ocserv.gitlab.io\/www\/manual.html\">http:\/\/ocserv.gitlab.io\/www\/manual.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 = &lt;your-host-name&gt; auth = &#8220;plain[passwd=\/opt\/kbvpn\/test1.passwd]&#8221; 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 = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1208,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-1213","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/1213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/comments?post=1213"}],"version-history":[{"count":6,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/1213\/revisions"}],"predecessor-version":[{"id":1240,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/1213\/revisions\/1240"}],"up":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/1208"}],"wp:attachment":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/media?parent=1213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}