Monday, January 9, 2017

Connecting to your Raspberry Pi without monitor, keyboard and mouse. Quick start.

Connecting to your Raspberry Pi without monitor, keyboard and mouse. Quick start.

 About article

Imagine if you want your own Linux server for debugging and testing purpose. Of course you can buy VPS, but this is can be a little bit expensive for some cases. In this case you can use just Raspberry Pi which able to run Apache, Nginx, PostgreSQL.

So you need your RPi + PSU (Power Supply Unit) and RTC (preferred). 

But you need to configure your RPi, so you need keyboard, monitor, mouse, HDMI adapters and so on. Right? Wrong! Your do not need anything except RPi + PSU + RTC (optional).


Installing Raspbian and enabling SSH

First of all you need write OS (I like Raspbian) to SD card.

On Windows you can use Win32DiskImager which can be found on sourceforge.net.

After that you need enable SSH for modern versions of Raspbian. By default it is disabled (Ops, this is was surprise for me). So you need create file ssh in /boot. This file must be near files cmdline.txt and config.txt 

Yes, I know that Windows unable to view ext3/ext4 partitions, but /boot partition is FAT partition and visible in Windows. So you will be able to create this file.

This is can be just empty file. When Raspbian will start and will see this file, it will enable SSH for further usage.

Now you need plug Ethernet cable and turn on your RPi to your local network. When you will plug PSU RPi will start boot.

You can already connect to your RPi using SSH but you didn't know IP address.

Retrieving IP address

Now it's time to download SSH and Zenmap/nmap for Windows:
Let's find IP address of your RPi using Zenmap. By default RPi will get IP address, network mask and DNS using DHCP (w: DHCP)

When starting Zenmap (GUI for nmap) you need select Target and Profile

zenmap settings


Profile must be set as Ping scan.

Target depends on your networks settings, for example in my network computer have IP adresses 192.168.0.X and mask is 255.255.255.0 so my target will be 192.168.0.0/24 

If you have IP addresses like 192.168.1.X and mask 255.255.255.0 you target will be 192.168.0.1/24

Next you need click Scan and wait for some time. After that you will get some output and need to find "Raspberry Pi Foundation" string.

Example (some information was skipped for security reasons):

<skipped>
Nmap scan report for rpi-number08 (192.168.0.208)

Host is up (0.0050s latency).

MAC Address: B8:27:??:??:??:?? (Raspberry Pi Foundation)
<skipped>

In this case your RPi IP address is 192.168.0.208

Connecting using Putty

After calling Putty all you need is just enter IP address.

connecting using putty

Then you need click Open and permanently accept RPi key. After that you need enter login and password. By default Raspbian uses login pi and password raspberry.

Warning! Do not forget change your default password!

That's all!

Now you can update you system, install servers (nginx, postgresql, memcached, etc). If you want add RTC to your server you can follow these instructions: Installing hardware RTC (DS3231) to Raspberry Pi

Enjoy!










No comments:

Post a Comment