Php 仅为一个接口配置openvpn客户端

Php 仅为一个接口配置openvpn客户端,php,linux,curl,interface,openvpn,Php,Linux,Curl,Interface,Openvpn,该死的家伙, 我正在尝试设置OpenVPN客户端以连接到TunnelbearVPN,并使用它在php中使用curl执行一些匿名请求 我在远程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

该死的家伙, 我正在尝试设置OpenVPN客户端以连接到TunnelbearVPN,并使用它在php中使用curl执行一些匿名请求

我在远程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_接口,tun0

但是,由于curl请求的公共ip不是匿名的,因此流量似乎不使用vpn


我对所有这些路线设置感到非常迷茫。请帮助我:

使用此up脚本解决:

#!/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
此客户端配置文件:

   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,如果不是经典的网络接口

我有完全相同的需求,除了我在windows上,您认为我需要进行哪些调整才能在windows上工作?特别是第一句话。