Windows openvpn 客户端已连接但 ip 没有改变

Windows openvpn 客户端已连接但 ip 没有改变

我有一台 ubuntu 机器,上面运行着 openvpn 服务器。当我尝试从不同网络上的 Windows 机器连接到 ubuntu 机器时,它显示已连接。我甚至可以 ping ubuntu 机器的本地 IP。但我没有获得公共 IP 地址。也就是说,计算机(Windows)的公共 IP 地址保持不变,没有变化(在 cmyip 上检查)。为什么会发生这种情况?我该如何解决这个问题?

客户端配置:

    client

    proto udp

    dev tun

    ca ca.crt

    dh dh2048.pem

    cert client3.crt

    key client3.key

    remote publicip 1194

    cipher DES-CBC

    verb 2

    mute 20

    keepalive 10 120

    comp-lzo

    persist-key

    persist-tun

    float

    resolv-retry infinite

    nobind

服务器配置:

port 1194
proto udp
dev tun0
ca keys/test/ca.crt
cert keys/test/check.crt
key keys/test/check.key
dh keys/test/dh2048.pem
server 10.180.240.0 255.255.240.0
crl-verify keys/test/crl.pem
cipher DES-CBC
user nobody
group nogroup
status servers/VPn1/logs/openvpn-status.log
log-append servers/VPn1/logs/openvpn.log
verb 2
mute 20
max-clients 100
local 192.168.1.101
keepalive 10 120
client-config-dir /etc/openvpn/servers/VPn1/ccd
client-to-client
duplicate-cn
comp-lzo
persist-key
persist-tun
ccd-exclusive
route 10.22.1.0 255.255.255.0
route 10.22.2.0 255.255.255.0
route 10.22.3.0 255.255.255.0
push "route 10.180.0.0 255.255.252.0"
push "route 10.22.1.0 255.255.255.0"
push "route 10.22.2.0 255.255.255.0"
push "route 10.22.3.0 255.255.255.0"
push "dhcp-option DNS 10.180.3.12"

ipconfig /全部

Tunnel adapter 6TO4 Adapter:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft 6to4 Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.{}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #3
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #4
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #5
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

答案1

如果您想使用 OpenVPN 服务器作为网关,您需要将默认路由推送给您的客户端。

服务器配置:

push "redirect-gateway def1"

http://openvpn.net/index.php/open-source/documentation/howto.html#redirect

答案2

> Press ENTER for default [443]:

Should client traffic be routed by default through the VPN?
> Press ENTER for default [no]:

Should client DNS traffic be routed by default through the VPN?
> Press ENTER for default [no]:

Use local authentication via internal DB?
> Press ENTER for default [yes]:

Private subnets detected: ['172.31.0.0/16']

Should private subnets be accessible to clients by default?

> Press ENTER for EC2 default [yes]:

在签名时,您会看到有人问这些问题。

以下问题的默认值为“否”,您必须将其更改为“是”才能将客户端 IP 更改为 VPN 服务器 IP。

Should client DNS traffic be routed by default through the VPN?
> Press ENTER for default [no]: yes

答案3

您的预期是错误的。没有任何信息告诉机器使用 VPN 作为其通往互联网的网关,因此从互联网上看,其公共 IP 地址没有理由发生变化。

答案4

是的,我可以解释它是如何回答原始帖子的,1. 我的 DD-Wrt 家庭路由器上有一个正在运行的 OpenVPN,其中所有流量都通过 vpn 路由。2. 正如您将在我的配置中注意到的那样,我将 dev 保留为 dev tun0 andriod,而 linux 不喜欢 tap。原始发帖人认为当他仍然连接到家庭 vpn 时,他的 ip 会被魔法改变。使用我的正确设置,重新启动路由器,然后连接客户端计算机。进行 IP 检查,然后转到外部热点,并再次通过热点将客户端计算机连接到 vpn bingo 您的 ip 现已更改为您的家庭公共 IP。神奇。

如果您在客厅连接到 VPN,您的 IP 当然会显示您的公共家庭 IP,离开后再次通过公共 wifi 连接到 VPN 时,它仍会显示您的家庭公共 IP,VPN 不会隐藏您的真实 IP。您需要使用代理来完成该任务。VPN 分配 IP 的方式与任何常规路由器相同,但使用 VPN 时您的数据是加密的。

或者使用外部 vpn。

互联网上有太多错误信息,很难找到准确的信息和答案。

相关内容