RPi Car Computer Part 4: How to give your Raspberry Pi a Static IP Address

Raspberry Pi LogoIn this part of the tutorial we will focus on how to give your Raspberry Pi a static IP address in your network. We set up remote access to our Pi, now we will set up a static IP address so whenever we turn it on and it connects to our network it will always obtain the same IP address so we will always know what IP we want to connect to via remote desktop.


First we are going to need some information from our network before moving forward.

So fire up your Pi, open a terminal and follow through.

Type ifconfig in the terminal.

This will show your router information. If you are connected via WiFi then what you need will be after wlan0

if you are connected via ethernet it will be after eth0.

Write down the following (also putting my networks details for our example)

inet addr – (Pi’s Current IP Address)

Bcast – (The Broadcast IP Range)

Mask – (Subnet Mask Address)


Now we need a few more information after this. Type netstat -nr in the terminal. From this we will need the following:

We need:

Gateway Address –

Destination Address –

So now it’s time put our desired data in the Pi Configuration. Type the following in the terminal

sudo nano /etc/network/interfaces

Now change iface wlan0 inet dhcp to iface eth0 inet static i

Then directly underneath that line put the following.


The address you want to give your Pi, this can be any IP in the network range, but it’s usually advisable to go higher rather than lower, or you could end up logging different devices to the same IP! I’ve selected as it is really high up in the range but in fact it can be any IP ranging from up to 192.168.255 (based on the details I gathered on my setup using the above commands).

The rest lines are simply the details we gathered above






Now we need to remove any existing leases by executing

sudo rm /var/lib/dhcp/*

and now we just reboot and we are all setup.

Please follow and like us:

Leave a Reply