Skip to content

Commit a5bb9df

Browse files
pietrodnJamesH65
authored andcommitted
mDNS method for discovering IP address (raspberrypi#787)
* mDNS method for discovering IP address Addition to ip-address.md * Update ip-address.md: clarification on hostnames * copy edits
1 parent 655aa0d commit a5bb9df

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

remote-access/ip-address.md

+25-3
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,40 @@ It is possible to find the IP address of your Pi without connecting to a screen
1818

1919
In a web browser navigate to your router's IP address e.g. `http://192.168.1.1`, which is usually printed on a label on your router; this will take you to a control panel. Then log in using your credentials, which is usually also printed on the router or sent to you in the accompanying paperwork. Browse to the list of connected devices or similar (all routers are different), and you should see some devices you recognise. Some devices are detected as PCs, tablets, phones, printers, etc. so you should recognise some and rule them out to figure out which is your Raspberry Pi. Also note the connection type; if your Pi is connected with a wire there should be fewer devices to choose from.
2020

21+
### Resolving `raspberrypi.local` with mDNS
22+
23+
On Raspbian, [multicast DNS](https://en.wikipedia.org/wiki/Multicast_DNS) is supported out-of-the-box by the [Avahi](https://en.wikipedia.org/wiki/Avahi_(software)) service.
24+
25+
If your device supports mDNS, you can reach your Raspberry Pi by using its hostname and the `.local` suffix.
26+
The default hostname on a fresh Raspbian install is `raspberrypi`, so by default any Raspberry Pi running Raspbian responds to:
27+
28+
```bash
29+
ping raspberrypi.local
30+
```
31+
32+
If the Raspberry Pi is reachable, `ping` will show its IP address:
33+
34+
```
35+
PING raspberrypi.local (192.168.1.131): 56 data bytes
36+
64 bytes from 192.168.1.131: icmp_seq=0 ttl=255 time=2.618 ms
37+
```
38+
39+
If you change the system hostname of the Raspberry Pi (e.g., by editing `/etc/hostname`), Avahi will also change the `.local` mDNS address.
40+
41+
If you don't remember the hostname of the Raspberry Pi, but have a system with Avahi installed, you can browse all the hosts and services on the LAN with the [`avahi-browse`](https://linux.die.net/man/1/avahi-browse) command.
42+
2143
### nmap command
2244

23-
The `nmap` command (Network Mapper) is a free and open-source tool for network discovery, available for Linux, Mac OS, and Windows.
45+
The `nmap` command (Network Mapper) is a free and open-source tool for network discovery, available for Linux, macOS, and Windows.
2446

2547
- To install on **Linux**, install the `nmap` package e.g. `apt-get install nmap`.
2648

27-
- To install on **Mac OS** or **Windows**, see the [nmap.org download page](http://nmap.org/download.html).
49+
- To install on **macOS** or **Windows**, see the [nmap.org download page](http://nmap.org/download.html).
2850

2951
To use `nmap` to scan the devices on your network, you need to know the subnet you are connected to. First find your own IP address, in other words the one of the computer you're using to find your Pi's IP address:
3052

3153
- On **Linux**, type `hostname -I` into a terminal window
32-
- On **Mac OS**, go to `System Preferences` then `Network` and select your active network connection to view the IP address
54+
- On **macOS**, go to `System Preferences` then `Network` and select your active network connection to view the IP address
3355
- On **Windows**, go to the Control Panel, then under `Network and Sharing Center`, click `View network connections`, select your active network connection and click `View status of this connection` to view the IP address
3456

3557
Now you have the IP address of your computer, you will scan the whole subnet for other devices. For example, if your IP address is `192.168.1.5`, other devices will be at addresses like `192.168.1.2`, `192.168.1.3`, `192.168.1.4`, etc. The notation of this subnet range is `192.168.1.0/24` (this covers `192.168.1.0` to `192.168.1.255`).

0 commit comments

Comments
 (0)