texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Identifying the Pi over the network

Wed May 30, 2012 5:49 pm

If I take a look at my router by pointing my browser to 192.168.0.1 there is a page that shows what is currently connected to it, with
ip addresses and ID's. However the Pi is 'UNKNOWN'. How can I change it so that it is known as 'Raspberry Pi'?

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
RPiDevelopers
Posts: 9
Joined: Fri May 18, 2012 1:41 pm
Contact: Website

Re: Identifying the Pi over the network

Wed May 30, 2012 6:09 pm

Well just like any network device it can be assigned or configured to have a hostname. Honestly I don't know how the Pi is configured by default but you should be able to configure it's hostname using the following command:

Code: Select all

~$ hostname myrpi
This will name the device "myrpi". This should get recognized by the router next time it assigns your Pi an IP address.
RPiDevelopers
Forge site dedicated to the Raspberry Pi, powered by a state of the art CDN capable of supplying hundreds of downloads daily. Host your RPi Projects with us!

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Identifying the Pi over the network

Thu May 31, 2012 5:52 pm

Thanks. Well that's the theory, but my router still see's it as UNKNOWN.
The hostname is set to raspberrypi by default without having to actually set the hostname manually as there is
a hostname in the /etc/ folder with raspberrypi in it.

Maybe my router needs a reset?
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
RPiDevelopers
Posts: 9
Joined: Fri May 18, 2012 1:41 pm
Contact: Website

Re: Identifying the Pi over the network

Thu May 31, 2012 5:56 pm

Yeah, restart the router. It should rediscover the network, and identify your Pi.
RPiDevelopers
Forge site dedicated to the Raspberry Pi, powered by a state of the art CDN capable of supplying hundreds of downloads daily. Host your RPi Projects with us!

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Identifying the Pi over the network

Thu May 31, 2012 6:01 pm

You need a bit more than that. By default the RPi does not broadcast its name.

Edit the DHCP client configuration to send a hostname, as follows...

sudo nano /etc/dhcp/dhclient.conf

Add the line
send host-name "raspberrypi";

You can force a refresh by disabling/enabling the ethernet port
sudo ifdown eth0
sudo ifup eth0

I hope this works....

User avatar
grumpyoldgit
Posts: 1452
Joined: Thu Jan 05, 2012 12:20 pm

Re: Identifying the Pi over the network

Thu May 31, 2012 6:02 pm

I think we've been down this path before.
My Pi also does not have a hostname.
I tried to apply a fixed ip address from the router using the mac code but the Pi just doesn't like it.
I've not tested it but the explanation given to me at the time was that the Pi generates new mac codes so trying to tie it down will end in tears.

User avatar
RPiDevelopers
Posts: 9
Joined: Fri May 18, 2012 1:41 pm
Contact: Website

Re: Identifying the Pi over the network

Thu May 31, 2012 6:13 pm

grumpyoldgit wrote:Pi generates new mac codes
That can't be true the Pi, just like all other networked machines have a encoded/enforced MAC address, unless your spoofing. The MAC address has been assigned in the factory and can't be changed.

EDIT: You seem to be right: link.
Last edited by RPiDevelopers on Thu May 31, 2012 6:19 pm, edited 1 time in total.
RPiDevelopers
Forge site dedicated to the Raspberry Pi, powered by a state of the art CDN capable of supplying hundreds of downloads daily. Host your RPi Projects with us!

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Identifying the Pi over the network

Thu May 31, 2012 6:18 pm

Yes and my router always sees my pi as ip 8 when hard wired and 11 wireless so it must be fixed.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
grumpyoldgit
Posts: 1452
Joined: Thu Jan 05, 2012 12:20 pm

Re: Identifying the Pi over the network

Thu May 31, 2012 6:19 pm

RPiDevelopers wrote:
grumpyoldgit wrote:Pi generates new mac codes
That can't be true the Pi, just like all other networked machines have a encoded/enforced MAC address, unless your spoofing. The MAC address has been assigned in the factory and can't be changed.
I was surprised when I read it. This is one of the threads that mention it.

http://www.raspberrypi.org/phpBB3/viewt ... f=6&t=5486

Oops. We've found the same thread!

MrEngman
Posts: 4016
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Identifying the Pi over the network

Sun Jun 03, 2012 2:55 pm

texy wrote:Yes and my router always sees my pi as ip 8 when hard wired and 11 wireless so it must be fixed.
Texy
Did you try this updated version of dhcp. I had the same issue and it sorted it out for me. Automatically grabs the host name from the /etc/hostname file.

Code: Select all

wget http://http.us.debian.org/debian/pool/main/i/isc-dhcp/isc-dhcp-common_4.2.2.dfsg.1-5_armel.deb
wget http://http.us.debian.org/debian/pool/main/i/isc-dhcp/isc-dhcp-client_4.2.2.dfsg.1-5_armel.deb

