jack01best
Posts: 17
Joined: Mon Apr 29, 2013 11:43 pm

How to get global IP for Raspberry Pi

Tue Feb 18, 2014 11:28 am

Hi all,

I can use website to control the Raspberry Pi and the Raspberry Pi is treated as the server.

However, it is can be achieved when I use router, which means all devices connect to the same

router (Local IP) so that I can use website to control Raspberry Pi.

Could you please tell me how can I get global IP static address for Raspberry Pi so that I can control Raspberry Pi everywhere.

Thank you very much

User avatar
RaTTuS
Posts: 10558
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: How to get global IP for Raspberry Pi

Tue Feb 18, 2014 11:31 am

1) ask your ISP to give you a static address
2) locate your RPi in a facility that gives static IP addresses
3) use soemthing like http://www.noip.com/ noip nd use it via that name
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Thaddy
Posts: 174
Joined: Wed Mar 06, 2013 11:28 am

Re: How to get global IP for Raspberry Pi

Tue Feb 18, 2014 11:37 am

Your router has probably an option called "port forwarding". Enter your router's setup and configure port 80 to be forwarded to your local ip address and all should be fine. This means that no other person in the house can run a website from port 80, though. And your provider may have cut it off.
You can basically run the website from e.g (any) port 81 on your Pi. In that case forward it on the router to 81.
you can reach your webserver from the outside world by post-pending ":81" to your external ip. like: xxx.xxx.xxx.xxx:81.
You can obtain your external ip by for example visiting ip.thaddy.com. (there are lots more people who run a similar service, but mine is running for over 10 years) or by using dyndns if your provider may change your external ip.

Focus on the router part: the rest is future problem solving.

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to get global IP for Raspberry Pi

Tue Feb 18, 2014 11:39 am

Use Hurricane Electric and everyone can have a public global IPv6 address.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

Re: How to get global IP for Raspberry Pi

Wed Feb 19, 2014 4:02 am

Do a port forwarding first. instructions at http://raspisimon.no-ip.org/portforwarding.php
Then configure no-ip account. So you dont need to know the public ip each time, you can use a dns-name. Instructions at http://raspisimon.no-ip.org/noip.php
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: How to get global IP for Raspberry Pi

Wed Feb 19, 2014 5:52 am

Who needs a static IP when dyndns.com can handle dynamic ip addresses..
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

User avatar
stpc
Posts: 1
Joined: Tue Feb 25, 2014 5:48 pm

Re: How to get global IP for Raspberry Pi and workaround NAT

Tue Feb 25, 2014 6:16 pm

I'd like to submit a different approach ( but just to show how this could work with board tools)

First of all I'd like to walk my way threw an NAT ( because maybe I can't set port forwadings or something like that

Second, I would really like to know the global IP of my pi

and Third I wanna connect to the pi via ssh and have some fun there


First I want to make my way threw the NAT on Port 30000 (this is outgoing Port)

On the Pi:

Code: Select all

ssh -R remote-server:30000:localhost:22 remote-server-user@remote-server

The global IP thing.... yes we should take care of that too :-)

Let us do this the easy way and find the IP by just asking
This will return your global IP address --> in my case I will write that into a variable to inform my remote server where I can be found

On the Pi:

Code: Select all

curl http://showip.net>$global_ip
And now we could make the Pi send us his global IP every view minutes....or something else.
And to not make us search for to long we set the User agent string to "This is your Pi"

On the Pi:

Code: Select all

curl http://mywebserver.com/?$global_ip -A "This is your Pi"
We could also push several data to an FTP Server or send the data with a Post to our Server (depends on what you want to tell about the network your pi is in)

And finally we can connect threw our remote Server back to your pi right way threw the NAT without doing anything


On your remote Server:

Code: Select all

ssh -p3000 pi_user@global_ip_which_pi_sent_you

I agree that this is not as comfortable as dyndns or another update Service, but on the other hand you can do all that with board tools on your pi.



Hope you enjoy

Stephan

Return to “General discussion”