Solved

Problem pinging Raspberry Pi from Windows 10 PC directly connected via ethernet cable

Posted on 2016-09-18
13
134 Views
Last Modified: 2016-10-03
Hello,

I have very little knowledge of networking and so I can not seem to figure out what is going wrong here.

My set up includes a laptop running Windows 10 connected to internet through Wi-Fi and a Raspberry Pi connected to my laptop through Ethernet cable. I ping raspberrypi.mshome.net from command prompt to find ip for the current session and login through Putty.

I was using this headless Raspberry Pi setup without any problem till I tried to configure some /etc/network/interfaces file on the Pi while following a tutorial trying to connect to wlan from the terminal. I was confused about some part and so decided to leave the thing unchanged and decided to work on it later. Next time when I tried to login through putty, connection was refused. I pinged raspberrypi.mshome.net from command prompt and found "request timeout" and sometimes it said "destination host unreachable". When I used AdvancedIpScanner.exe to find ip for all devices on the network, it gave some ip like 169.254.x.y. This ip can be used to login to the Pi. But the way I had been working before that, using ping from command prompt to find ip(192.168.x.y), and connecting through Putty using this ip, is not working anymore.

The IPv4 properties for the local area connection of my laptop is set to "obtain ip address automatically".

I formatted the Pi SD Card, reinstalled the Raspbian Jessie OS and it again worked fine. I connected to my Wi-Fi from Remote desktop and surfed the internet, and it worked fine. But then again, the next time I logged in, the same problem occurred, ie, request timed out when I tried to ping raspberrypi.mshome.net. Now everytime I try to ping Pi, it shows the same ip against the Pi all the time and request times out. I have reinstalled Raspbian but it doesn't change. (It still works if I try to login using the ip 169.254.x.y from AdvancedIpScanner)

I would like to know what has gone wrong as I am stuck here for quite a few days.

Regards.
0
Comment
Question by:Soumen Roy
  • 3
  • 3
  • 3
  • +2
13 Comments
 
LVL 21

Expert Comment

by:wyliecoyoteuk
Comment Utility
The 169.254.x.x address is an autoconfig address.
If a computer is set to retrieve an automatic address from a dhcp server (e.g. A router) it will get a correct address, but if there is no direct connection to a dhcp server, the computer will set its own autoconfig address.
However, your laptop has cached the original address mapping for the name to the ip address, and it has changed, so the name no longer works.
You really need to either connect the pi to the router directly or set a fixed ip address on the pi and the ethernet port of the laptop.
0
 
LVL 42

Accepted Solution

by:
Davis McCarn earned 250 total points
Comment Utility
You would do best to connect the pi to the router and let it handle the ip's; but, it would also work if you used ICS as long as you change the router to anything but 192.168.0.xxx first.
0
 

Author Comment

by:Soumen Roy
Comment Utility
I don't have a spare monitor to work with. So, I can not connect the Pi to the router..

Could you please explain the steps I need to take, in order to get this working?
0
 
LVL 21

Assisted Solution

by:wyliecoyoteuk
wyliecoyoteuk earned 250 total points
Comment Utility
You wouldn't need a monitor, just connect the pi to the router with an ethernet cable.
It will then gain an ip address in the same range as your laptop's wifi port, and you can connect the same way as before, using the ip scanner to find the ip.
0
 
LVL 42

Expert Comment

by:Davis McCarn
Comment Utility
The pi is set to use DHCP so, as wylie said, it would automatically get an ip address from the router and then show using your ip scanner on 192.168.0.xxx.
If you want to improve it after that, many routers will let you view the attached clients and then reserve an ip address for that client using its mac address.  I might suggest 192.168.0.50 so it stays well out of the way of any other devices.  That way, it would stop getting a different ip address each time the router's power goes out.
0
 
LVL 28

Expert Comment

by:Jan Springer
Comment Utility
It's easiest to just configure a static.

(or vi if you prefer over nano):

sudo nano /etc/network/interfaces

auto lo
iface lo inet loopback
iface eth0 inet static
  address 192.168.0.43
  netmask 255.255.255.0
  gateway 192.168.0.1
  dns-nameservers 8.8.4.4

Substitute your own IP, mask, and gateway.

If you don't, you should have an HDMI cable to connect your pi to a TV to use as a screen.
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
LVL 39

Expert Comment

by:noci
Comment Utility
Direct connection between laptop & RPi most probably will need a Cross-cable as most computers don't have Auto-MDIX interfaces. Current routers & switches do handle this, hubs will not handle this (no immediate need).

"Obtain address automatially" requires a DHCP server active on the segment you are connecting to.
0
 
LVL 21

Expert Comment

by:wyliecoyoteuk
Comment Utility
Actually most modern laptops (i.e. Less than 5 yrs old) do have auto MDX interfaces.
I know that mine (a fairly inexpensive Lenovo) does.
0
 
LVL 28

Expert Comment

by:Jan Springer
Comment Utility
Long term, it would be best if the author connected the pi via HDMI to a TV and statically configured the ethernet interface.
0
 

Author Comment

by:Soumen Roy
Comment Utility
Thank you everyone.. I will work on it, and see what works.. Have got quite a few solutions from here to try out.. :)
0
 

Author Comment

by:Soumen Roy
Comment Utility
Connected my Pi directly to the router and working. I have not realized why dhcp is not available through my laptop's Ethernet port though! :(
0
 
LVL 39

Expert Comment

by:noci
Comment Utility
You do not run a DHCP server on your laptop (i hope)... that would break a lot of networks.
APIPA addresses "might" work depending on dhcpcd settings. (if dhcpcd is used).
Normaly a DHCP server only responds on the network the system is connected too as well. It doesn't work through a router without a lot of help.
0
 
LVL 42

Expert Comment

by:Davis McCarn
Comment Utility
Dynamic Host Configuration Protocol (DHCP) is the process of discovering the server and then obtaining an ip address to use for the rest of that session (usually meaning the device was shut down)
https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
If every PC acted as a DHCP server by default, most networks would be in total chaos because every PC would start handing out ip's, willy nilly, and it simply would not work.
Internet Connection Sharing (ICS) lets you share an internet connection by using two network adapters on the host.  One of the connections must have internet access and then the other is used by the other PC's or devices on that network.  ICS turns on a DHCP server on the shared network connection;; but, defaults to using 192.168.0.xxx which means that the other network connection must use a different ip range.
Because about half of the routers on the planet use 192.168.0.xxx, setting up ICS can be a big pain and its much simpler to just connect everyone to the router.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

My experience with Windows 10 over a one year period and suggestions for smooth operation
If your business is like most, chances are you still need to maintain a fax infrastructure for your staff. It’s hard to believe that a communication technology that was thriving in the mid-80s could still be an essential part of your team’s modern I…
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now