1

I am running an Apache 2.4 server in Ubuntu 14.04. MY DSL modem is connected to TP Link router. Thus, my system is connected to interent through wifi.

ifconfig provides the local ip aaa.aaa.a.aaa. The default gateway to login into the router's settings is 192.168.0.1 .

My aim is to send and receive files from an android device to the Apache server from a network outside the router's. Thus, following some tutorials, I set the port forwarding at port 80 with the ip as aaa.aaa.a.aaa.

The WAN ip displayed at the router settings page is bbb.bbb.b.b, while the public ip obtained by googling what is my ip is ccc.ccc.ccc.ccc .

I edited my /etc/hosts file to include the ip bbb.bbb.b.b with the site name along side. After this setting, I was able to access the server within my LAN sonnection, (i.e.) connecting my android device to the same router.

Now, I changed the ip in /etc/hosts file to ccc.ccc.ccc.ccc and when I try the same from a network outside the router's connection, it doesn't work. Can you please point me towards the right direction to make it work from network outside the LAN.?

My doubts lie along these lines:

  1. Is this a problem, because the modem and router are 2 different devices?
  2. Earlier, I had a Supernet Infocomm Modem, that served as the router as well, and when I tried the same with that, it worked for even networks outside the connection. Currently I have changed my work station and I want to set it up here as well, but am facing the issue as stated.
1

You don’t need to touch /etc/hosts on the server. The contained records serve to connect other servers by name, similarly to DNS.

As you are indicating, the problem is likely caused by separate modem and router. You need to set port forwarding on all network devices1) sharing the same public IP address2) in the path to your server.

1) I mean all devices operating on network layer which is the layer of IP (including IP addresses). Hubs, switches etc. are not affected.

2) Public IP address is the address you get when accessing sites like http://whatismyipaddress.com/ from your LAN. Private IP addresses are used inside a LAN and usually begin with 10., 172. or 192.168. A LAN usually shares one public IPv4 address. This technique is called NAT.

  • Can you please explain what you mean by same public ip address? In my case, I get ccc.ccc.ccc.ccc when I search for my ip. Does that mean both my router and modem share the same public ip.? – Lakshmi Narayanan Oct 18 '16 at 8:07
  • 1
    @LakshmiNarayanan When you search for your “outside” (or public) IP address on any device in your LAN, you’ll get the same one. This is what I mean by sharing the public IP address. It happens through NAT. – Melebius Oct 18 '16 at 8:15
  • essentially, I have to setup port forwarding in both my modem and router right? – Lakshmi Narayanan Oct 18 '16 at 8:45
  • @LakshmiNarayanan Yes, I might be speaking too generic. :-) – Melebius Oct 18 '16 at 13:32
  • Information always helps. Thank you for your time.! – Lakshmi Narayanan Oct 18 '16 at 16:27

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.