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 [2019/04/06 06:56] – header style unified vgaeteradocs:guide-user:services:vpn:openvpn:client [2021/09/27 03:25] – [2. Firewall] vgaetera
Line 1: Line 1:
-====== OpenVPN Client ====== +====== OpenVPN client ====== 
-{{page>meta:infobox:cli_setup&noheader&nofooter&noeditbtn}}+{{section>meta:infobox:howto_links#cli_skills&noheader&nofooter&noeditbutton}}
  
 ===== Introduction ===== ===== Introduction =====
-  * This guide describes how to configure OpenWrt to run [[wp>OpenVPN|OpenVPN]] client+  * 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 [[basic|OpenVPN Basic]] for server setup and [[extra|OpenVPN Extra]] for additional tuning.+
  
 ===== Goals ===== ===== Goals =====
-  * Encrypt your internet connection to enforce security and privacy. +{{section>docs:guide-user:services:vpn:wireguard:server#goals&noheader&nofooter&noeditbutton}}
-    * Prevent data leak and traffic spoofing on the path to client-ISP. +
-    * Escape client-ISP content-filters and internet censorship. +
-  * Access your VPN-server LAN-services remotely without port forwarding. +
-  * Access region-restricted services and content using commercial VPN-providers.+
  
-===== Instructions ===== +===== Command-line instructions ===== 
-==== 1. Firewall ==== +==== 1. Preparation ==== 
-To minimize firewall setup consider VPN-network as public and assign VPN-interface to WAN-zone.+Install the required packages.
  
 <code bash> <code bash>
-Configure firewall +Install packages 
-uci set firewall.@zone[1].device="tun0" +opkg update 
-uci commit firewall +opkg install openvpn-openssl
-service firewall restart+
 </code> </code>
  
-==== 2. VPN-service ==== +==== 2. Firewall ==== 
-Save your client profile. +Consider VPN network as public
-Install and configure VPN-client+Assign VPN interface to WAN zone to minimize firewall setup.
-Drop VPN-service privileges and ensure VPN-interface name matches network configuration.+
  
 <code bash> <code bash>
-Save VPN-client profile +Configure firewall 
-cat << "EOF" > /etc/openvpn/vpnclient.conf +uci rename firewall.@zone[0]="lan
-COPY_PASTE_CLIENT_PROFILE_HERE +uci rename firewall.@zone[1]="wan" 
-EOF +uci del_list firewall.wan.device="tun+" 
- +uci add_list firewall.wan.device="tun+" 
-# Fix permissions +uci commit firewall 
-chmod "u=rw,g=,o=" /etc/openvpn/vpnclient.conf +/etc/init.d/firewall restart
- +
-# Install packages +
-opkg update +
-opkg install openvpn-openssl +
- +
-# Configure VPN-client +
-sed -i -e +
-/^user/s/^/#/ +
-\$a user nobody +
-/^group/s/^/#/ +
-\$a group nogroup +
-/^dev/s/^/#/ +
-\$a dev $(uci get firewall.@zone[1].device) +
-" /etc/openvpn/vpnclient.conf +
-service openvpn restart+
 </code> </code>
  
-If using a commercial VPN-provider, set up credentials for username/password authentication and enforce gateway redirect.+==== 3. VPN service ==== 
 +Save your client profile to configure VPN service.
  
 <code bash> <code bash>
-# Save username/password credentials +# Save VPN client profile 
-cat << "EOF> /etc/openvpn/vpnclient.auth +umask go= 
-YOUR_VPN_USERNAME +cat << EOF > /etc/openvpn/client.conf 
-YOUR_VPN_PASSWORD+COPY_PASTE_CLIENT_PROFILE_HERE
 EOF EOF
- +/etc/init.d/openvpn restart
-# Fix permissions +
-chmod "u=rw,g=,o=" /etc/openvpn/vpnclient.auth +
- +
-# Configure VPN-client +
-sed -i -e " +
-/^auth-user-pass/s/^/#/ +
-\$a auth-user-pass /etc/openvpn/vpnclient.auth +
-/^redirect-gateway/s/^/#/ +
-\$a redirect-gateway def1 ipv6 +
-" /etc/openvpn/vpnclient.conf +
-service openvpn restart+
 </code> </code>
  
-See also: [[extra#instance_management|Instance management]], [[docs:guide-user:services:dns:encrypt|DNS-encryption]]+Configure credentials for [[docs:guide-user:services:vpn:openvpn:extras#commercial_provider|commercial provider]] if required.
  
 ===== Testing ===== ===== Testing =====
-Follow[[extra#testing|Testing]]+{{section>docs:guide-user:services:vpn:wireguard:server#testing&noheader&nofooter&noeditbutton}}
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
-Follow: [[extra#troubleshooting|Troubleshooting]] +{{section>docs:guide-user:services:vpn:openvpn:server#troubleshooting&noheader&nofooter&noeditbutton}}
- +
-{{tag>How-To VPN OpenVPN}}+
  
  • Last modified: 2023/10/14 05:16
  • by vgaetera