Regular Ethernet cable + RPI 2 + Raspbian Jessie 2016-05-27 + Ubuntu 16.04 host
Link the Ethernet cable from your laptop directly to the Pi.
On Ubuntu open Dash, and go:
- Network Connections
- Add
- Ethernet
- Create
- IPv4 Settings
- Method: Shared to other computers
- Set a good name for it
- Save
Find the IP of the Pi on Ubuntu:
cat /var/lib/misc/dnsmasq.leases
Then as usual:
ssh pi@IP
The crossover cable is not required if the host network card supports Auto MDI-X. This is the case for most recent hardware, including for example the 2012 Lenovo T430 I tested with, which has an "Intel® 82579LM Gigabit Network Connection" which documents support for Auto MDI-X.
Now you can also:
- access the Internet from the PI through your Ubuntu's Wifi connection
- open a VNC to get rid of the display as well: How to set up Raspberry Pi without a monitor?
This is a more concise version of: http://www.interlockroc.org/2012/12/06/raspberry-pi-macgyver/ which was mentioned by: https://raspberrypi.stackexchange.com/a/4294/33424
Ubuntu 17.04 host
There is a packaging bug in this Ubuntu version which breaks the network sharing: https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1678606
To fix it, simply do:
sudo apt-get install dnsmasq-base
Learned from: Ubuntu 17.04 direct shared Ethernet connection fails with "Active connection could not be attached to the device."