Question 2.4: Setting the Network Name of a Raspberry Pi You want to chang......

Setting the Network Name of a Raspberry Pi

You want to change the network name of your Raspberry Pi so that it’s not just called “raspberrypi.”

Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

Changing the name of your Pi is pretty straightforward. There are just two files that need to be changed.

First, edit the file /etc/hostname. You can do this by opening a Terminal window and typing the command:

$ sudo nano /etc/hostname

Replace “raspberrypi” with a name of your choice. This should remain one word, without any punctuation or unusual characters. This includes the _ character.

Second, open the file /etc/hosts in an editor using the command:

$ sudo nano /etc/hosts

The file will look something like this:

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 raspberrypi

Change the text at the end that uses the old name (“raspberrypi”) to the new name.

Restart the Pi, and you should find that the name has changed when you view it on the network from another computer.

Discussion

Changing the name of your Pi can be very useful, especially if you have more than one Pi connected to your network.

See Also

See also Recipe 2.3 to change the IP address of your Raspberry Pi.

Related Answered Questions

Question: 2.12

Verified Answer:

Use CUPS (Common Unix Printing System). Start by e...
Question: 2.5

Verified Answer:

Setting up a wireless connection is very easy if y...
Question: 2.8

Verified Answer:

Install a VNC (Virtual Network Connection) server....
Question: 2.7

Verified Answer:

The easiest way to set up SSH on the Raspberry Pi ...
Question: 2.3

Verified Answer:

To set the IP address of your Raspberry Pi, whethe...