Raspberry Pi networking notes for connecting directly to laptop

If running normal raspbian edit the file /etc/network/interfaces to add in two blocks:

iface eth0 inet dhcp

and

iface eth0 inet static
    address 169.254.210.230
    netmask 255.255.0.0

Comment out the block not in use. For networks that have a dhcp server running use the first block, for connecting to a Windows computer via a private network use the second (If Windows connects to a network, is set to obtain an address automatically and can’t get one then it self-assigns a 169.254.x.y address). Static address can be anything of the formĀ 169.254.x.y.

Full example file:

# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0

# Comment out this block when connected to laptop
#iface eth0 inet dhcp

# Comment out this block when connected to building network (or any network with dhcp)
iface eth0 inet static
   address 169.254.210.230
   netmask 255.255.0.0


allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Published by

Jamie Scott

IT Administrator at the Institute for Gravitational Research, University of Glasgow