In a typical LAN setup, where the entire LAN is connected to the Internet through a router, each computer on the local network will use an “external”, WAN IP (assigned to the router), but each of them will have an “internal”, LAN IP (usually 192.168 ..) .
In this case, all external requests of any computer on this LAN will be displayed from the same WAN IP. Only the router will know which computer on the local network this request belongs to, so for your PHP it will not be possible to detect the LAN IP address, but only the WAN IP address (via the element $ _SERVER ['REMOTE_ADDR']) / p>
If the request is internal (for example, say, an HTTP server on the same local network), the $ _SERVER ['REMOTE_ADDR'] element will save the IP address of the local network of the computer that made the request.
In short, the server knows the IP address of the device that sent the request, regardless of whether this IP address belongs to a local network, wide area network, or some other network.
vaske source
share