0

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...

... 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).

My solution requires me to send a message to a remote machine (on the end of a VPN) and not the main VPN server.

For example:

  1. External client browser fills in a form which posts to a PHP page (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.

... trouble is, $_SERVER[] seems to return 192.168.1.sss rather than 192.168.1.ccc

even if I send a message (using CURL) to 192.168.1.ccc it shows as not found.

any ideas on how to get the VPN client address known to the network in a way that means I can send the message??

Thanks in advance.

Community
  • 1
  • 1
btg_1967
  • 79
  • 1
  • 13
  • 1
    AFAIK your VPN server would need to act as a pure bridge or fully configured router in order for the whole network to see one another. Sounds like it currently acts as a NAT router or similar limited router. There's not really much PHP can do in this case. – deceze Aug 01 '14 at 13:43
  • Thanks @deceze - I was afraid of that. Main reason why I want to hit the device is to respond to a message and wake the device up - a bit like `Wake on LAN` but to do a bit more than that... – btg_1967 Aug 02 '14 at 14:14

1 Answers1

1

I don't think it's possible to retrieve the original client ip in this case. The client isn't given a separate local address, it's tunneling through the vpn gateway. You may be able to forward traffic back to the client through the gateway, depending on your setup. This question has an iptables example.

Community
  • 1
  • 1
Jeremiah Winsley
  • 2,537
  • 18
  • 30
  • Hi @Jeremiah - thanks for great referral to an article. It is almost the exact situation I'm trying for... except the VPN client is a call phone and the 'downstream' device is connected to the WiFi hotspot. The main reason for all of this VPN thing is that there is no way to hit a cell phone with a message originating from off-network. the mobile providers all block these as not originating 'on network', and being a paired response. This all works fine on LAN, just not WAN :-( – btg_1967 Aug 02 '14 at 14:18