Raspberry Pi Tutorials : how to assign static IP and change hostname

Making a Raspberry Pi cluster requires an initial setup to be performed. Here I assume that the OS that is running is Raspbian. So once the cluster is built generally one Raspberry pi designated as the  master node controls the functionality of all the other nodes. So this post deals with how the master node connects to or other nodes ,how you can use the master node to login to any other node in the cluster, how to assign static IP address and how to differentiate each of the nodes from the other by assigning different hostnames.

Assigning static IP address :

The first thing that has to be done is assign static IP address to each PI . This helps to connect to other PIs(nodes) via SSH (Secure Shell) . So first use the command :

ifconfig

This lists all the IP addresses. My result of running the command ifconfig was :

inet addr: 192.168.3.2 bcast addr: 192.168.3.255 mask:255.255.255.0

Make a note of these addresses. So, from the above result, the inet address indicates the IP address of the node. What we do now is assign addresses to each node. The first step in it is to decide a range of IPs . I had 5 nodes and so I decided to take the range 192.168.3.215 to 192.168.3.219 . Once the range is fixed login to one of the PIs.
Also, make a note of the gateway address by typing the following command

sudo route -nee

Gateway: 192.168.3. 1

The final step is to modify the interface file :

sudo nano /etc/network/interfaces

Remove the line that reads

iface eth0 inet dhcp

Add the following:

iface eth0 inet static
address 192.168.3.215 #change according to your range
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.3.255
gateway 192.168.3.1

save by pressing CTRL+X and then type Y to save and exit. then reboot the PI using :

sudo reboot

Type the following command to ping your gateway address or router and will return :

ping 192.168.3.1  -c3

The response should look somewhat like this :

64 bytes from 192.168.1.254: icmp_req=1 ttl=255 time=2.18
64 bytes from 192.168.1.254: icmp_req=2 ttl=255 time=2.43
64 bytes from 192.168.1.254: icmp_req=3 ttl=255 time=3.24

 

Learn  how to make your Bench Automation Raspberry Pi computer now!!!

 
One last thing that needs to be modified is the /etc/resolv.conf file. This file contains information of DNS name resolvers that allow your raspberry pi to resolve names to IP addresses. For example, if you ping http://sourcedexter.com, the raspberry pi will have to determine the IP address of my python tutorials website,

Enter the following command to edit the resolv.conf file:

sudo nano /etc/resolv.conf

Enter the follow Google public DNServer IP address:

nameserver 8.8.8.8
nameserver 8.8.4.4

Press CTRL-X to exit but remember to save the file by accepting the changes.

Now type ifconfig and the new IP will be the one you would have assigned.Repeat this for all the other nodes on the cluster individually.

 

Change the hostname manually

If SSH is not installed then the hostname can be changed manually by logging into each of the raspberry pi individually and changing the hostname file as :

sudo nano /etc/hostname

By default the content of the file is :

pi

change it to what you want. for example, if the new hostname should be client003 , then delete the existing name and type the new name :
client003
press CTRL+X followed by Y to save and exit. So from the next time you login the new hostname will be seen.

April2516-25off-sitewide300X250

 

SOURCE :   http://www.suntimebox.com/ ,  http://www.southampton.ac.uk/~sjc/raspberrypi/

Advertisements

ARM chips and their benefits in a Raspberry Pi

In the process of building a Raspberry Pi cluster, I came across a few libraries for inter-node communication. I was facing some issues while using these libraries and the errors weren’t one of the common ones associated with Raspberry Pis.  These libraries made use of a feature called Hard Floating Point computation and I wanted to know if my Raspberry PI supported it. So, this article is my understanding of ARM chips and its variants and how it all fits my cluster built using a Raspberry Pi.

ARM chips which are based on the RISC (Reduced Instruction Set Computer) architecture were developed by a British company called ARM Holdings. Since RISC allows components to be very small in size and lesser in number, you can find that the ARM chips are very small themselves and they don’t require any  external cooling. This is the main reason for most of the smartphones  today to have ARM chips in them.

ARM releases these chips in various versions . Among all of them, till ARM V7,  all chips supported only 32-bit architecture. But from ARM V8 onward, support was provided for 64-bit architecture as well. The major advantage of these chips is that it supports efficient multi-core computing and high core counts at lower costs.

Raspberry pi Model B supports multiple nodes to be connected and used in parallel. To achieve this, two variations of  ARM chips can be used. One is the ARMEL (ARM little endian) and the second ARMHF (Hard Floating) . ARMEL is used for soft floating points where the computation is restricted only to a certain level of floating point numbers but ARMHF, on the other hand, is a hard floating point architecture , giving more support to high floating point number computations during parallel computing. The  raspberry Pi comes with a support for ARMHF which is available for use through various ports provided by Raspbian (the Debian OS for raspberry Pi).

MPICH2 is a very good message passing library that makes parallel processing on a Pi possible but has packages only for ARMEL architecture. So, it’s wiser to use MPICH tools and build it within the raspberry Pi and utilize the ARMHF.

The Pi Model B has an ARM11 family of chips inside it. The ARM11 is based on the ARM V6 and is hence 32-bit architecture. This chip has a clock speed of 700 to 750 MHz but can be overclocked to 800 Mhz without a void in warranty. But the full overclocked speed is  around 1 GHz. The CPU, the GPU, and the RAM are on the same chip.  The CPU has a speed of 65 GFLOPS and the GPU of about 24 GFLOPS and  a 512 Mb RAM.

Overall, it’s a very efficient chip having power equivalent to a Pentium 2 processor and contributes greatly to the small size and low cost of the raspberry pi.

You can now learn to build cool applications with Raspberry Pis. Sign up and get the best resources to get started: Login to get the Course for $10