At home I have a router DIR-615 connected via cable to the Internet with a static ip. Wi-fi access to the Internet through this router connected to a desktop computer with ubuntu 16.04. The computer deployed a web server with a site (test.ru). When I turn to the website from an external Internet all the site opens. When I turn to the website from the same LAN (using same wifi connection) the site is not loaded.
I found the solution is nat loopback. In my router there is no such function, so I suggest either to flash the router with alternative firmware, or to configure a loopback using iptables. I accessed via telnet to the router and entered the command:
iptables-t nat -A PREROUTING policy -d <my external ip> -m tcp -p tcp --dport 80 -j DNAT --to-destination 192.168.0.26:80
iptables-t nat -A POSTROUTING -d 192.168.0.26 -p tcp --dport 80 -j SNAT --to-source <my external ip>
But it didn't help.
Here's the output of
iptables-t nat-L-n -v
Tell me what did I do wrong? How to solve the problem?