1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

How to access Pi over the internet from another computer

Discussion in 'IoT - Internet of Things' started by Parth86, Nov 24, 2017.

  1. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    546
    Likes:
    5
    Hi
    I have been discuss this at another place but I have not found a satisfactory answer yet , How can we access Raspberry Pi over the internet from another computer. Have you ever done this? I have found some information here https://www.raspberrypi.org/documentation/remote-access/access-over-Internet/ But not getting much help from link

    You can control your home device within 100 feet range because your WiFi range is 100 feet but what happen when you want to control home device from long distance like 10 km +

    How can we access Raspberry Pi over the internet from another computer?
     
    Last edited: Nov 24, 2017
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,310
    Likes:
    914
    Location:
    Rochdale UK
    • Like Like x 1
  3. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,375
    Likes:
    975
    Location:
    Loveland, CO USA
    "access" ???????
    1) Like Ian said, in post #2.
    2) Some people want to type on the PC but drive the Pi. See picture. (don't need a keyboard and monitor) Use a PC.
    https://diyhacking.com/connect-raspberry-pi-to-laptop-display/
    upload_2017-11-24_7-4-32.jpeg
    3) Your PC to Pi connection half way around the world is simple & complicated.
    The PC needs to know the IP address of the Pi, and the address of the router, and probably the address of the internet service for the Pi. I don't know how but "at work" they talk from US to China all the time.

    I think we need to know more about what you are trying to do.
     
    • Like Like x 1
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    546
    Likes:
    5

    I want to start with LED because its very easy to test. I have connected led with resistor to raspberry in my home india. Now I want to control this led from outside india. How to do this?

    This is my board

    [​IMG]

    This is gui interface

    [​IMG]
     
  6. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,375
    Likes:
    975
    Location:
    Loveland, CO USA
    Search for "raspberry web server" (there are also youtube videos that show how)
    I used "Apache" or "Flask".
    There is a demo "turn on LED".
    Make this work inside your house first.

    Next step is how to get into your house. The answer to that can be found in the same place.
     
    • Like Like x 1
  7. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,972
    Likes:
    1,099
    This is more info that you present over at AAC. Look here: https://www.realvnc.com/en/connect/docs/get-connected.html for part of the instructions for VNC. Note that it uses a cloud or can use a direct connection with the right product.

    The cloud is allowing VNC to find your computer at both ends. Note for VNC to work in the non-cloud mode, you have to forward port 5900. it's unlikely that you can access your router from outside the home unless you have configured it for that ability. You should be able to config the router from the VNC connection to the Pi.

    Remember that the URL www.whatismyIP.com will get you the public IP address when run from the Pi, but there is NO WAY if can see the Pi without forwarding the port.As a test, try to set up an SSH server on the Pi. Then set up a web server. Putty can be used on the PC side.

    See https://www.raspberrypi.org/documentation/remote-access/ssh/

    This gives you something to test with, Remember that 127.0.0.1 is the loopback address, so http://127.0.0.1 should run the web server on the local machine if the browser is running on the local machine. You don't have to know the 192.168.1.x address. http://localhost is the same as http://127.0.0.1 which is the same as 127.0.0.1:80 since http:// defaults to port 80.

    Eventually, you will need a Dynamic DNS service to access a web page from somewhere that VNC isn't set up.
     
  8. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,972
    Likes:
    1,099
    I ran into this library: https://github.com/jperkin/node-rpio Supposedly allows control of the Pi's GPIO pins.

    When reading the December 2017 issue of Nuts and Volts magazine.
     
  9. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    546
    Likes:
    5
    I can control led on raspberry.

    I have my exam, after two days, so I did not pay much attention on this. I will work on it after exam.
     
    Last edited: Dec 5, 2017
  10. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,972
    Likes:
    1,099
    Thanks for the update. Good luck on your exam.

    You did a much better in the way the question was asked her.

    The first step would be to open a port on the Pi which you did.
    The second step is to forward that port # to the 192.168.x.y address of the pi. There should be a Port forwarding option in your router.

    Next find a web based tool that confirms the port is open and forwarded to the addr4ss obtained by www.whatismyip.com
     
  11. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,972
    Likes:
    1,099
    I used the tools here https://pentest-tools.com/home to do a port scan on my public IP address:

    I got these results:

    Starting Nmap ( http://nmap.org ) at 2017-11-27 23:40 EET
    Initiating Ping Scan at 23:40
    Scanning <redacted public IP address> [4 ports]
    Completed Ping Scan at 23:40, 0.22s elapsed (1 total hosts)
    Initiating SYN Stealth Scan at 23:40
    Scanning <redacted IP address, DNS name> [100 ports]
    Discovered open port 5009/tcp on <redacted public IP address>
    Completed SYN Stealth Scan at 23:40, 1.86s elapsed (100 total ports)

    [+] Nmap scan report for <redacted DNS name, public IP address>
    Host is up (0.20s latency).
    Not shown: 95 closed ports

    PORT STATE SERVICE
    5009/tcp open airport-admin
    5631/tcp filtered pcanywheredata
    6000/tcp filtered X11
    6646/tcp filtered unknown
    10000/tcp filtered snet-sensor-mgmt


    Nmap done: 1 IP address (1 host up) scanned in 2.30 seconds
    Raw packets sent: 165 (7.236KB) | Rcvd: 135 (5.396KB)

    The last port is from the scanner itself. I did not know that 5009 was visible outside of my network.
     
  12. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,972
    Likes:
    1,099
    I installed nmap for Linux and did a nmap scan of my server and my laptop running linux.

    Starting Nmap 5.21 ( http://nmap.org ) at 2017-11-27 18:05 EST
    Nmap scan report for 10.0.1.222
    Host is up (0.054s latency).
    Not shown: 985 closed ports
    PORT STATE SERVICE
    21/tcp open ftp
    22/tcp open ssh
    80/tcp open http
    111/tcp open rpcbind
    139/tcp open netbios-ssn
    443/tcp open https
    445/tcp open microsoft-ds
    631/tcp open ipp
    873/tcp open rsync
    2049/tcp open nfs
    8080/tcp open http-proxy
    8081/tcp open blackice-icecap
    8200/tcp open unknown
    30000/tcp open unknown
    49152/tcp open unknown

    Nmap done: 1 IP address (1 host up) scanned in 0.77 seconds
    ubuntu@ubuntu:~$ nmap 127.0.0.1

    Starting Nmap 5.21 ( http://nmap.org ) at 2017-11-27 18:06 EST
    Nmap scan report for localhost (127.0.0.1)
    Host is up (0.00025s latency).
    Not shown: 996 closed ports
    PORT STATE SERVICE
    53/tcp open domain
    111/tcp open rpcbind
    631/tcp open ipp
    2049/tcp open nfs


    These scans show the ports (well-known names) and privileged ports (1-1000) that are open.

    I could have an ssh service running on a non-standard port. That would not be reflected in the scan. These ports are accessible from inside my private address space.

    Note the server has port 22 (ssh open). An ssh server at the well-known port of 22 is running there.
     

Share This Page