raven_squire
Posts: 23
Joined: Fri Jun 29, 2012 8:39 am

Renaming my Pi

Tue Aug 07, 2012 11:52 am

Hello,

I have recently received my second pi in the mail and am not sure how to rename them so that they don't clash being on the same network.

I thought it was as simple as editing /etc/hostname in nano

This did largely work but I have noticed a few issues

1) When I close the desktop I notice error messages e.g. bad display name "serverpi:0" in "remove" command

2) When trying to download a package i get "-bash: syntax error near unexpected token ';;'"

3) My router shows both PIs as still being "RASPBERRYPI"


How do I change the name of the PI?

Is it necessary when using multiple PIs on a network?

Thanks

User avatar
RaTTuS
Posts: 9899
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Renaming my Pi

Tue Aug 07, 2012 12:33 pm

edit /etc/hosts and
/etc/hostname
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
M.M
Posts: 107
Joined: Fri Aug 03, 2012 7:40 am
Location: Hamburg, GER

Re: Renaming my Pi

Tue Aug 07, 2012 12:42 pm

EDIT: RaTTus was faster ;)

Hello raven_squire,

speaking at least from a Debian point of view, changing the hostname is as simple as possible:

Code: Select all

root@server:# hostname ServerXYZ
Concerning network communication you might also want to look into /etc/hosts, where machine names are matched to IP addresses. Since you only edited the /etc/hostname file the /etc/hosts file will surely still contain wrong information.

I would consider it necessary to change the name if you want to run both Pis in one network. Of course, network traffic is based on IP addresses and your network hardware does not care about names, but as soon as name resolution comes into play you will get into trouble.
"If people read the FAQs the Qs wouldn't be A F, would they?"

raven_squire
Posts: 23
Joined: Fri Jun 29, 2012 8:39 am

Re: Renaming my Pi

Tue Aug 07, 2012 1:21 pm

Thankyou gentlemen!!!
This worked fine. My router apparently has difficulties with name resolution as I saw it loose other names on DHCP devices. So this made the perfect opportunity to populate /etc/hosts
Thanks again!!
Thankyou gentelmen

Return to “Beginners”

Who is online

Users browsing this forum: Bing [Bot], gicts, mclzc, wh7qq and 68 guests