I'm new to this and I have a problem that I'm strugglin' with and I really hope someone can solve it. I've headlessly installed my RPi but I'm unable to find the IP address of it and SSH to it. I connected the RPi via Ethernet to my router and used my laptop to search for the IP. I tried everything: I used nmap, I used the Pi Finder app from Adafruit, I logged into my router and listed the devices connected to it. Result: nothing, just a big headache and I can't find the IP. I know it's not a problem of bad installation of Raspian 'cause at the university today I tried to connect my Pi to a monitor via HDMI and everything was working correctly. DHCP server is workin' on my router, and I have also unplugged and plugged it again before startin' the search of the IP What could be the problem? Workin' with a plugged monitor is not an option 'cause I don't have one.
If you cant see it in the DHCP client list in your router then its not getting an ip, so you cant get it it. Either not booted for some reason, not starting the network device, or not on network at all. Gonna need to see it onscreen to know.
First, make sure you are connecting your raspberrypi to your router using a straight-through/patch cable, not a crossover cable!
(I don't know for sure if the raspberrypi can use a crossover cable to connect to a router).
You can try pinging the raspberrypi's mDNS name:
hydraxan@bubblepop-rpi ~ $ ping -c 4 raspberrypi.local PING raspberrypi.local (192.168.1.172) 56(84) bytes of data. 64 bytes from raspberrypi (192.168.1.172): icmp_req=1 ttl=64 time=0.631 ms 64 bytes from raspberrypi (192.168.1.172): icmp_req=2 ttl=64 time=0.632 ms 64 bytes from raspberrypi (192.168.1.172): icmp_req=3 ttl=64 time=0.536 ms 64 bytes from raspberrypi (192.168.1.172): icmp_req=4 ttl=64 time=0.550 ms --- raspberrypi.local ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3005ms rtt min/avg/max/mdev = 0.536/0.587/0.632/0.047 ms
If you know your network address, you should be able to use nmap to quickly scan your network:
(I know you said you tried nmap, but I don't know exactly what you meant by that and I don't have enough rep to comment yet).
(Example network addresses: 192.168.0.0/24, 192.168.1.0/24, 10.8.0.0/24, etc.).
hydraxan@bubblepop-rpi ~ $ nmap -sn 192.168.1.0/24 Starting Nmap 6.00 ( http://nmap.org ) at 2016-05-04 23:40 UTC ... Nmap scan report for raspberrypi (192.168.1.172) Host is up (0.0014s latency). ... Nmap done: 256 IP addresses (10 hosts up) scanned in 5.41 seconds
If your pi still can't get on the network, you might check the kernel logs next time you plug into a monitor and see if there's any helpful information there:
pi@raspberrypi:~ $ sudo cat /var/log/kern.log | grep eth0 Mar 18 08:58:54 raspberrypi kernel: [ 2.843624] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-20980000.usb-1.1, smsc95xx USB 2.0 Ethernet, ff:ff:ff:ff:ff:ff Mar 18 08:58:57 raspberrypi kernel: [ 49.991795] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup Mar 18 08:58:57 raspberrypi kernel: [ 49.997258] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready Mar 18 08:58:59 raspberrypi kernel: [ 51.572325] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1 Mar 18 08:58:59 raspberrypi kernel: [ 51.592151] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Check the state of your eth0 network interface:
pi@raspberrypi:~ $ ip address show eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether ff:ff:ff:ff:ff:ff brd ff:ff:ff:ff:ff:ff inet 192.168.1.172/24 brd 192.168.1.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::8aa:1656:63fd:c77d/64 scope link valid_lft forever preferred_lft forever
Make sure that there's nothing wrong with your interfaces file:
pi@raspberrypi:~ $ cat /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) # Please note that this file is written to be used with dhcpcd # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf' # Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d auto lo iface lo inet loopback iface eth0 inet manual allow-hotplug wlan0 iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf allow-hotplug wlan1 iface wlan1 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Once you get your raspberrypi onto the network, you can ssh into it using its ip address or mDNS name:
(Hint: the default password is "raspberry" (without the quotes)).
hydraxan@bubblepop-rpi ~ $ ssh firstname.lastname@example.org The authenticity of host 'raspberrypi.local (192.168.1.172)' can't be established. ECDSA key fingerprint is ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'raspberrypi.local,192.168.1.172' (ECDSA) to the list of known hosts. email@example.com's password: The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Fri Mar 18 08:59:12 2016 pi@raspberrypi:~ $
(Tested with my old raspberrypi model b running a fresh install of 2016-03-18-raspbian-jessie).
(Tested again with a fresh install of 2016-03-18-raspbian-jessie-lite).
It could be that it is not getting an ip from your routers DHCP server for a lot of reasons, the most likely being that your router has been configured to use static IPS only. But because almost every commercial router has a built in DHCP server that is on by default. And the Pi will request a DHCP ip by default, I believe that the problem lies in the Pi, if possible you should connect it to a display and see if it boots up properly or if any errors are made visible, you may also look at the activity LEDs on the Pi, the red led should be solid and green and yellow should be either solid or blinking, if only the red led is on then your power source is not supplying the required 1.2 amps and if your Pi has the red led on and green led blinks but then stops after about 5 seconds and never comes back on again with no other LEDs coming on other than red. You have a corrupt as card which may be a hardware incompatibility or you may have incorrectly written the image to the card.
When the Pi gets an IP assigned, you could send it to yourself by E-Mail (you need a working mail transport for this, I use
bsd-mailx). Create a new script in
root@raspberrypi:/etc/network/if-up.d# cat publish-IP.py #!/usr/bin/env python import os import smtplib SERVER = "localhost" FROM = "pi@raspberrypi3" TO = ["you@yourdomain"] SUBJECT = "my new IP address" data = os.popen("ip addr show eth0").read() msg = """\ From: %s To: %s Subject: %s %s """ % (FROM, ",".join(TO), SUBJECT, data) server = smtplib.SMTP(SERVER) server.sendmail(FROM, TO, msg) server.quit()
Use valid addresses for
TO, make the script executable with
chmod +x publish-IP.py.
You can optimize this further by sending the mail only when the IP address is different from the last one.