OpenVPN client

  • Encrypt your internet connection to enforce security and privacy.
    • Prevent data leak and traffic spoofing on the client side.
  • Bypass regional restrictions using commercial providers.
    • Escape client side content filters and internet censorship.
  • Access your LAN services remotely without port forwarding.

Install the packages and specify the VPN client configuration parameters.

# Install packages
opkg update
opkg install openvpn-openssl
 
# Configuration parameters
OVPN_DIR="/etc/openvpn"
OVPN_ID="client"

Consider VPN network as public and assign VPN interface to WAN zone to minimize firewall setup.

# Configure firewall
uci rename firewall.@zone[0]="lan"
uci rename firewall.@zone[1]="wan"
uci del_list firewall.wan.device="tun+"
uci add_list firewall.wan.device="tun+"
uci commit firewall
/etc/init.d/firewall restart

Save your client profile and configure VPN service dropping its privileges.

# Save VPN client profile
umask go=
cat << EOF > ${OVPN_DIR}/${OVPN_ID}.conf
COPY_PASTE_CLIENT_PROFILE_HERE
EOF
 
# Configure VPN service
sed -i -e "
/^user/s/^/#/
\$a user nobody
/^group/s/^/#/
\$a group nogroup
" ${OVPN_DIR}/${OVPN_ID}.conf
/etc/init.d/openvpn restart

Configure credentials for commercial provider if required.

Establish the VPN connection. Use traceroute and traceroute6 to verify your client traffic is routed via the VPN gateway.

traceroute openwrt.org
traceroute6 openwrt.org

Check your client public IP addresses.

Make sure there is no DNS leak on the client side.

Delegate a public IPv6 prefix to the VPN network to use IPv6 by default.

Collect and analyze the following information.

# Restart services
/etc/init.d/log restart; /etc/init.d/openvpn restart; sleep 10
 
# Log and status
logread -e openvpn; netstat -l -n -p | grep -e openvpn
 
# Runtime configuration
pgrep -f -a openvpn
ip address show; ip route show table all
ip rule show; ip -6 rule show; iptables-save; ip6tables-save
 
# Persistent configuration
uci show network; uci show firewall; uci show openvpn
head -v -n -0 /etc/openvpn/*.conf
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2021/04/07 21:20
  • by vgaetera