connecting Raspberry Pi with your Laptop/host machine

Buy Samsung Galaxy S Duos S7562 from Flipkart.com

In order to connect your Raspberry Pi and laptop, you could do it in two ways,

  • router based connection.
  • peer to peer connection.

Router Based Connection

In this type of connection it is assumed that your laptop is already in the network, lets say  your ip to be 192.168.1.3 and you machine has ssh support.Now in Raspberry it is important that it has ssh support as well. Connect your raspberry pi into the router using a network cable, your raspberry will now have an ip address that was provided by the dhcp server. our next step is to find out the ip address of raspberry pi. In order to get the ip address of raspberry pi we could type ifconfig and look for “inet addr: x.x.x.x”  if your raspberry is connected to a monitor. else if it is headless ( without a monitor) then we could look at the ip table of your router by seeing who is connected to the network. now that we know the ip address we could do the following from host machine

$ ssh pi@192.168.1.3

where 192.168.1.3 is the ip address of Raspberry provided by dhcp server.

Peer To Peer Connection

In a peer to peer based connection the Raspberry and host machine is directly connected to each other using a network cable. In order to do this we need static ip’s at both the ends. so we need to make the following change in /etc/network/interfaces file host machine, (note: dont forget to take a backup of /etc/network/interfaces file)

$sudo vim /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.10.2
netmask 255.255.255.0

add the above shown line to the file.

do the same in Raspberry pi as well but the only difference is that the ip address should be 192.168.10.3,  note that the network id 192.168.10 should remain same.

after doing this restart the network service by typing the command or by restarting the machine.

$sudo /etc/init.d/networking restart.

then do a

$ssh pi@192.168.10.3

and now it will ask for password, provide the password. So you are now logged it to raspberry pi via ssh.

Advertisements

2 thoughts on “connecting Raspberry Pi with your Laptop/host machine

  1. This doesn’t work for me. ssh keeps saying “no route to host”

    • Hi, This means that your machine is unable to detect the device, check if you have set the static ip correctly, then please wait for some time since RPi device takes some time to allow the ssh service.
      try “ping x.x.x.x” ( i.e RPi’s ip) and see if it is connected.

Hi, Thanks for your valuable comments.

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s