How To Find The Host Name and IP Address For A Raspberry Pi

This post will describe how to find the host name and IP address of your Raspberry Pi. You can use the host name or the IP address to communicate with the Raspberry Pi from other computers on your network (like your laptop). For this reason, it is important that you be able to find the host name and IP address for a Raspberry Pi.

Every device on the network has a host name which is a user friendly name you set for the device. When you configured the Raspberry Pi you set the host name. If you left the default value I would highly recommend setting a unique host name for several reasons:

  • For security reasons, why let an outside hacker know your host name when you can easily create your own.
  • You will almost certainly end up owning more than one Raspberry Pi so they need to have different names on your network. I would suggest using a name that reflects the purpose of your project (i.e. is it a robot, weather station, etc) followed by a couple of digits like 01 because it is also likely you will have projects with multiple Raspberry Pi’s.

How To Find The Host Name On A Raspberry Pi

If you can access the Raspian GUI then the easiest way to find the hostname is to bring up the Raspberry Pi configuration screen.

Click the applications icon (the Raspberry Pi icon), then Preferences, then Raspberry Pi Configuration. This will display the configuration screen (see below)…

Raspberry Pi Host Name
Raspberry Pi Host Name

The hostname is displayed at the top – in this case “RP0-001”. You can also change your host name on this dialog box.

If you can’t get to the Raspian GUI then simply SSH into your Raspberry Pi. Since I’m using Windows I have PuTTY installed and use that to “shell into the pi”. We review how to install and use PuTTY in this post. Bring up a secure shell window using PuTTY on your windows system and you should see something like below…

Secure Shell Host Name
Secure Shell Host Name

I circled the command prompt which typically contains the userid and the host name of the logged in user. Note at the top of the screen that SSH displayed some basic info about the computer you logged into including “RP0-001” which is the host name.

How To Find The IP Address Of A Raspberry Pi Using The Ping command

Assuming your RPi is connected to your network you can easily find it’s IP address using the Ping command from your laptop. A typical setup at home will have the RPi connected directly to your router with an ethernet cable or you have configured WIFI on the RPi to connect to your home WIFI network. The screen shot below shows a windows command line terminal with the results of the ping command.

PINGIPV6
PINGIPV6

Start a windows command line on your laptop or computer.

Enter “ping host-name” and press enter. In the example above I entered ping RP0-001. Use your RPi hostname instead.

The results include a number of “reply from” lines which show the IP V6 address that is responding to the ping command.

Reply from 2603:9000:c404:6e00:934e:bfa2:a438:3899

The bold part above is the IP V6 ip address of the RPi responding to the ping command. Wow, that’s a lot of numbers and letters. Nobody wants to enter that into anything so let’s get the IP V4 ip address instead.

Enter “ping -4 host-name” where host-name is hour RPi host name and press enter. Notice the “-4” in the command. You will see results like below.

PINGIPV4
PINGIPV4

Notice this time we get the older IP V4 ip address 192.168.0.3. That’s a little easier to deal with when you need to enter an IP address to connect to the RPi.

Finally

So that’s how you can find the host name and IP address of your Raspberry Pi. You might need this info when configuring other options on the RPi or another network device.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How Convert A Live Stream Podcast To Text

Next Post

How To Setup The Thonny Python IDE On Windows