0

I just got my new Raspberry Pi3 (model B). I have installed it and now I don't want to use all the cables for mouse, keyboard, HDMI and so on, which is why I have decided to use Ethernet Cable and using Putty to communicate with it. But when I try to call it with Putty it says "No route to host".

  1. I use Linux on my laptop as well. When I plug in the cable it gives me a notification that I have established an ethernet connection.
  2. I have tried to set up a static IP address for the raspberry pi by changing the /etc/dhcpcd.conf file. I have added the following lines of code at the end:

    interface eth0 static ip_address=192.168.0.2 static domain_name_servers=192.168.0.1

  3. my ifconfig on the laptop looks like this:

    $ ifconfig
    enp2s0    Link encap:Ethernet  HWaddr 18:31:bf:1c:35:f2  
              inet addr:169.254.220.38  Bcast:169.254.255.255  Mask:255.255.0.0
              inet6 addr: fe80::88c6:d80a:1465:65a8/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:16 errors:0 dropped:0 overruns:0 frame:0
              TX packets:297 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:2128 (2.1 KB)  TX bytes:54278 (54.2 KB)
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:699515 errors:0 dropped:0 overruns:0 frame:0
              TX packets:699515 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:35255453 (35.2 MB)  TX bytes:35255453 (35.2 MB)
    
  4. the ifconfig on the Raspberry Pi:
    [screenshot[1]

Can someone notice what is my mistake?

  • If your local network is 192.168.0.1 wouldn't you want your Pi static IP to be of the same format, as in 192.168.0.x with x being a number which is outside the router's DHCP allocation range? – fred_dot_u Oct 29 '18 at 18:47
  • I have changed that, but still nothing happens. Now it is 192.168.0.2 – Tricker Macedonia Oct 29 '18 at 18:50
  • were you refering to static domain_name_servers=192.168.0.1? – Tricker Macedonia Oct 29 '18 at 18:51
  • I neglected to note that you are using Pi to PC connection, not Pi to router, disregard my question. Mark Swope has a better approach. – fred_dot_u Oct 29 '18 at 19:31
  • since your laptop IP is 169.254.220.38 .... change the RPi IP to something like 169.254.220.10 – jsotola Oct 30 '18 at 0:14
1

As shown with ifconfig your laptop has a link-local ip address 169.254.220.38. This is good and there is nothing else to do. The RasPi does not have any ip address but it should also get an auto assigned link-local ip address from the range 169.254.0.0/16. A fresh flashed Raspbian Stretch image will do that out of the box. So you should revert all network settings you have done to its default and reboot. Then you should find an ip address on the interface eth0. If not then flash the image again. For example on my RasPi it looks like this:

rpi ~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:53:bd:de brd ff:ff:ff:ff:ff:ff
    inet 169.254.89.120/16 brd 169.254.255.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::2529:4c35:920a:6e30/64 scope link
       valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether b8:27:eb:06:e8:8b brd ff:ff:ff:ff:ff:ff

You should then be able to ping -c3 169.254.220.38 to your laptop and from the laptop to the ip address of the RasPi.

0

Just a point of clarification - it sounds like you've connected the PI directly to your laptop. If so, you will not get a connection. You will need a switch or a cross-over cable to make it work. Second, it looks like your laptop is expecting a DHCP server to give it an address (it shows an address in the 169.x.x.x range). This is not in the same network as you intended for your PI (192.x.x.x). Third, it also looks like your PI is expecting a DHCP server since it shows the Ethernet port is up, but doesn't have an assigned address.

It might be much easier if you restore your /etc/dhcpcd.conf file and then try bringing up the interfaces by themselves. "ifconfig eth0 192.168.0.2 netmask 255.255.255.0 up" for the PI and "ifconfig eth0 192.168.0.3 netmask 255.255.255.0 up" for the laptop. Don't forget that you still need a switch or a cross-over cable for this to work!

  • 1
    a crossover cable is not required to connect the Pi to a laptop. it also works with a regular Ethernet cable, if the laptop is not too old. – oh.dae.su Oct 29 '18 at 21:58
  • 1
    Any computer made in the last 10 years will NOT need a crossover cable. – Milliways Oct 29 '18 at 22:57
0

Your fundamental problem is that your laptop does not have an IP address - this is not a Pi problem.

  • inet addr:169.254.220.38 ? I thought this is my IP – Tricker Macedonia Oct 30 '18 at 9:29
  • It is not the laptop that has no ip address. The RasPi has no ip address. Is there something wrong with /etc/dhcpcd.conf? – Ingo Oct 30 '18 at 11:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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