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/09/17 23:46] – [IPv6 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 ====
 {{section>docs:guide-user:services:vpn:wireguard:extras#dynamic_connection&noheader&nofooter&noeditbutton}} {{section>docs:guide-user:services:vpn:wireguard:extras#dynamic_connection&noheader&nofooter&noeditbutton}}
  
-==== Disable gateway redirection ==== +==== Default gateway ==== 
-If you do not need to redirect 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>
-# Configure VPN service 
 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 72: 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 81: 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>
  
 ==== IPv6 gateway ==== ==== IPv6 gateway ====
-Set up [[docs:guide-user:network:ipv6:ipv6_henet|IPv6 tunnel broker]] or enable [[docs:guide-user:firewall:fw3_configurations:fw3_nat#ipv6_nat|IPv6 NAT or NPT]] if necessary.+Set up [[docs:guide-user:network:ipv6:ipv6_henet|IPv6 tunnel broker]] or use [[docs:guide-user:firewall:fw3_configurations:fw3_nat#ipv6_nat|IPv6 NAT or NPT]] if necessary.
 Enable IPv6 tunnel on VPN server, offer IPv6 DNS, redirect IPv6 gateway. Enable IPv6 tunnel on VPN server, offer IPv6 DNS, redirect IPv6 gateway.
  
 <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 99: 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 124: 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>
  
Line 131: Line 140:
  
 <code bash> <code bash>
-URL="https://openwrt.org/_export/code/docs/guide-user/services/vpn/openconnect"+URL="https://openwrt.org/_export/code/docs/guide-user/services/vpn/openconnect/server"
 cat << EOF > openconnect-server.sh cat << EOF > openconnect-server.sh
-$(wget -U "" -O - "${URL}/server?codeblock=0"+$(wget -U "" -O - "${URL}?codeblock=0"
-$(wget -U "" -O - "${URL}/server?codeblock=1"+$(wget -U "" -O - "${URL}?codeblock=1"
-$(wget -U "" -O - "${URL}/server?codeblock=2"+$(wget -U "" -O - "${URL}?codeblock=2"
-$(wget -U "" -O - "${URL}/server?codeblock=3")+$(wget -U "" -O - "${URL}?codeblock=3")
 EOF EOF
 sh openconnect-server.sh sh openconnect-server.sh
 </code> </code>
  
  • Last modified: 2024/10/17 17:30
  • by andrewz