Raspberry Pi Tips: IP Address

Question: What is the IP address of my Raspberry Pi?

Answer: in a shell, execute the following command:

sudo ifconfig

This will list the inet/IP address:

IP Address of Raspberry

IP Address of Raspberry

Happy IPing 🙂

12 thoughts on “Raspberry Pi Tips: IP Address

  1. I think the problem is a bit more complicated, and generally affects many embedded devices with a TCP/IP connection. Most such devices, even small Cortex-M ones, running lwip and a simple web, are able to get a dynamic address via DHCP.

    If the device is headless (i.e. has no display), how can you tell the address, so you can point your browser to it, or to open a ssh session?

    Although this seems a minor problem, it is a real one. For example I have a J-Link with Ethernet, and to use it in Eclipse, I need to configure the IP address. When I asked SEGGER how to get it, I was suggested to check the router DHCP allocation table, but my Apple router does not provide access to this information, and up to know I could not use the expensive J-Link probe.

    One workaround is to configure the DHCP server to allocate a static IP address, based on the MAC address, so at least the address will not change over time.

    Although it depends on the type of the application, for devices that provide server type services, regardless of the protocol, the correct solution is to use a discovery protocol, and Bonjour (https://en.wikipedia.org/wiki/Bonjour_(software)) is such a good example.

    Like

  2. Pingback: Installing openHAB Home Automation on Raspberry Pi | MCU on Eclipse

  3. Hello Erich,
    When using the Raspberry Pi with a HDMI screen it works, bun when using it headless, it doesn’t work. There is a workaround. You can use raspberry’s hostname to SSH into it, and then run ifconfig. For example, I have set my Raspberry’s hostname to AlexPi, and I can connect to it with PuTTY writing the hostname instead of the IP adress.

    Alex

    Like

      • Yes, you surely can check that, but sometimes you do not have the password for the router. If you use the Pi in a university or a school you don’t always have the acces to the DHCP table.

        Alex

        Like

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.