In my home, I have two routers. The first ( is working as ADSL modem and works as ISP for the second router ( My LAN (Wifi) is built on the second router.

I am using port forward twice:

  1. from the first router port 80 to the second router port 80
  2. from the second router port 80 to my computer port 80 (

Everything works fine and using freemyip.com service I able to create a virtual host on my computer to be accessible from the Internet.

My problem is: The server could not able to catch the client's remote IP. i.e all remote access is recorded as my public IP of the first router (The ADSL modem) while accessing the server through my LAN, the IP is recorded correctly for the device accessed it.

I believe that it is issue related with port forward but I could not able to solve it.

closed as off-topic by yoonix, Tero Kilkanen, ThoriumBR, womble Oct 5 '17 at 0:16

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on Super User, and questions about development, testing and development tools may be asked on Stack Overflow." – yoonix, Tero Kilkanen, ThoriumBR, womble
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Why do you even have such a complicated setup? You should use a single network behind the first router, not any double-router -setup unless you have a very valid reason. – Tero Kilkanen Oct 4 '17 at 19:32
  • 1
    Home use off topic for serverfault. – Iain Oct 4 '17 at 20:12
  • @TeroKilkanen I have two reasons: 1- the second router has WiFi but could not work as ADSL modem, while the first could works as ADSL modem. 2- the Second router has wrt firmware which allows required functionalities does not supported by the first router such as DNSMasq. – SaidbakR Oct 4 '17 at 21:21
  • @user430214 regarding that I have use it in my home does not mean it may not available issue in work! – SaidbakR Oct 4 '17 at 21:23
  • There aren't these kinds of issues in professional business environments, since businesses use proper equipment for networking. – Tero Kilkanen Oct 5 '17 at 5:46

Whether the server sees the external IP address or the internal one of the router depends on the router's NAT service - possibly it's configurable.

Additionally NATing the source address is more like a reverse proxy but some routers also do this.

  • How could I know that my router reverse proxy? – SaidbakR Oct 4 '17 at 21:24
  • In my first router, I used "Full Cone NAT" to solve the issue. – SaidbakR Oct 5 '17 at 5:06

I see that at work, the network layer has to ensure that the HTML header x-forwarded-for is sent to our web server, otherwise it sees all traffic coming from the firewall.

But that usually happens when you proxy, so in your case, could it be that the routers implement NAT via a proxy? Check if you have an option to preserve client IP in your admin interface.

Not the answer you're looking for? Browse other questions tagged or ask your own question.