简体   繁体   English

如何在PHP中找到VPN客户端的IP地址

[英]How do I find the IP address of a VPN client in PHP

I've been looking around for a while on this issue and after wrestling with my mobile ISP, have finally got a VPN client to test with... 我一直在这个问题上待了一会儿,在与我的移动ISP搏斗之后,终于有了一个VPN客户端来进行测试...

... however ... ...但是...

All the other solutions using the $_SERVER in this code (great article) seem to only return the IP address of the VPN server address (192.168.1.sss). 此代码中使用$_SERVER所有其他解决方案(出色的文章)似乎只返回VPN服务器地址的IP地址(192.168.1.sss)。

My solution requires me to send a message to a remote machine (on the end of a VPN) and not the main VPN server. 我的解决方案要求我将消息发送到远程计算机(在VPN的末尾),而不是主VPN服务器。

For example: 例如:

  1. External client browser fills in a form which posts to a PHP page ( VPN:192.168.1.ccc ) 外部客户端浏览器填写一个发布到PHP页面的表单( VPN:192.168.1.ccc
  2. The PHP page on server www.example.com (192.168.1.sss) then compiles a suite of instructions to send to the remote machine 192.168.1.rrr on same logical network (through VPN) as server. 然后,服务器www.example.com (192.168.1.sss)上的PHP页面会编译一套指令,以发送到与服务器相同的逻辑网络(通过VPN)上的远程计算机192.168.1.rrr

... trouble is, $_SERVER[] seems to return 192.168.1.sss rather than 192.168.1.ccc ...问题是,$ _ SERVER []似乎返回192.168.1.sss而不是192.168.1.ccc

even if I send a message (using CURL) to 192.168.1.ccc it shows as not found. 即使我将消息(使用CURL)发送到192.168.1.ccc,也显示为未找到。

any ideas on how to get the VPN client address known to the network in a way that means I can send the message?? 关于如何以一种可以发送消息的方式获取网络已知的VPN客户端地址的任何想法?

Thanks in advance. 提前致谢。

I don't think it's possible to retrieve the original client ip in this case. 我认为在这种情况下不可能检索原始客户端IP。 The client isn't given a separate local address, it's tunneling through the vpn gateway. 没有为客户端提供单独的本地地址,而是通过vpn网关进行隧道传输。 You may be able to forward traffic back to the client through the gateway, depending on your setup. 您可能可以通过网关将流量转发回客户端,具体取决于您的设置。 This question has an iptables example. 这个问题有一个iptables示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM