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/09/18 13:05] – [Introduction] correct the terminology 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.+
  
 ===== 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. Firewall ==== +==== 1. Preparation ==== 
-Consider VPN network as public and assign VPN interface to WAN zone to minimize firewall setup.+Install the required packages. 
 + 
 +<code bash> 
 +# Install packages 
 +opkg update 
 +opkg install openvpn-openssl 
 +</code> 
 + 
 +==== 2. Firewall ==== 
 +Consider VPN network as public
 +Assign VPN interface to WAN zone to minimize firewall setup.
  
 <code bash> <code bash>
Line 18: 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="tun0+uci add_list firewall.wan.device="tun+"
-uci add_list firewall.wan.device="tun0"+
 uci commit firewall uci commit firewall
 /etc/init.d/firewall restart /etc/init.d/firewall restart
 </code> </code>
  
-==== 2Basic client ==== +==== 3VPN service ==== 
-Save your client profile+Save your client profile to configure VPN service.
-Install and configure VPN client. +
-Drop VPN service privileges and ensure VPN interface name matches firewall configuration.+
  
 <code bash> <code bash>
 # Save VPN client profile # Save VPN client profile
-cat << "EOF> /etc/openvpn/client.conf+umask go= 
 +cat << EOF > /etc/openvpn/client.conf
 COPY_PASTE_CLIENT_PROFILE_HERE COPY_PASTE_CLIENT_PROFILE_HERE
 EOF EOF
- 
-# Fix permissions 
-chmod "u=rw,g=,o=" /etc/openvpn/client.conf 
- 
-# 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.wan.device | sed -e "s/^.*\s//") 
-" /etc/openvpn/client.conf 
-/etc/init.d/openvpn restart 
-</code> 
- 
-==== 3. Commercial provider ==== 
-If using a commercial VPN provider, set up credentials for username/password authentication and enforce gateway redirect. 
- 
-<code bash> 
-# Save username/password credentials 
-cat << "EOF" > /etc/openvpn/client.auth 
-OVPN_USERNAME 
-OVPN_PASSWORD 
-EOF 
- 
-# Fix permissions 
-chmod "u=rw,g=,o=" /etc/openvpn/client.auth 
- 
-# Configure VPN client 
-sed -i -e " 
-/^auth-user-pass/s/^/#/ 
-\$a auth-user-pass /etc/openvpn/client.auth 
-/^redirect-gateway/s/^/#/ 
-\$a redirect-gateway def1 ipv6 
-" /etc/openvpn/client.conf 
 /etc/init.d/openvpn restart /etc/init.d/openvpn restart
 </code> </code>
  
-See also: +Configure credentials for [[docs:guide-user:services:vpn:openvpn:extras#commercial_provider|commercial provider]] if required.
-[[docs:guide-user:services:vpn:openvpn:extra#instance_management|Instance management]], +
-[[docs:guide-user:services:vpn:openvpn:extra#kill_switch|Kill switch]], +
-[[docs:guide-user:services:dns:start#encryption|DNS encryption]], +
-[[docs:guide-user:services:vpn:openvpn:extra#nat6|NAT6]]+
  
 ===== 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