Headless use of Raspberry pi on Windows / Ubuntu

Headless connection is a method that is mostly needed to use raspberry pi with just ethernet socket and power plug. Which means, hdmi or dvi display , keyboard and mouse is not needed.
To do this you will need to follow the 3 steps
Requirements:
– Raspberry pi with working raspbian os installed on Micro-SD (for directions on installing raspbian using ubuntu os click http://goo.gl/Fqd9Q0).
– Either Ethernet switch/Router with working internet access or windows pc with virtual router software named connectify or any alternatives installed.
– Raspberry power supply with 1 Amps and 5 volt.( power sources with lower Amps might result in unexpected reboot of the pi)

Step1: Boot up the pi with a working internet connection via lan (lan connection is a must for first time as wlan or usb-3g needs to be configured for first time)

Step2: After few seconds its expected that the pi has booted successfully, even though we cannot see and display response.

Step2.1: READ ONLY IF A ROUTER/SWITCH IS NOT AVAILABLE AT HAND AND YOU BADLY NEED TO USE THE PI USING A WINDOWS 7 PC.
Install the virtual router software named connectify (download). Once installed, use it to set the ethernet port of the laptop as a dhcp server in other words share internet via ethernet port option should be enabled. Once its done connect the raspberry pi to pc via lan cable. Then powerup/restart the pi.The connectify will show the ip address of the raspberry pi. For example 192.168.XXX.XXX. Note down this address and go to Step3
headless1

Step2.2 FOR THOSE WITHOUT ROUTER/SWITCH AND WITH UBUNTU OS
This method is tried on ubuntu 12.04 and might work for other versions to.  Connect the pi to ubuntu pc via lan cable. At this moment, both the pc and the pi expects to get an ip address set by the dhcp server. But both the pi and pc are dhcp clients. The pc should act like a dhcp server to give pi an ip address. To do this go to network manager—edit connections. Under the wired connection tab a new “wired connection1” is created after pi is connected. Click edit—IPv4 Settings—Method . Change it from ‘Automatic DHCP’ to ‘Shared to other computers’. Once done the pc shows indication that the ‘Wired Connection 1’ is connected. At this moment the network available on UBUNTU is shared to Raspberry pi and the pi gets an ip address. One cannot simply assume 192.168.xxx.xxx as this is not the range of ip addresses served by ubuntu’s dhcp server. To know this range click network manager icon—Connection Information—‘Wired connection 1’.
headless1
Note down the ip address of the Ubuntu pc. It is usually 10.42.0.1. Thus the ubuntu pc now acts as a router with its ip address 10.42.0.1, and gives all clients an ip address on 10.42.0.X( where X any number other than 1).
To get the pi’s ip address there are 2 options.
Step2.2.1: FIRST OPTION IS TO FIND THE IP ADDRESS USING THE NMAP COMMAND IN TERMINAL.
Type

sudo nmap -sP 10.42.0.2-254

command in terminal and it shows the dhcp client address. For more details about the NMAP command go to http://goo.gl/39HsMX.

headless8 The images shows NMAP scan report for 10.42.0.37 which is the pi’s ip address. Now proceed to Step3.

Step2.2.2: SECOND OPTION IS TO SET A STATIC IP FOR THE PI: for example 10.42.0.10. To do this go to http://goo.gl/O7m0zq. Once an ip address is set proceed to step 3. Later in case you do not want static ip and want to switch back to dynamic ip address, then reinsert the microsd back to ubuntu like u did in the begenning of Step 2.2 and undo all changes you have made to the ‘interfaces’ file in the link http://goo.gl/O7m0zq.

Step2.3: FOR THOSE WITH ROUTER/SWITCH AND WITH WIN7/UBUNTU
Connect the pc and raspberry pi to the same router. And power-up/restart the pi. Log on to the router/switch with its preset ip address (192.168.1.1 or 192.168.2.1 or whatever is ur routers ip address. All routers have a option to find its dhcp client list. It shows the ip address of the pc and of the pi. Note down the pi’s ip address.

Step3: Once the ip address of the pi is known, us ssh client softwares such as putty for windows/Linux. ssh can also be done using the terminal of the ubuntu. By default ssh server of the pi is enabled. Thats why it is important to connect lan cable prior to booting up the pi.

In case you are using putty(windows/ubuntu),enter the ip address and port:22 of the pi and begin ssh.
headless5

headless6
Click ‘ACCEPT’ if prompted. Default username:pi and password :raspberry.
headless7

Incase you are using terminal(ubuntu) to do ssh then enter the command
ssh 10.42.0.X -l pi
headless2
and then enter the password :raspberry.
headless3

Once ssh is successful, using putty or terminal, remote desktop can be done. To install remote desktop server type the command sudo apt-get install xrdp in pi’s terminal obtained by ssh into it. Type y(yes to install).
headless4
Then the remote desktop or ssh can be accessed from any computers on local network.
To poweroff the pi do not remove the power plug as it will corrupt the os in the sd card. Type sudo poweroff , and to exit/log-off from ssh type exit.
During power-off once all led indicators of pi are off, unplug the pi…

Advertisements
This entry was posted in Debian, Networking, Raspberry pi and tagged , , , , , , , , . Bookmark the permalink.

2 Responses to Headless use of Raspberry pi on Windows / Ubuntu

  1. petoetje59 says:

    Unfortunately, when you try to use XRDP from Windows’s Remote Desktop Connection the keyboard mapping is wrong – as there is no longer any physical keyboard attached to the headless Raspberry Pi, it reverts back to US layout. How to fix that ? SSH from PuTTY works fine though.

  2. prasanpro says:

    It is really helpful. I really appreciate the effort being made and now I am able to connect my raspberry through my laptop and even access Rasbian GUI through VNC server.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s