I have local machine on which Apache web server is running. I have set up port forwarding on my router to forward ports 80 and 443 to that machine. When I access the domain associated with my router, everything is ok. But when I am on my WiFi (which is the same network and router that server is connected to), I cannot access the server and I need to use local IP (192.168.0.***). This would not be much problem, but I have some services, that rely on availability of that domain and also HTTPS certificate does not work with local IP.

So the question is - how can I make server available through external IP / domain from local network?



What you would need is the so-called loopback rule. This rule translates all the requests that you send at your public ip to a specific LAN IP when you try to connect to the public one through your private network.

It is strange that you are not able to connect to your host from private ip, though.

I would suggest to investigate if there is any AP isolation active on your router/ wifi AP by trying to reach the server by means of wired network and check if it responds to pjng requests also from Wifi.

Finally check iptables or in general fiewall rules on that machine.

  • No AP isolation is active on my router. When I connect my laptop to cable, it does not change anything (so there is not misconfigured WiFi). I also checked output of iptables -L, but there is no rule in any chain. I might need a bit help with that loopback rule, i could not find any way how to set it up (running laptop on Ubuntu 14.04, server is Ubuntu 15.10 Server). I also need to be able to access server normally by domain when I leave home, so if possible, define that rule only when I am connected to my router – Tomáš Blatný Feb 10 '16 at 8:46
  • @TomášBlatný, generally the loopback rule is applied to the firewall/router which manages the LAN. In that case every time you try to connect to the server through the public domain you will be redirected. I am a Sonicwall user and those kind of rules are named in that way. I am not really sure about the standard nomenclature. Maybe different vendors call it in different way. What is the default policy of iptables? If it would be 'deny' then even if no rules are defined, every incoming packet will be rejected. – FancyPants Feb 10 '16 at 13:46
  • Default policy of iptables is ACCEPT in all 3 cases (INPUT, FORWARD, OUTPUT) – Tomáš Blatný Feb 11 '16 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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