1

I have just received static IP address from my ISP and I am trying to setup small experimental server on my home laptop which has Ubuntu installed.

I have setup Ubuntu to use internal static IP address 192.168.1.11.

Ubuntu static ip config

I have forwarded the port number from my router to redirect all requests on port 80 to 192.168.1.11.

Below is my router (D-Link DSL-2750U) configuration:

Router configuration

I have started the small java webserver on port K on my Ubuntu box. But I am not able to access webserver from external network using my static IP which is provided by my ISP as 117.218.XXX.XXX and not 192.168.1.11. Am I missing anything?


UPDATE: As per suggestion from JakeGould I have updated the remote ip address of router to public IP address of 117.218.XXX.XXX.

After making above configuration I could actually visit my server from browser. But browser was opening router configuration page instead of redirecting the request to Ubuntu box. So now I changed the default port of User Access Control for D link router.

Now the request is getting timed out. Below is the output of curl

curl http://117.218.XXX.XXX
curl: (7) couldn't connect to host

So I tried disabling the firewall on Ubuntu box using "sudo ufw disable" But issue persist.

I am not sure configuration changes required on Dlink , Below is the config page of Dlink firewall

enter image description here

Can someone please help me with it.

1

According to the screenshots you are showing, you have port forwarding oddly set on your WAN connection as follows:

  • External Port Start/End: 80/80
  • Protocol: TCP
  • Internal Port Start/End: 80/80
  • Server IP Address: 192.168.1.11
  • Schedule Rule: Always
  • Remote IP: 192.168.1.11

The way you have that setup basically tells the router to just route all traffic from 192.168.1.11 on port 80 to 192.168.1.11 on port 80 which makes no sense. The “Remote IP:” should be set to your external IP address of 117.218.XXX.XXX like this:

  • Remote IP: 117.218.XXX.XXX

With that in place that tells the router to route all traffic from 117.218.XXX.XXX on port 80 to 192.168.1.11 on port 80.

That said, if the router itself uses port 80 for the D-Link management page, then you need to see if you can change the port that management page uses. Otherwise all you are doing with that ruleset is exposing your D-Link management page to anyone/anything that can reach that 117.218.XXX.XXX. As to how to do that? Each router has different ways to handle that and some routers just don’t provide end users with that option since ISP’s generally don’t want end-users to easily run web servers off of their ISP-provided Internet connection.

If you cannot change the D-Link management page port to be something other than port 80 the next best thing is to just change your web server’s port to be something else, like 8000 or 8080. Of course you now need to adjust your port forwarding rules to match the new port, but it might be the best/simplest solution to this issue.

2
  • I was able to change that port , but now the request is getting timed out, I am able to ping the server but could not connect to port 80. Looks like some more configuration required on router to make it forward the request to ubuntu box. – Xinus Mar 8 '15 at 6:07
  • @Xinus Sorry to hear that, but I cannot help you any further. If you found this answer to be helpful, be sure to upvote it. And if it is the answer that solved your original problem, be sure to check it off as such. Good luck! – Giacomo1968 Mar 8 '15 at 6:08
1

192.168.1.11 is your local area network (LAN) private static IP address, not your public (external) IP address.

You can find your public IP address by performing this Google search.

Update, per comment:

There are multiple possible explanations for being unable to connect through the external IP address:

  1. The firewall on the Ubuntu server
  2. The firewall on the D-Link router
  3. The ISP has blocked outbound port 80
  4. The port forwarding configuration has not been set up correctly in the D-Link router

Possible Solutions

1. The firewall on the Ubuntu server

Turn off the built-in Ubuntu firewall, ufw:

sudo ufw disable

If ufw does not seem to be causing the issue, a netfilter rule might be preventing your outbound connections from succeeding. The outbound rules can be found with this command:

iptables -nvL OUTPUT

2. The firewall on the D-Link router

You'll need to consult your router documentation to see how this may work.

3. The ISP has blocked outbound port 80

Contact your Internet service provider to see if this is happening.

4. The port forwarding configuration has not been set up correctly in the D-Link router

A guide matching your router could help you configure port forwarding: http://portforward.com/english/routers/port_forwarding/Dlink/DSL-2750U/Apache.htm

4
  • I am using public static ip to access the webserver and not internal static ip address. This is just the local configuration so that router will be able to forward the any request on port 80 to my ubuntu box. – Xinus Mar 8 '15 at 3:40
  • I still don’t get how 117.218.XXX.XXX is not set as the “Remote IP” in the D-Link router config you are showing. That is what I would do and that should work. – Giacomo1968 Mar 8 '15 at 3:44
  • I have updated the remote ip address to public ip, Now I could actually visit my static ip address from browser but its showing me the router configuration page. How do I configure router config page to use different port than port 80? – Xinus Mar 8 '15 at 4:21
  • @Xinus Since my comment/suggestion worked, I have formally posted a fleshed out answer that explains how the port forwarding should work. That said, at the end of my answer I explain that changing the D-Link management page is a whole other thing—and perhaps best a whole other question—because each router handles port changes differently and some routers do not allow changing the management page from anything but port 80 because many ISPs wish to discourage basic users from easily setting up a web server on their account. – Giacomo1968 Mar 8 '15 at 5:51

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.