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:openvpn:client [2020/06/15 17:26] – [Introduction] vgaeteradocs:guide-user:services:vpn:openvpn:client [2021/09/27 03:25] – [2. Firewall] vgaetera
Line 4: Line 4:
 ===== Introduction ===== ===== Introduction =====
   * This how-to describes the method for setting up [[wp>OpenVPN|OpenVPN]] client on OpenWrt.   * This how-to describes the method for setting up [[wp>OpenVPN|OpenVPN]] client on OpenWrt.
-  * You can use it to connect to your own OpenVPN server or a commercial OpenVPN provider. +  * Follow [[docs:guide-user:services:vpn:openvpn:server|OpenVPN server]] for server setup and [[docs:guide-user:services:vpn:openvpn:extras|OpenVPN extras]] for additional tuning.
-  * Follow [[docs:guide-user:services:vpn:openvpn:basic|OpenVPN basic]] for server setup and [[docs:guide-user:services:vpn:openvpn:extra|OpenVPN extras]] for additional tuning+
-  * See [[docs:guide-user:services:vpn:openvpn:client-luci|OpenVPN client with LuCI]] to configure an OpenVPN client using web interface. +
-  * Check [[docs:guide-user:services:vpn:openvpn:performance|OpenVPN performance]] to compare performance of different SoCs.+
  
 ===== Goals ===== ===== Goals =====
-{{section>docs:guide-user:services:vpn:openvpn:basic#goals&noheader&nofooter&noeditbutton}}+{{section>docs:guide-user:services:vpn:wireguard:server#goals&noheader&nofooter&noeditbutton}}
  
-===== Instructions =====+===== Command-line instructions =====
 ==== 1. Preparation ==== ==== 1. Preparation ====
-Install the packages and specify the VPN client configuration parameters.+Install the required packages.
  
 <code bash> <code bash>
Line 20: Line 17:
 opkg update opkg update
 opkg install openvpn-openssl opkg install openvpn-openssl
- 
-# Configuration parameters 
-OVPN_DIR="/etc/openvpn" 
-OVPN_DEV="tun0" 
-OVPN_ID="client" 
 </code> </code>
  
 ==== 2. Firewall ==== ==== 2. Firewall ====
-Consider VPN network as public and assign VPN interface to WAN zone to minimize firewall setup.+Consider VPN network as public
 +Assign VPN interface to WAN zone to minimize firewall setup.
  
 <code bash> <code bash>
Line 34: Line 27:
 uci rename firewall.@zone[0]="lan" uci rename firewall.@zone[0]="lan"
 uci rename firewall.@zone[1]="wan" uci rename firewall.@zone[1]="wan"
-uci rename firewall.@forwarding[0]="lan_wan" +uci del_list firewall.wan.device="tun+
-uci del_list firewall.wan.device="${OVPN_DEV}+uci add_list firewall.wan.device="tun+"
-uci add_list firewall.wan.device="${OVPN_DEV}"+
 uci commit firewall uci commit firewall
 /etc/init.d/firewall restart /etc/init.d/firewall restart
 </code> </code>
  
-==== 3. Basic client ==== +==== 3. VPN service ==== 
-Save your client profile and configure VPN client. +Save your client profile to configure VPN service.
-Drop VPN service privileges and ensure VPN interface name matches firewall configuration.+
  
 <code bash> <code bash>
 # Save VPN client profile # Save VPN client profile
 umask go= umask go=
-cat << "EOF${OVPN_DIR}/${OVPN_ID}.conf+cat << EOF > /etc/openvpn/client.conf
 COPY_PASTE_CLIENT_PROFILE_HERE COPY_PASTE_CLIENT_PROFILE_HERE
 EOF EOF
- 
-# Configure VPN client 
-sed -i -e " 
-/^user/s/^/#/ 
-\$a user nobody 
-/^group/s/^/#/ 
-\$a group nogroup 
-/^dev/s/^/#/ 
-\$a dev ${OVPN_DEV} 
-" ${OVPN_DIR}/${OVPN_ID}.conf 
 /etc/init.d/openvpn restart /etc/init.d/openvpn restart
 </code> </code>
  
-==== 4. Commercial provider ==== +Configure credentials for [[docs:guide-user:services:vpn:openvpn:extras#commercial_provider|commercial provider]] if required.
-If using a commercial VPN provider, set up credentials for username/password authentication and enforce gateway redirect. +
- +
-<code bash> +
-# Save username/password credentials +
-umask go= +
-cat << "EOF" > ${OVPN_DIR}/${OVPN_ID}.auth +
-OVPN_USERNAME +
-OVPN_PASSWORD +
-EOF +
- +
-# Configure VPN client +
-sed -i -e " +
-/^auth-user-pass/s/^/#+
-\$a auth-user-pass ${OVPN_ID}.auth +
-/^redirect-gateway/s/^/#/ +
-\$a redirect-gateway def1 ipv6 +
-" ${OVPN_DIR}/${OVPN_ID}.conf +
-/etc/init.d/openvpn restart +
-</code>+
  
 ===== Testing ===== ===== Testing =====
-{{section>docs:guide-user:services:vpn:openvpn:basic#testing&noheader&nofooter&noeditbutton}}+{{section>docs:guide-user:services:vpn:wireguard:server#testing&noheader&nofooter&noeditbutton}}
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
-{{section>docs:guide-user:services:vpn:openvpn:basic#troubleshooting&noheader&nofooter&noeditbutton}}+{{section>docs:guide-user:services:vpn:openvpn:server#troubleshooting&noheader&nofooter&noeditbutton}}
  
  • Last modified: 2023/10/14 05:16
  • by vgaetera