Friday, February 15, 2013

Raspberry PI - hostname settings

Default hostname in raspbian
The default hostname set in raspbian is "raspberrypi". You can find and modify it in following file:

\etc\hostname


Out of the box, Raspberry PI is not recognized from windows when pinging via it's default hostname and PI is not able to ping windows machines.

Access Raspberry PI from windows
In this case, it is due to the fact that samba is not installed by default in raspbian.
To install samba type:

sudo apt-get install samba

you can try to ping PI from windows to check if it worked:

ping raspberrypi


Access windows machines from Raspberry PI
In this case installing winbind will do the trick:
To install winbind type:

sudo apt-get install winbind

then modify file /etc/samba/smb.conf


change:
workgroup = HOMENETWORK

modify file /etc/nsswitch.conf

change the line
"hosts: files dns"
to
"hosts: files dns wins"

after that you can try to ping your windows machine from raspberry terminal to check if everything worked fine:

ping [winmachine_host_name]

after that, you can access your machines by host name

2 comments:

  1. Works perfectly well. This problem is mentioned by a lot of people but this is the only working solution. Thanks!
    I thought it was a DNS problem and I still don't understand why it didn't work without samba and winbind...

    ReplyDelete
  2. Thanx, I had also trouble to get it working, so after I figured it out I just wrote this tutorial.

    ReplyDelete