6

So I finally got a web server going, except it's only available to my local network, and I'd like to make it public. I have a D-Link DIR-615 as a router, my Pi's IP address is 192.168.0.14 and my public IP info looks like this:

IP Information: xx.xx.xx.xx
ISP:    Xplornet Communications
Organization:   Xplornet Communications
Connection: Broadband
Services:   None Detected
City:   Sherwood Park
Region: Alberta
Country:    Canada

All sounds good except I don't live in Sherwood Park, I'm about 2 hours away.

What do I need to do to make my server public?

My router supports port forwarding, virtual server and DMZ. I'm using an Apache HTTP server.

Thanks, but this still doesn't solve my problem; I just want to connect from outside maybe once then I'll figure out DDNS and such but for now it won't connect to anything when I type my Xplornet IP address in.

5 Answers 5

13

Forward port 80 from your router to your Pi, and if you want to SSH from outside, port 22 as well. Be aware that with SSH from outside anyone that can get in can then ssh or access the other devices on your network.

Once you are setup, if your IP pretty much stays the same you can use something like Cloudflare to point a domain at it. If it changes on a daily basis you'll need a service like DynDNS.

6
  • K so I set my router to forward port 80 to port 80 with my raspberry pi's ip address or whatever but it still just "times out" everytime I type in my external ip address
    – Jim Jones
    Commented Apr 30, 2013 at 15:45
  • Try accessing it and specifying port 80, like xx.xx.xx.xx:80 Commented Apr 30, 2013 at 16:06
  • @Spencer: You can't reliably test port forwarding from inside your network as not all routers support "hairpinning". Try testing it from outside your LAN. E.g. use a mobile phone with WiFi off and using cellular data (3G, HCSD, etc) for a non-LAN connection. Commented May 21, 2013 at 19:30
  • @SpencerKillen Are you testing from the outside ? Many devices will not NAT this for you if you are sitting on the same LAN as your raspberry pi and accessing the public IP of your router. If you can access the web server at 192.168.0.14 from your LAN, the RPI or Apache is not at fault, but the port forwarding is not done correctly, or your router has a firewall in place somewhere too.
    – nos
    Commented May 24, 2013 at 13:44
  • If port forwarding is too cumbersome, or not an option at all (e.g. if you're behind a mobile router) you might try a relay service like PageKite or Yaler.net (Disclosure: I'm a founder of Yaler)
    – tamberg
    Commented Nov 22, 2013 at 12:41
3

There are a few things to keep in mind.

One is that even if you have port forwarding correctly configured in your router, you may not be able to connect to your public IP from home because some routers only forward connections coming from "outside", not "inside". Another common problem is some ISPs do not want their users to run public servers and block common incoming ports such as port 80 or 25.

I don't know whether either of these apply in your case, but they might. Aside from that, I would say you are on the right track, configuring your router and a dynamic DNS solution is the most efficient way to do this if it works for you.

However, if it doesn't work for some reason, I created a solution called PageKite (http://pagekite.net/) to help make servers public from behind strict firewalls or on devices which change locations frequently. It works by creating a tunnel from your Raspberry Pi to a "front-end" relay server which forwards your incoming requests and replies over the tunnel. So any time your Pi has a working Internet connection and can connect to the relay, your server will be visible (no router tweaks or ddns necessary). It's free software, but if people use our on-line service to connect (instead of running their own relay somewhere), we ask people to pay a bit for the privilege. This is similar to localtunnel which was mentioned elsewhere, except PageKite was designed with reliability and permanent connections in mind, not just for temporary testing.

Good luck!

1
0

You will need a service like DynDNS, or get yourself a static IP. Otherwise, you might consider a VPN.

0

My solution for several systems under dynamic ip is the following:

I have a domain from godaddy Entrydns 1 cron job on my router that is uploading my ip address to entrydns with a token (a token that entrydns provides). And my dns server under my godaddy domain is set to entrydns. Oh and don't forget to portforward :)

If you need I can give you a more detailed step by step guide, but I hope you can figure out this easy process through google :)

1
  • 1
    might be better to provide the more detailed step by step guide anway, especially if it helps others with similar problems. I understand that googling will help, but I guess every question can be answered with google!
    – kolin
    Commented Apr 30, 2013 at 7:51
0

It depends whether you want to persistently share your web contents, or you need only episodic public access. For the latter, there's no need to go through the hassle of setting up a DynDNS account and opening forwarding ports in your router.

A pretty easy solution is to use LocalTunnel, which will make your webserver accessible through a domain name such as :

http://8bv2.localtunnel.com

It's very useful for sharing progress of a website you are hosting on your computer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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