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

Networking directly to a laptop or computer

It is possible to connect Raspberry Pi LAN port directly to a laptop or computer using a single network cable. This will create a local network link between the computers, allowing all the things you can do if connected to a normal network without the need for a hub or a router, including connection to the internet, if Internet Connection Sharing (ICS) is used, as follows:

Make use of Raspberry Pi, with just a network cable, a standard imaged SD card, and power.

ICS allows Raspberry Pi to connect to the internet through another computer. However, some additional configuration is required for the computers to communicate across the link, as Raspberry Pi does not automatically allocate its own IP address.

We will use the ICS to share a connection from another network link, such as a built-in Wi-Fi on a laptop. Alternatively, we can use a direct network link (refer to the Direct network link section under the There's more... section) if the internet is not required or if the computer has only a single network adapter.

Although this setup should work for most computers, some setups are more difficult than the others. For additional information, see www.pihardware.com/guides/direct-network-connection .