beatsal
Posts: 177
Joined: Tue Mar 21, 2017 2:46 pm

vnc

Mon Jan 15, 2018 12:19 am

How do you set up VNC. I have a PI and am trying to connect to it via VNC. How do I get the IP address OF THE pi so I can key it in to connect to my PC.

User avatar
DougieLawson
Posts: 31218
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: vnc

Mon Jan 15, 2018 12:56 am

sudo apt install realvnc*

Job done. You can get realvnc-vnc-server to start at bootup and that means you can always connect to raspberrypi.local:5900 with a RealVNC client.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

User avatar
topguy
Posts: 3993
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: vnc

Mon Jan 15, 2018 12:59 am

If you can boot the Pi connected to a screen and keyboard and mouse at least once, its quite easy to use the tools to enable SSH ( which you want as a backup anyway ) set up RealVNC and maybe set a static IP-adress so you dont have to worry about it.

- Or you can look in the GUI of you router and see if it has a record of DHCP clients, you should find your Pi there.
- Or you can use a IP/port scanner on your PC or Phone. ( e.g "fing" for Android )

User avatar
pi-anazazi
Posts: 447
Joined: Fri Feb 13, 2015 9:22 pm
Location: EU

Re: vnc

Mon Jan 15, 2018 8:32 am

...or (if you use your pi in your own network environment) you can reserve an IP in the router (DHCP server) based on the MAC address of your pi.
Kind regards

anazazi

beatsal
Posts: 177
Joined: Tue Mar 21, 2017 2:46 pm

Re: vnc

Tue Jan 16, 2018 11:30 pm

Thanks.

'You can get realvnc-vnc-server to start at bootup and that means you can always connect to raspberrypi.local:5900 with a RealVNC client.'

Not sure how to do this. If explained in discrete steps, I can try it.

klricks
Posts: 5083
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: vnc

Wed Jan 17, 2018 12:34 am

beatsal wrote:
Tue Jan 16, 2018 11:30 pm
Thanks.

'You can get realvnc-vnc-server to start at bootup and that means you can always connect to raspberrypi.local:5900 with a RealVNC client.'

Not sure how to do this. If explained in discrete steps, I can try it.
RealVNC is already pre installed in Raspbian. You only need to enable VNC using the Interfaces menu in the GUI config tool in [menu ] --> [Preferences]
-OR-
By using sudo raspi-config and then reboot.

Once enabled it will automatically start on boot and be available for remote connection(s).

Download the appropriate viewer client for the remote system from here: https://www.realvnc.com/en/connect/download/viewer/
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://blackeagle12.net/Comp/RPi/Rpi.html Click contact icon then world icon --->

beatsal
Posts: 177
Joined: Tue Mar 21, 2017 2:46 pm

Re: vnc

Mon Jan 22, 2018 2:38 am

I am away from home and so do not have a monitor to connect to PI. I do have a PI and laptop at my remote place but without the monitor, can I connect to my PI with my laptop?

User avatar
HawaiianPi
Posts: 1641
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: vnc

Mon Jan 22, 2018 3:40 am

beatsal wrote:
Mon Jan 22, 2018 2:38 am
I am away from home and so do not have a monitor to connect to PI. I do have a PI and laptop at my remote place but without the monitor, can I connect to my PI with my laptop?
There are several options, but we need more information...
  1. Which model Raspberry Pi?
  2. What OS do you have on the Pi and laptop?
  3. Are you connecting the Pi and laptop to a local network/router (and how), or do you want to connect them directly?
My password is the last 8 digits of Pi.

beatsal
Posts: 177
Joined: Tue Mar 21, 2017 2:46 pm

Re: vnc

Mon Jan 22, 2018 9:28 pm

1. 3B
2. Raspbian d'loaded from the PI website.
3. I connected the laptop wirelessly to my router. I get email and PI forum this way. I powered up the PI and got the red and green lights, so it is working, but when I typed 192.168.0.1 to access my router, my PI does not show up in wireless clients but my laptop does. However, I did connect my laptop to the router using the SSID of the router, but did not do anything for the PI.

Thanks

User avatar
HawaiianPi
Posts: 1641
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: vnc

Mon Jan 22, 2018 11:47 pm

beatsal wrote:
Mon Jan 22, 2018 9:28 pm
... I did connect my laptop to the router using the SSID of the router, but did not do anything for the PI.
You will also need to connect your Pi3B to your router, either with an Ethernet cable or WiFi. If you have an Ethernet cable all you need to do is connect it between the Pi3B Ethernet port and a LAN port on your router. If you want to use wireless, you can do that without a keyboard, mouse or screen by putting an edited wpa_supplicant.conf file onto the small FAT32 "boot" partition of the SD card.