sudo dpkg -i isc-dhcp-common_4.2.2.dfsg.1-5_armel.deb
sudo dpkg -i isc-dhcp-client_4.2.2.dfsg.1-5_armel.deb
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Identifying the Pi over the network

Sun Jun 03, 2012 3:07 pm

No! Not until you, or someone else, tells me that it not break my wifi dongle ;-)
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Identifying the Pi over the network

Sun Jun 03, 2012 3:16 pm

grumpyoldgit wrote:I think we've been down this path before.
My Pi also does not have a hostname.
I tried to apply a fixed ip address from the router using the mac code but the Pi just doesn't like it.
I've not tested it but the explanation given to me at the time was that the Pi generates new mac codes so trying to tie it down will end in tears.
Agreed - on both points. Specificially:

1) Regarding the ideas put forth in this thread that giving your Unix machine (e.g., the Pi) a hostname will ensure that it shows up in your router's IP table. Not true. For example, on my Mac, I run "hostname" and it gives me sensible output. But when I look at the router's DHCP IP table listing, the host name field is blank (it is non-blank for my Windows PCs). The point of all of this is that I don't think posters can make blanket statements if the form "Well, if you do this on the Pi, everything will work.", because it is a function of lots of things - including the Unix(-ish) host, the router (which is itself almost certainly a Unix-ish host), your network topology and, probably also, the phase of the moon.

Also, I don't know if it has been mentioned yet, but there is a setting you need to have in your DHCP config file (on the Pi) that tells it to broadcast its IP name/address.

2) Obviously, the Pi shouldn't be changing its Mac address, but there have been postings in the past here suggesting that it sometimes does so. Beyond that, I cannot say.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

MauveGnome
Posts: 1
Joined: Sat Jan 28, 2012 2:07 pm

Re: Identifying the Pi over the network

Tue Jun 05, 2012 10:49 am

You need a bit more than that. By default the RPi does not broadcast its name.

Edit the DHCP client configuration to send a hostname, as follows...

sudo nano /etc/dhcp/dhclient.conf

Add the line
send host-name "raspberrypi";

You can force a refresh by disabling/enabling the ethernet port
sudo ifdown eth0
sudo ifup eth0

I would have to agree with bredman here. I had the exact same issue with the hostname not being automatically broadcast but once I edited my dhclient.conf and restarted the connection there it was. I would be very surprised if this isn't your solution.

User avatar
SN
Posts: 1014
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: Identifying the Pi over the network

Tue Jun 05, 2012 11:24 am

That dhcp conf file edit worked for me too
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

User avatar
praest76
Posts: 29
Joined: Fri Sep 02, 2011 11:33 am
Location: Newark on Trent, Nottinghamshire
Contact: Website

Re: Identifying the Pi over the network

Tue Jun 05, 2012 11:38 am

Code: Select all

send host-name = gethostname();
In /etc/dhcp/dhclient.conf Is probably better as it should send whatever you set it to with hostname.
PRAEst76 [about.me/praest76]
  • Pi¹ - xibalba: OpenELEC, media centre
    Pi² - erebus: Debian Sid, general shell
Raspberry Pi Last.fm group - last.fm/group/Raspberry+Pi

User avatar
grumpyoldgit
Posts: 1452
Joined: Thu Jan 05, 2012 12:20 pm

Re: Identifying the Pi over the network

Tue Jun 05, 2012 12:10 pm

I can confirm that the dhclient.conf edit worked for me too. I had the relevant page open on my router and updated the screen at each stage to see the ip address disappear and then come back with the raspberrypi hostname.

I thought the release and renew commands were particularly neat and have added them to my growing list of useful Linux commands

What it doesn't enable you to do is ping raspberrypi. It is still an unknown host.

MrEngman
Posts: 4016
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Identifying the Pi over the network

Tue Jun 05, 2012 12:22 pm

praest76 wrote:

Code: Select all

send host-name = gethostname();
In /etc/dhcp/dhclient.conf Is probably better as it should send whatever you set it to with hostname.
I agree. And if you want to change hostname you only need to edit hostname, and not /etc/dhcp/dhclient.conf as well.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Identifying the Pi over the network

Tue Jun 05, 2012 12:34 pm

praest76 wrote:

Code: Select all

send host-name = gethostname();
In /etc/dhcp/dhclient.conf Is probably better as it should send whatever you set it to with hostname.
This would be nice, but only works with the latest version of dhclient. Does anybody confirm that this works with the RPi Debian build?

User avatar
praest76
Posts: 29
Joined: Fri Sep 02, 2011 11:33 am
Location: Newark on Trent, Nottinghamshire
Contact: Website

