0

I am trying to connect my Raspberry Pi 2 model B V 1.1 using Raspbian Wheezy to my laptop that is connected to the internet using Wi-Fi and my LAN port is empty. I followed The best way to connect Raspberry Pi to laptop display to connect and everything is fine and working but my laptop assigned IP to the Ethernet is 192.168.137.1 so I tried to connect using VNC Viewer but that is saying that The connection was refused by the host computer.

After this I tried to find out my IP address from Raspberry and I got 192.168.137.XX or sometimes 192.XXX.XXX.XXX means totally different IP addresses as shown in the laptop Ethernet. When I used the Raspberry Pi's IP address in VNC Viewer then it's working fine but when I do not have a display connected to my Raspberry Pi then how can I know the internal IP address of my Raspberry Pi?

  • To make this setup work, you need to know the exact IP addresses of host and raspi. How are you connecting to the raspi, are you using SSH or monitor+keyboard? In most circumstances, it is easier to just use DHCP to let the router assign an IP to the host. Connect raspi to host, and either bridge WiFi and Ethernet connection or use Internet Connection Sharing. For the IP addresses, see this ICS guide – kba Feb 14 '16 at 12:30
  • I tried to assign automatic IP to my Ethernet using DHCP Enabled and first found my assigned IP to my Ethernet port using ipconfig in windows but the IP that is showing there is different from the IP showing in Raspberry Pi. Now what should I do? – Muhammad Hassan Feb 14 '16 at 13:12
  • I am new to this so I followed every step from the upper link but the problem is this that the IP showing in my windows is different and the IP showing in raspberry is different so How can I know the IP of raspberry in windows when I will not have any display to Raspberry? – Muhammad Hassan Feb 14 '16 at 13:32
  • I tried to ping raspberrypi in windows to know the IP of RaspberryPi but saying that Ping request could not find host raspberrypi. Please check the name and try again. – Muhammad Hassan Feb 14 '16 at 13:35
  • 1
    You're confusing the network interfaces. WiFi connects laptop to router (and internet). WiFi should use DHCP. Ethernet shares WiFI connection with raspi. Ethernet should have a fixed IP (by default: 192.168.137.1 in Win >= 7, 192.168.0.1 in Win <= XP. Now, you know that the DHCP server on your Ethernet interface assigns IPs incrementally. So the IP of the raspi is probably 192.168.0.2 (WinXP) or 192.168.137.2 (Win>=7). Try ping 192.168.137.2. – kba Feb 14 '16 at 13:36
0

After following the steps in the shared link in question, I wan unable to find out my Raspberry Pi real IP address because my Ethernet IP address is altered by Raspberry Pi. So when I will not have the display then how can I know the IP address of my Raspberry Pi? But its solved now. Just follow the below steps...

$ sudo apt-get update
$ sudo apt-get install samba

Now after installing this on Raspberry Pi, just type ping <hostname> in your Windows CMD and that will return the current correct IP of raspberry pi that you can use in VNCViewer to connect. The default hostname of Raspberry Pi is raspberrypi . You can change it also by editing /etc/hosts.

  • 1
    Don't change hostname by editing /etc/hosts do it properly; usually by running raspi-config. Editing /etc/hosts only does half the job. – Milliways Feb 14 '16 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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