RaspberryPI - Find the MAC address and change the host name
We have been running Raspbberry PI nights at VHS the last few weeks and they have been going really well.
- Using the Raspberry PI to control a Arduino
- Raspberry PI + Python + WebIDE + GPIO pins = Blink sketch
We are running the Raspberry PIs headless (no keyboard or mouse, using SSH) because VHS only has one device capable of being used as a display (out projector) and asking people to bring in their monitors as well as their Raspberry PIs would be bothersome.
To run the Raspberry PI headless, we need to enable SSH and know the IP address of the Raspberry PI. Some distros like the Occidentalis come with SSH enabled by default. If your distro does not have SHH enabled you can follow these instructions to enable it Adafruits Raspberry PI Lesson 6 Using SSH
When people arrive they connect their Raspberry PIs to our network and DHCP an IP address from our router. The problem is that by default all the Raspberry PIs have the same hostname and its very hard to determine what Raspberry PI has what IP address.
If you know the MAC address of your Raspberry PI it makes it a lot easier to look up the MAC address in the router IP address tables. Or better yet change the Hostname of your Raspberry PI.
How to find the MAC address of your Raspberry PI/Linux Box
The MAC address is very useful for finding the IP address of your Raspberry PI if there are other Raspberry PIs on your network with the same Hostname. I would suggest writing this on your Raspberry PI case.
ifconfig -a | grep HWaddr
This will display a list of MAC address of your network devices currently installed on your system. Eth0’s MAC address should be prefixed with B8:27:EB.
eth0 Link encap:Ethernet HWaddr b8:27:eb:a1:b2:c3
In this example the MAC address is B8-27-EB-A1-B2-C3
How to change the Host Name of your Raspberry PI/Linux box
A host name makes it easy to find the device on your network when you do not know the IP address of your Raspberry PI.
sudo nano /etc/hostname (and enter the desired name, " CTRL+X" then " Y" to quit) sudo nano /etc/hosts and replace raspberry with the hostname you chose above sudo /etc/init.d/hostname.sh start (to enable the changes).
Instead of typing the IP address of your Rapsberry PI you can use the host name to connect to your device.
Leave a comment