This is the procedure I use for setting up headless boot with SSH and wireless network. It works with Raspbian Jessie or Stretch, Desktop or Lite, and with the built-in WiFi on the Pi3 & Zero W, or a Raspbian compatible USB WiFi dongle on other models (tested on an old model B, Pi2 and Pi Zero). Everything is done before you boot the SD card, and can be done on a Windows or Mac computer which only has access to the small FAT32 "boot" partition of a Raspbian imaged SD card.
  1. Grab the latest Raspbian image from https://www.raspberrypi.org/downloads/raspbian/
  2. Grab the Etcher software from https://etcher.io/
  3. Install Etcher and use it to write the Raspbian image to your SD card. You don't need to extract the image or format the card prior to writing. Just choose the Raspbian .zip, pick your SD card and write (if you have trouble, verify the SHA256 checksum of the download).
  4. Remove and reinsert the SD card so that your Windows or Mac PC can see the small FAT32 partition on the SD card (labelled "boot").
    If you get a message telling you the card must be formatted, cancel it.
  5. On the small FAT32 "boot" partition, create a file with the name ssh (or ssh.txt). It can be empty, the contents don't matter.
  6. If you are connecting the Pi to your router with an Ethernet cable, you can eject the card and use it to boot your Pi now.
  7. To connect to a wireless network, create another file on the card called wpa_supplicant.conf, which has the following inside:

    Code: Select all

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    country=US
    
    network={
         ssid="Your network name/SSID"
         psk="Your WPA/WPA2 security key"
         key_mgmt=WPA-PSK
    }
    Edit country=, ssid= and psk= with your information and save the file.
    Use a pure text editor when creating the wpa_supplicant.conf file (don't use a word processor).
  8. Safely eject the card from your PC and use it to boot the Pi.
If Raspbian finds an ssh file it will enable SSH and delete the file. If it finds a wpa_supplicant.conf file, it will move it to its correct location and connect to your wireless network. Give your Pi some time to boot and connect to your network (the first boot always takes a bit longer), then you should be able to SSH into the Pi and configure it how you like.

If you have a Zeroconf network service installed (iTunes, Bonjour or Quicktime installs Zeroconf), you can SSH into pi@raspberrypi.local (provided you don't have any other Pi computers on your network with the same default hostname). Otherwise you can login to your router or use a network scanner app (like Fing for smartphones) to find your Pi's IP address.

To login using SSH from Windows, you can use an app called PuTTY, which looks like this.
Image

In the Host Name (or IP address) field, enter either,

Code: Select all

pi@raspberrypi.local
or
pi@{your Pi's IP address}
Make sure SSH is selected (it should be by default) and click on Open.

If you have done everything correctly, a terminal window will open and you should see a password request. Although, if it's the first time you've connected to your Pi, you may have to answer "yes" to a security question, and then you'll get the password prompt. After login you'll get a warning about having SSH enabled with the default password, so type passwd[Enter] and enter a new password (twice). And now you can do whatever you need to configure your little Raspberry Pi computer (like enable VNC in raspi-config).

If you have attempted this and failed, then pulled power to turn off the Pi, you should start over with a freshly imaged card. Improperly powering down the Pi can cause SSH key generation to fail, which will prevent SSH logins.
My password is the last 8 digits of Pi.

beatsal
Posts: 177
Joined: Tue Mar 21, 2017 2:46 pm

Re: vnc

Tue Jan 23, 2018 12:08 am

Thanks for the detailed instruction. I will try with Ethernet (wired) first, so will have to go through all steps to 6?
Also step 5 "On the small FAT32 "boot" partition, create a file with the name ssh (or ssh.txt). Where would be the "boot" partition and how to create the file with ssh?

klricks
Posts: 5083
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: vnc

Tue Jan 23, 2018 1:31 am

beatsal wrote:
Tue Jan 23, 2018 12:08 am
Thanks for the detailed instruction. I will try with Ethernet (wired) first, so will have to go through all steps to 6?
Also step 5 "On the small FAT32 "boot" partition, create a file with the name ssh (or ssh.txt). Where would be the "boot" partition and how to create the file with ssh?
When you put the SD card in your Windows computer the boot partition is the only thing that is visible. Just put it there with the rest of the boot files. DO NOT create a /boot sub directory.

You can use notepad. You don't even have to put any text in the file. Just name the file ssh. Notepad will likely add the extension .txt to the filename. Either ssh or ssh.txt can be used.
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://blackeagle12.net/Comp/RPi/Rpi.html Click contact icon then world icon --->

beatsal
Posts: 177
Joined: Tue Mar 21, 2017 2:46 pm

Re: vnc

Tue Jan 23, 2018 2:25 am

Thanks, will try it out - being a newbie, a bit scared!
You mentioned "Are you connecting the Pi and laptop to a local network/router (and how), or do you want to connect them directly?" Do you imply that I can connect RPI directly to my computer? In that case, I would only need a USB cable with identical ends?

klricks
Posts: 5083
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: vnc

Tue Jan 23, 2018 2:48 am

beatsal wrote:
Tue Jan 23, 2018 2:25 am
Thanks, will try it out - being a newbie, a bit scared!
You mentioned "Are you connecting the Pi and laptop to a local network/router (and how), or do you want to connect them directly?" Do you imply that I can connect RPI directly to my computer? In that case, I would only need a USB cable with identical ends?
A network cable can be used to connect laptop to RPi directly however it is much easier to connect the laptop and RPi to your local network / router by WIFI or cable.
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://blackeagle12.net/Comp/RPi/Rpi.html Click contact icon then world icon --->

beatsal
Posts: 177
Joined: Tue Mar 21, 2017 2:46 pm

Re: vnc

Tue Jan 23, 2018 11:38 pm

I connected PI directly to my router with ethernet cable; my computer is connected to my router by WIFI. I access my router using 192.168.0.1 and get:

192.168.0.5 14ABF06FCC84 14:AB:F0:6F:CC:86 Cable 2018-02-06 10:20:21.00
192.168.0.2 083E0CF5FB6A 08:3E:0C:F5:FB:6A Ethernet 2018-02-06 10:20:52.00
192.168.0.17 android-65fe2f125b8733ae 84:38:38:B6:F1:26 Wireless 2018-02-06 10:20:19.00
192.168.0.19 HUAWEI_KII-L05-e61768cba1 04:4F:4C:7F:BD:59 Wireless 2018-02-06 10:22:00.00
192.168.0.3 Galaxy-A5-2017 90:97:F3:C9:A5:3C Wireless 2018-02-06 10:22:25.00
192.168.0.11 Acer A4:17:31:AA:E1:31 Wireless 2018-02-06 21:02:20.00
192.168.0.4 083E0CF24515 08:3E:0C:F2:45:17 Cable 2018-02-06 20:15:55.00
192.168.0.21 Admin-PC 00:16:44:60:A8:97 Wireless 2018-02-06 21:21:07.00

I would guess PI is 192.168.0.2. Now, I am trying to access PI to get the splash screen but don't know how. (My computer is the last i.e. 192.168.0.21)

klricks
Posts: 5083
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: vnc

Wed Jan 24, 2018 1:11 am

beatsal wrote:
Tue Jan 23, 2018 11:38 pm
I would guess PI is 192.168.0.2. Now, I am trying to access PI to get the splash screen but don't know how. (My computer is the last i.e. 192.168.0.21)
Are you running the RPi 'headless' ......no monitor or keyboard?
Have you enabled ssh and vnc as shown in posts above?
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://blackeagle12.net/Comp/RPi/Rpi.html Click contact icon then world icon --->

beatsal
Posts: 177
Joined: Tue Mar 21, 2017 2:46 pm

Re: vnc

Wed Jan 24, 2018 2:04 am

Yes, running headless. VNC is enabled on my laptop but how to enable it on PI as it is running headless?

klricks
Posts: 5083
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: vnc

Wed Jan 24, 2018 3:02 am

beatsal wrote:
Wed Jan 24, 2018 2:04 am
Yes, running headless. VNC is enabled on my laptop but how to enable it on PI as it is running headless?
1. Remove the SD card and put it back into your (Windows) laptop.
2. Open notepad the go to save as and save the file with filename ssh or ssh.txt (You don't have to type anything into the file)
3. Move the ssh file to the SD card.
4. Put the SD card back into the RPi and boot it.
5. On laptop download PuTTy https://www.putty.org/
6. Configure PuTTy as shown in post by HawwaiianPi above.
7. Login to the RPi with your username and password
8. Run sudo raspi-config and go to the interfaces menu and enable vnc
9. Reboot the RPi then go to your laptop and connect with the RealVNC viewer using the same ip that you used to connect with ssh above. Be sure to use the realVNC viewer from here: https://www.realvnc.com/en/connect/download/viewer/
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://blackeagle12.net/Comp/RPi/Rpi.html Click contact icon then world icon --->

beatsal
Posts: 177
Joined: Tue Mar 21, 2017 2:46 pm

Re: vnc

Wed Jan 24, 2018 11:46 pm

Tried but get error:
"cannot connect to raspberrypi.local. Host connection does not exist"
My PC is connected wirelessly to my router; my PI is Ethernet connected to my router

User avatar
HawaiianPi
Posts: 1641
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: vnc

Thu Jan 25, 2018 9:09 pm

beatsal wrote:
Wed Jan 24, 2018 11:46 pm
Tried but get error:
"cannot connect to raspberrypi.local. Host connection does not exist"
Connecting to raspberrypi.local requires Zeroconf. Have you installed a Zeroconf service (iTunes, Bonjour or Quicktime)?

If not you can log into your router and look for raspberrypi on the client list to get the IP. Or you can use a network scanner app (like Fing for smartphones) to find it on your network. Then just SSH into your Pi at its IP address. You can also configure the DHCP server in your router to always give your Pi the same IP so you will always know what it is (routers can assign reserved IP to device MAC address).
My password is the last 8 digits of Pi.

beatsal
Posts: 177
Joined: Tue Mar 21, 2017 2:46 pm

Re: vnc

Sat Jan 27, 2018 12:25 pm

Thanks.
Trying it but I bought a new PI which has NOOBS, having trouble using it as am not as familiar with it as with Raspbian. Used to getting the splash screen with the road going nowhere. Now I get a red raspberry instead and don't know what to do with it!
Also not sure how to load Fing on my Huawei phone.

User avatar
HawaiianPi
Posts: 1641
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: vnc

Sat Jan 27, 2018 1:27 pm

You can't use NOOBS if you want to run headless. NOOBS is just an installer, it's not an OS. Follow my instructions above to create a Raspbian SD card with SSH enabled, and then you'll be able to turn on the VNC service as well.
My password is the last 8 digits of Pi.

beatsal
Posts: 177
Joined: Tue Mar 21, 2017 2:46 pm

Re: vnc

Sat Jan 27, 2018 5:03 pm

klricks wrote:
Wed Jan 24, 2018 3:02 am
beatsal wrote:
Wed Jan 24, 2018 2:04 am
Yes, running headless. VNC is enabled on my laptop but how to enable it on PI as it is running headless?
1. Remove the SD card and put it back into your (Windows) laptop.
2. Open notepad the go to save as and save the file with filename ssh or ssh.txt (You don't have to type anything into the file)
3. Move the ssh file to the SD card.
4. Put the SD card back into the RPi and boot it.
5. On laptop download PuTTy https://www.putty.org/
6. Configure PuTTy as shown in post by HawwaiianPi above.
7. Login to the RPi with your username and password
8. Run sudo raspi-config and go to the interfaces menu and enable vnc
9. Reboot the RPi then go to your laptop and connect with the RealVNC viewer using the same ip that you used to connect with ssh above. Be sure to use the realVNC viewer from here: https://www.realvnc.com/en/connect/download/viewer/
Tried, but since I am operating headless cannot login to RPi (step 7)

beatsal
Posts: 177
Joined: Tue Mar 21, 2017 2:46 pm

Re: vnc

Sat Jan 27, 2018 5:06 pm

HawaiianPi wrote:
Sat Jan 27, 2018 1:27 pm
You can't use NOOBS if you want to run headless. NOOBS is just an installer, it's not an OS. Follow my instructions above to create a Raspbian SD card with SSH enabled, and then you'll be able to turn on the VNC service as well.
Tried but got same error msg that host does not exist (posted 3 days earlier)

klricks
Posts: 5083
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: vnc

Sat Jan 27, 2018 5:51 pm

beatsal wrote:
Sat Jan 27, 2018 5:06 pm
HawaiianPi wrote:
Sat Jan 27, 2018 1:27 pm
You can't use NOOBS if you want to run headless. NOOBS is just an installer, it's not an OS. Follow my instructions above to create a Raspbian SD card with SSH enabled, and then you'll be able to turn on the VNC service as well.
Tried but got same error msg that host does not exist (posted 3 days earlier)
Please confirm that you are not using a SD card with NOOBs
In the hostname field of the PuTTy application you need to put the IP address of the RPi
Something like this but you will need to use the actual IP address of your RPi:
pi @192.168.0.x

Note I did not see a raspberry Pi in your routers device list that you posted above.
The first 3 numbers of the MAC address of all RPi (WIRED) connections should be:
B8:27:EB:
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://blackeagle12.net/Comp/RPi/Rpi.html Click contact icon then world icon --->

Return to “General discussion”

Who is online

Users browsing this forum: bensimmo, mattmiller, mscel, Paul Hutch, PhatFil, wildfire and 44 guests