Setting static ip for raspberry pi using Ubuntu pc

This article might be helpful for those who wants to set static ip for raspberry pi system using ubuntu os. Or without using raspberry pi itself. The below mentioned ip setting are valid if ubuntu is configured to share its network via eth0 interface, thus making ubuntu a dhcp server and pi a client.
To do this, all that is needed is a Ubuntu pc and MicroSD with raspbian OS installed.
In 3 steps it can be done.

Step1: FIND THE NETWORK INTERFACE FILE
Insert the MicroSD onto the Ubuntu installed Pc and 2 partitions will be opened. One of which is a FAT partition openable to windows system(~53MB) and the second is a EXT4 or similiar partition that is hidden to windows and visibe only on linux(~ rest size of the memory card). The image below shows both partitions opened once the raspbian installed microsd is inserted.
static1

Step2: EDIT THE NETWORK INTERFACE FILE
Open folder /etc/network/interfaces of the microSD.( be careful as the ubuntu pc also has same file in same location but different media). So carefully open the file. This file belongs to the owner “pi” of raspberry and cant be simply edited from the user of the ubuntu pi. So to edit this file press atl+f2 from ubuntu and enter gksu gedit.
static 2
Now you will be prompted to enter the passoword of the ubuntu admin account. Soon the text editor application is opened with super user permissions. Now open the earlier located file /etc/network/interfaces (of the MicroSD only) and edit the content.
static 3
You will see the line
iface eth0 inet dhcp , add a # before it
(#iface eth0 inet dhcp) and add the line
iface eth0 inet static . And below this line enter the following.
address 10.42.0.10 # the address you want your pi to have
netmask 255.255.255.0
network 10.42.0.0 # the address of the ubuntu system from connection manager->connection information
broadcast 10.42.0.255
gateway 10.42.0.254
then Save the file.
static4
In case you are not sure of any details leave a ‘#’ symbol before it to skip the execution of that line.

Step3: BOOT THE PI WITH THE EDITED INTERFACE FILE
Insert the MicroSD into the pi, and connect the pi back to the Ubuntu pc via lan cable. Once the ubuntu pc is set to share its network to other computers via lan cable, the pi gets a static ip address and network access via the ubuntu pc. This static ip address can be used to access the pi via ssh or rdp.
Once this is done you are good to go. To connect headlessly to the pi using ubuntu pc go to http://goo.gl/6mh2cr.
rpi_connect

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

2 Responses to Setting static ip for raspberry pi using Ubuntu pc

  1. Shreenivas says:

    Hey thanx for the great help..
    But I use a data card (Tata photon+ CDMA connection) as my Internet connection to my LINUX PC.. what should I enter in those lines in Network>> interfaces file??

    Thanx in advance

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