I was trying to connect my Raspberry Pi 3 Model B over Ethernet to my netbook(running Kali from a bootable USB). After a lot of struggle that the RPi automatically assigned an IP to itself when connected to my Windows laptop (running Windows 8.1 Pro x64), using a standard LAN cable which was simply plugged into the Ethernet ports on the RPi and my Windows laptop. The IP wouldn't change across reboots. I tried pinging that IP from my laptop and I could do that, then I tried SSHing into it using puTTY and the same IP and I was able to do that as well even after rebooting both my RPi and my laptop.
Now when I came back home (I did all that at my neighbor's house as I don't have any HDMI output screen for the RPi) and tried to SSH into the Pi using the same IP, it gave me an error saying-
connect: Network was unreachable.
I couldn't even ping it, got the same error. I used this command for SSH:-
ssh email@example.com. I tried switching off WiFi on my Kali netbook but that didn't help, as of now I don't have any idea of what to do.
I can SSH into the Pi using puTTY on Windows(can even use programs such as IDLE and leafpad etc in GUI using Xming) just fine but I can't do the same using Kali, even when the IP for the RPi stays the same...
I was playing around with my Pi at my neighbor's and found that the IP I got which
hostname -I(169.254.121.137) was different from the
hostname -i(127.0.1.1). I immediately tried pinging the second IP from my Kali netbook and voila! I could! But when I tried connecting over SSH, it gave an error saying "Connection Refused". Now how to resolve that?
EDIT 2 :-
I can ssh into the pi from the pi using both the IPs. Using the second IP (i.e 127.0.1.1) gives the connection refused error from puTTY as well. I am still able to SSH into the Pi using puTTY and the first IP (i.e 169.254.121.137).