Getting Started with Python for the Internet of Things
上QQ阅读APP看书,第一时间看更新

There's more...

If you find yourself using your Raspberry Pi regularly on the network, you won't want to have to look up the IP address each time you want to connect to it.

On some networks, you may be able to use Raspberry Pi's hostname instead of its IP address (the default is raspberrypi). To assist with this, you may need some additional software, such as Bonjour, to ensure hostnames on the network are correctly registered. If you have macOS X, you will have Bonjour running already.

On Windows, you can either install iTunes (if you haven't got it), which also includes the service, or you can install it separately (via the Apple Bonjour Installer available from https://support.apple.com/kb/DL999). Then you can use the hostname, raspberrypi or raspberrypi.local, to connect to Raspberry Pi over the network. If you need to change the hostname, then you can do so with the Raspberry Pi configuration tool, shown previously.

Alternatively, you may find it helpful to fix the IP address to a known value by manually setting the IP address. However, remember to switch it back to use DHCP when connecting to another network.

Some routers will also have an option to set a Static IP DHCP address, so the same address is always given to Raspberry Pi (how this is set will vary depending on the router itself).

Knowing your Raspberry Pi's IP address or using the hostname is particularly useful if you intend to use one of the remote access solutions described later on, which avoids the need for a display.