Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:guide-user:services:vpn:openconnect:extras [2023/10/06 21:11] – [Default gateway] vgaeteradocs:guide-user:services:vpn:openconnect:extras [2024/10/16 20:06] – [Default gateway] andrewz
Line 4: Line 4:
 ===== Introduction ===== ===== Introduction =====
   * This how-to describes the most common [[wp>OpenConnect|OpenConnect]] tuning scenarios adapted for OpenWrt.   * This how-to describes the most common [[wp>OpenConnect|OpenConnect]] tuning scenarios adapted for OpenWrt.
-  * Follow [[docs:guide-user:services:vpn:openconnect:client|OpenConnect client]] for client setup and [[docs:guide-user:services:vpn:openconnect:server|OpenConnect server]] for server setup.+  * Follow [[docs:guide-user:services:vpn:openconnect:server|OpenConnect server]] for server setup and [[docs:guide-user:services:vpn:openconnect:client|OpenConnect client]] for client setup.
   * Follow [[docs:guide-user:network:tunneling_interface_protocols#protocol_openconnect_openconnect_vpn|OpenConnect protocol]] for client configuration.   * Follow [[docs:guide-user:network:tunneling_interface_protocols#protocol_openconnect_openconnect_vpn|OpenConnect protocol]] for client configuration.
   * Follow [[docs:guide-user:services:ddns:client|DDNS client]] to use own server with dynamic IP address.   * Follow [[docs:guide-user:services:ddns:client|DDNS client]] to use own server with dynamic IP address.
Line 16: Line 16:
  
 ==== Web interface ==== ==== Web interface ====
-If you want to manage VPN settings using web interface+If you want to manage VPN server settings using web interface:
-Install the necessary packages.+
  
 <code bash> <code bash>
Line 23: Line 22:
 opkg update opkg update
 opkg install luci-app-ocserv opkg install luci-app-ocserv
-/etc/init.d/rpcd restart+service rpcd restart
 </code> </code>
  
 Navigate to **LuCI -> VPN -> OpenConnect VPN** to configure OpenConnect server. Navigate to **LuCI -> VPN -> OpenConnect VPN** to configure OpenConnect server.
 +
 +If you want to configure VPN client using web interface:
  
 <code bash> <code bash>
Line 32: Line 33:
 opkg update opkg update
 opkg install luci-proto-openconnect opkg install luci-proto-openconnect
-/etc/init.d/rpcd restart+service rpcd restart
 </code> </code>
  
 Navigate to **LuCI -> Network -> Interfaces** to configure OpenConnect client. Navigate to **LuCI -> Network -> Interfaces** to configure OpenConnect client.
 +
 +==== Commercial provider ====
 +Fetch server certificate from remote VPN server.
 +Beware of possible MITM.
 +
 +<code bash>
 +openssl s_client -showcerts -connect ${VPN_SERV}:${VPN_PORT} \
 +< /dev/null > server-cert.pem
 +</code>
 +
  
 ==== Dynamic connection ==== ==== Dynamic connection ====
Line 41: Line 52:
  
 ==== Default gateway ==== ==== Default gateway ====
-If you do not need to route all traffic to VPN+Disable gateway redirection in the client if you don'need to route all traffic through VPN.
-Disable gateway redirection on VPN client.+
  
 <code bash> <code bash>
 uci set network.vpn.defaultroute="0" uci set network.vpn.defaultroute="0"
 uci commit network uci commit network
-/etc/init.d/network restart+service network restart
 </code> </code>
  
 ==== Split gateway ==== ==== Split gateway ====
 If VPN gateway is separate from your LAN gateway. If VPN gateway is separate from your LAN gateway.
-Implement plain routing between LAN network and VPN network assuming that:+Implement plain routing between LAN and VPN networks assuming that:
   * ''192.168.1.0/24'' - LAN network   * ''192.168.1.0/24'' - LAN network
   * ''192.168.1.2/24'' - VPN gateway   * ''192.168.1.2/24'' - VPN gateway
-  * ''192.168.7.0/24'' - VPN network+  * ''192.168.9.0/24'' - VPN network
  
 Add port forwarding for VPN server on LAN gateway. Add port forwarding for VPN server on LAN gateway.
Line 71: Line 81:
 uci set firewall.oc.target="DNAT" uci set firewall.oc.target="DNAT"
 uci commit firewall uci commit firewall
-/etc/init.d/firewall restart+service firewall restart
 </code> </code>
  
Line 80: Line 90:
 uci set network.vpn="route" uci set network.vpn="route"
 uci set network.vpn.interface="lan" uci set network.vpn.interface="lan"
-uci set network.vpn.target="192.168.7.0/24"+uci set network.vpn.target="192.168.9.0/24"
 uci set network.vpn.gateway="192.168.1.2" uci set network.vpn.gateway="192.168.1.2"
 uci commit network uci commit network
-/etc/init.d/network restart+service network restart
 </code> </code>
  
Line 91: Line 101:
  
 <code bash> <code bash>
-VPN_POOL6="fd00:7::/64" +VPN_POOL6="fd00:9::/64" 
-VPN_DNS6="${VPN_POOL6%/*}1"+VPN_DNS6="${VPN_POOL6%:*}:1"
 uci set ocserv.config.ip6addr="${VPN_POOL6}" uci set ocserv.config.ip6addr="${VPN_POOL6}"
 uci -q delete ocserv.dns6 uci -q delete ocserv.dns6
Line 98: Line 108:
 uci set ocserv.dns6.ip="${VPN_DNS6}" uci set ocserv.dns6.ip="${VPN_DNS6}"
 uci commit ocserv uci commit ocserv
-/etc/init.d/ocserv restart+service ocserv restart
 </code> </code>
  
Line 123: Line 133:
 uci set ocserv.client1.password="${VPN_HASH}" uci set ocserv.client1.password="${VPN_HASH}"
 uci commit ocserv uci commit ocserv
-/etc/init.d/ocserv restart+service ocserv restart
 </code> </code>
  
  • Last modified: 2024/10/17 17:30
  • by andrewz