Show pagesourceOld revisionsBacklinksBack to top × Table of Contents OpenVPN 客户端 Infoboxes Basic skills config-network-device 简介 目标 实现过程(命令、配置) 1. 准备工作 2. 防火墙设置 3. VPN 服务设置 测试 故障排除 OpenVPN 客户端 This page is not fully translated, yet. Please help completing the translation. (remove this paragraph once the translation is finished) Infoboxes {{section>meta:infobox:howto_links#basic_skills&noheader&nofooter&noeditbutton}} {{section>meta:infobox:howto_links#config-network-device&noheader&nofooter&noeditbutton}} Basic skills This article relies on the following: Accessing web / command-line interface Managing configurations / packages / services config-network-device This article may contain network configuration that is version dependent post 2021-06 ifname@interface has been moved to device and device sections while legacy ifname syntax may work on 21.02 or recent master it is recommended that you migrate to device usage More Information 21.02 Release Notes Mini tutorial for DSA network config 简介 介绍了如何在OpenWrt上设置 OpenVPN 客户端. 参照 OpenVPN server 设置服务器,参照 OpenVPN extras 设置更多. 目标 加密您的互联网连接以加强安全和隐私。 防止客户端的数据泄露和流量欺骗。 使用商业vpn服务绕过区域限制。 规避客户端内容过滤和互联网审查。 更方便地远程访问您的局域网服务(无需端口转发)。 实现过程(命令、配置) 1. 准备工作 安装所需软件包。 # 安装软件包 opkg update opkg install openvpn-openssl 2. 防火墙设置 将 VPN 网络视为公网。 将VPN接口分配给防火墙 WAN 区域的涵盖设备,以最小化防火墙设置。 # 配置防火墙 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 3. VPN 服务设置 保存客户端配置文件以用于VPN服务 # 保存VPN客户端配置文件 umask go= cat << EOF > /etc/openvpn/client.conf COPY_PASTE_CLIENT_PROFILE_HERE EOF /etc/init.d/openvpn restart 如有必要,指定服务商提供的凭据 commercial provider 并配置动态链接 dynamic connection . 测试 建立 VPN 连接。 使用 traceroute 和 traceroute6 命令确认流量是否通过VPN网关. traceroute openwrt.org traceroute6 openwrt.org 检查客户端IP地址. https://ipleak.net/ 请确保客户端没有DNS泄露(DNS leak)发生。 https://dnsleaktest.com/ 如果使用IPv6,需将公共IPv6前缀委派给VPN网络作为默认配置。 故障排除 通过以下步骤,获取、分析日志. # 重启日志、openvpn服务 /etc/init.d/log restart; /etc/init.d/openvpn restart; sleep 10 # 获取日志和openvpn状态 logread -e openvpn; netstat -l -n -p | grep -e openvpn # 各项运行中的配置参数(openvpn运行配置、网络信息、防火墙配置) pgrep -f -a openvpn ip address show; ip route show table all ip rule show; ip -6 rule show; nft list ruleset # 配置文件情况 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.OKMore information about cookies Last modified: 2022/05/29 03:24by yodo