I have VNC running on my PI with the default port ("netstat -npl" suggests that is 5901). I am trying to set up Port Forwarding on my router to let me VNC in to my PI from an external network. I have my router configured to foward port 5000 to 5901 on the PI.

When I connect to my PI on the same LAN, I use Tight VNC Viewer with the PI's IP and specify :1 for the display. For instance:

On my remote machine, in Tight VNC Viewer, I am trying to connect, but I need to specify the port. TightVNC instructs you to do so using :: for the port, such as:


That fails, presumably because I haven't included the :1 for the display number. Is there a way to specify both the port and display number? "myDnsName:1:5000" and "myDnsName::5000:1" return errors.

Additionally, I tested the port forward of just 5901 to 5901. From my remote machine trying just "myDnsName:1" did not work.


It seems like my port forwarding settings didn't apply correctly. Not sure how that heppened, D'oh!

  • By "mydnsname" do you mean public IP? May 23, 2016 at 21:10
  • No, I meant the dynamic DNS Name pointing to my IP address. Public IP would also work though. May 24, 2016 at 0:02
  • 1
    please mark an answer as correct by clicking the checkmark to the left of it May 24, 2016 at 0:40

3 Answers 3


From my experience when connecting to the PI you need to simply add the display number to the port number. For example when connecting to a VNC on display 1 you would use your.ip.goes.here:5901 (instead of your.ip.goes.here:1)

If the VNC server was on display 2 you would use your.ip.goes.here:5902

Also make sure that the port you are forwarding is the same as the port on the pi, so if you want to connect to display one you would forward port 5901

  • This did it! myDnsName::5901 worked. May 23, 2016 at 23:43
  • At first I thought this was the solution, but It seems like my port forwarding settings didn't apply correctly. myDnsName:5000 worked but NOT myDnsName:5001. Not sure how that heppened, D'oh! May 24, 2016 at 0:01
  • Thanks, all the tutorials are telling you should connect to vnc://<ip>:1 which is wrong. This did the trick for me on a MAC.
    – Andi Giga
    May 24, 2016 at 11:19

Try using the command below


You wrote a similar command in your question as something that gave you an error. But you were missing a colon before the port number. Please feel free to read more about vnc here


I was also unable to access VNC from the WAN even though I setup port forwarding correctly. I had to stop OpenVPN on Raspberry Pi with the command

sudo service openvpn@outgoing stop

then it worked

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.