伙计们,我正在尝试设置开放的 vpn 客户端以连接到 tunnelbear vpn,并使用它在带有 curl 的 php 中执行一些匿名请求。
我在远程 VPS 上这样做,所以如果我做错了 vpn 会阻止我,我将被迫重新启动 vps。实际上我的客户端配置是这样的:
client
dev tun0
proto udp
nobind
ns-cert-type server
persist-key
persist-tun
reneg-sec 0
dhcp-option DNS 8.8.8.8
dhcp-option DNS 8.8.4.4
verb 3
auth-user-pass login.key
ca CACertificate.crt
cert UserCertificate.crt
key PrivateKey.key
remote fr.lazerpenguin.com 443
cipher AES-256-CBC
auth SHA256
keysize 256
keepalive 10 30
script-security 2
我没有任何重定向网关设置,因为如果我添加它,我的整个流量都会通过 vpn 并且一切都被阻止。我只是想使用 vpn 来满足一些特殊要求。
喜欢:整个流量 -> 除了 tun0 请求之外没有 vpn
我在 php 中使用它来使用 vpn 接口: curl_setopt($ch, CURLOPT_INTERFACE, "tun0");
但是流量似乎不使用 vpn,因为 curl 请求的公共 ip 不是匿名的。
我对所有这些路线设置非常迷茫,请帮助我:(
通过使用这个“向上”脚本解决:
#!/bin/sh
echo "$dev : $ifconfig_local -> $ifconfig_remote gw: $route_vpn_gateway"
ip route add default via $route_vpn_gateway dev $dev table 20
ip rule add from $ifconfig_local table 20
ip rule add to $route_vpn_gateway table 20
ip route flush cache
exit 0
和这个客户 conf :
client
dev tun0
proto udp
remote fr.lazerpenguin.com 443
resolv-retry infinite
nobind
persist-key
persist-tun
ca CACertificate.crt
cert UserCertificate.crt
key PrivateKey.key
verb 5
route-method exe
route-delay 2
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
cipher AES-256-CBC
auth SHA256
keysize 256
comp-lzo
auth-user-pass login.key
script-security 2
route-noexec
route-up vpn_up.sh
现在,如果我在 curl 中将接口设置为 tun0,它将使用 openvpn,如果不是经典网络接口
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句