How it works...

When we enable ICS on the primary computer, the operating system will automatically allocate a new IP address to the computer. Once connected and powered up, Raspberry Pi will set itself to a compatible IP address and use the primary computer IP address as an Internet Gateway.

By using Apple Bonjour, we are able to use raspberrypi hostname to connect to Raspberry Pi from the connected computer.

Finally, we check whether the computer can communicate over the direct network link to Raspberry Pi, back the other way, and also through to the internet.

Get Raspberry Pi 3 Cookbook for Python Programmers - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.