Tuesday 11 August 2015

[Raspberry Pi] Connecting to raspberry pi using ethernet cable on linux mint 17 laptop

This post has been created using various sources I found on google.

1. To directly connect to PI, without sharing internet
2. Sharing internet

SOURCE:
http://stackoverflow.com/questions/16040128/hook-up-raspberry-pi-via-ethernet-to-laptop-without-router
http://elinux.org/RPi_cmdline.txt
https://pihw.wordpress.com/guides/direct-network-connection/
http://www.linuxcircle.com/2013/05/03/connecting-rpi-to-laptop-ethernet/
https://www.youtube.com/watch?v=ZK-JHfJqmkY

1.1 If headless (no monitor and keyboard for pi), mount SD card on your laptop
1.2 Go to boot partition, append ip=169.254.0.2 and save
1.3 Go to main partition, modify /etc/network/interfaces as below
1.3.1 (Recommended) save a copy of interfaces file for other setup
1.3.2 (Above procedures can be done on the RPi OS once logged in)
------------------------------------------------------------------------------------------------------------
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 169.254.0.2
netmask 255.255.255.0
gateway 169.254.0.1

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



-----------------------------------------------------------------------------------------------------------
1.4 On laptop, click on network connections, add a new 'Ethernet' connection.
1.4.1 Name the connection as you like, go to IPv4 settings
1.4.2 Change Method: Manual, Add Addresses and set to 169.254.0.1
1.4.3 Netmask 255.255.255.0 Gateway 0.0.0.0



1.5 Reboot RPi and you can SSH using ssh pi@169.254.0.2








2.1 On laptop, click network icon. On drop down menu click network connections.
2.1.1 Name the new Ethernet connection as you wish, go to IPv4 tab
2.1.2 Change Method: Shared to other computers
2.1.3 Click this new connection on network dropdown menu
2.2 On laptop terminal, enter 'cat /var/lib/misc/dnsmasq.leases'
2.1.1 (Output looks like below, remember ip address)
----------------------------------------------------------------------------
1439123882 b8:27:eb:a1:b2:c3 10.42.0.39 raspberrypi
----------------------------------------------------------------------------

2.2 On raspberry pi, modify /etc/network/interfaces as below
--------------------------------------------------------------------------------------------------------
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 10.42.0.39
netmask 255.255.255.0
gateway 10.42.0.1
--------------------------------------------------------------------------------------------------------
2.3 Reboot OR if using keyboard and monitor 'sudo ifdown eth0' and 'sudo ifup eth0' to get new ip address
2.4 'ping www.google.com' to test the connection

No comments:

Post a Comment