Re: Identifying the Pi over the network

Tue Jun 05, 2012 12:41 pm

bredman wrote:
praest76 wrote:

Code: Select all

send host-name = gethostname();
In /etc/dhcp/dhclient.conf Is probably better as it should send whatever you set it to with hostname.
This would be nice, but only works with the latest version of dhclient. Does anybody confirm that this works with the RPi Debian build?
I'm running it, however I didn't check this prior to going to unstable so I can't confirm whether it works in the stable packages. Possibly not.
PRAEst76 [about.me/praest76]
  • Pi¹ - xibalba: OpenELEC, media centre
    Pi² - erebus: Debian Sid, general shell
Raspberry Pi Last.fm group - last.fm/group/Raspberry+Pi

MrEngman
Posts: 4016
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Identifying the Pi over the network

Tue Jun 05, 2012 1:17 pm

praest76 wrote:
bredman wrote:
praest76 wrote:

Code: Select all

send host-name = gethostname();
In /etc/dhcp/dhclient.conf Is probably better as it should send whatever you set it to with hostname.
This would be nice, but only works with the latest version of dhclient. Does anybody confirm that this works with the RPi Debian build?
I'm running it, however I didn't check this prior to going to unstable so I can't confirm whether it works in the stable packages. Possibly not.
If not apply these changes and it's automatically setup. Works with the Debian release on the downloads page and my script for setting up my wifi includes these so I don't have to worry about getting Pi to announce its hostname.

Code: Select all

wget http://http.us.debian.org/debian/pool/main/i/isc-dhcp/isc-dhcp-common_4.2.2.dfsg.1-5_armel.deb
wget http://http.us.debian.org/debian/pool/main/i/isc-dhcp/isc-dhcp-client_4.2.2.dfsg.1-5_armel.deb

sudo dpkg -i isc-dhcp-common_4.2.2.dfsg.1-5_armel.deb
sudo dpkg -i isc-dhcp-client_4.2.2.dfsg.1-5_armel.deb
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

xleon
Posts: 9
Joined: Mon Jun 04, 2012 11:37 am

Re: Identifying the Pi over the network

Tue Jun 05, 2012 11:05 pm

2) Obviously, the Pi shouldn't be changing its Mac address, but there have been postings in the past here suggesting that it sometimes does so. Beyond that, I cannot say.
I can confirm I've seen this - powered the PI on and off a few times (due to various instabilities I've had to work around) and each time it's appeared on my router with a new MAC address and hence, IP. So much so, I've had to drop DHCP and fix the address otherwise I can't guarantee I can find out without consulting the router table as I'm running the PI headless :-)

wrhii
Posts: 66
Joined: Fri Nov 18, 2011 1:47 am

Re: Identifying the Pi over the network

Tue Jun 05, 2012 11:38 pm

Any indication of whether this is a feature, or a bug?

My vote is for bug, but what do I know?

MrEngman
Posts: 4016
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Identifying the Pi over the network

Wed Jun 06, 2012 12:06 am

xleon wrote:
2) Obviously, the Pi shouldn't be changing its Mac address, but there have been postings in the past here suggesting that it sometimes does so. Beyond that, I cannot say.
I can confirm I've seen this - powered the PI on and off a few times (due to various instabilities I've had to work around) and each time it's appeared on my router with a new MAC address and hence, IP. So much so, I've had to drop DHCP and fix the address otherwise I can't guarantee I can find out without consulting the router table as I'm running the PI headless :-)
MAC addresses are normally fixed in the hardware, but can be changed using software commands. So is the issue of changing MAC addresses down to a wierd software issue - I think it's very likely.

Searching the internet I've seen various commands that can change the MAC address but cannot get any of them to change mine. Oh well!
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Identifying the Pi over the network

Wed Jun 06, 2012 6:45 am

Well despite the dhcp update procedure above, my pi is still 'UNKNOWN' by my Sky router. I seem to have a constant ip address unless I reset the router of course, but its still UNKNOWN. So in order to connect via putty or vnc, I put in the ip of the pi, not the name. Its no big deal to me, but I,d still like to get to the bottom of it.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
droople
Posts: 13
Joined: Tue Aug 28, 2012 6:07 am
Location: Earth

Re: Identifying the Pi over the network

Tue Sep 04, 2012 2:38 pm

texy wrote:Well despite the dhcp update procedure above, my pi is still 'UNKNOWN' by my Sky router. I seem to have a constant ip address unless I reset the router of course, but its still UNKNOWN. So in order to connect via putty or vnc, I put in the ip of the pi, not the name. Its no big deal to me, but I,d still like to get to the bottom of it.
Texy
I have the same issue :(
Spent more money on an HDMI monitor than on Raspberry Pi

Return to “Networking and servers”