How To Give Your Raspberry Pi A Static IP Address
How To Give Your Raspberry Pi A Static IP Address
ModMyPi|TutorialHowtogiveyourRaspberryPiaStaticIPAddress
Login | Register
Select Language
cat /etc/network/interfaces
https://www.modmypi.com/blog/tutorialhowtogiveyourraspberrypiastaticipaddress
1/12
2/16/2016
ModMyPi|TutorialHowtogiveyourRaspberryPiaStaticIPAddress
The line . . . .
iface eth0 inet dhcp
Implies that we're currently getting out IP address via DHCP, meaning it's being dynamically registered by
the router. This is what we want to change!
B. Gathering Information
Fist of all we need to grab some information from our router and Pi. There's a couple of command we need to
run to get this info. Have a pen and paper handy! . . .
ifconfig
https://www.modmypi.com/blog/tutorialhowtogiveyourraspberrypiastaticipaddress
2/12
2/16/2016
ModMyPi|TutorialHowtogiveyourRaspberryPiaStaticIPAddress
This reveals your router information, the bit you want is after eth0 (the ethernet connection). . . .
eth0 Link encap:Ethernet HWaddr b8:27:eb:b3:fc:2c
inet addr:192.168.1.81 Bcast:192.168.1.255 Mask:255.255.255.0
Write down the following information. . .
inet addr 192.168.1.81 (Pi's Current IP Address)
Bcast 192.168.1.255 (The Broadcast IP Range)
Mask 255.255.255.0 (Subnet Mask Address)
We need a little more information before we proceed. Use the command. . .
netstat -nr
(route -n will give you the same info.)
https://www.modmypi.com/blog/tutorialhowtogiveyourraspberrypiastaticipaddress
3/12
2/16/2016
ModMyPi|TutorialHowtogiveyourRaspberryPiaStaticIPAddress
We need:
'Gateway' Address 192.168.1.254
'Destination' Address 192.168.1.0
C. Editing Network Configuration
We now need to plug this information into the Pi's network configuration file using a text editor. I always
use nano text editor. . .
4/12
2/16/2016
ModMyPi|TutorialHowtogiveyourRaspberryPiaStaticIPAddress
So, it should look something like the above, but with your values! Remember to save before exit, CTRL+X
(exit) then yes to save changes!
D. Re-check Static IP Configuration
UPDATE: Remove any existing leases
https://www.modmypi.com/blog/tutorialhowtogiveyourraspberrypiastaticipaddress
5/12
2/16/2016
ModMyPi|TutorialHowtogiveyourRaspberryPiaStaticIPAddress
sudo rm /var/lib/dhcp/*
Then we'll need to reboot and check your changes. . .
sudo reboot
Log back in and run
ifconfig
Which should reveal your new settings. .
ping 192.168.1.254 -c 10
(the -c 10 command simply denotes that you want to ping it 10 times, if you forget to add this, it will ping the
address continuosly. To stop it press CTRL+C)
https://www.modmypi.com/blog/tutorialhowtogiveyourraspberrypiastaticipaddress
6/12
2/16/2016
ModMyPi|TutorialHowtogiveyourRaspberryPiaStaticIPAddress
This should ping successfully and all packets should be recieved. If something's not right double check
through all your IP addresses, and make sure you're pinging the right address too. Remember you can
always revert back to DHCP by reversing the steps. The 'network' router IP address is sometimes a little
fiddly, so check that if you're still having issues!
Hopefully however, your Raspberry Pi is now set up with a static IP address!
Tags: raspberry-pi, static-ip, static, ip, address, static-ip-address, ip-address, raspberry, pi, Last update:
September 10, 2015
Related Products:
Raspberry Pi - Model B+
22.99
ADD TO BAG
ADD TO BAG
Raspberry Pi - Model B (Made in UK, 512MB) & 8GB MicroSD Card Bundle
https://www.modmypi.com/blog/tutorialhowtogiveyourraspberrypiastaticipaddress
7/12
2/16/2016
ModMyPi|TutorialHowtogiveyourRaspberryPiaStaticIPAddress
Raspberry Pi - Model B (Made in UK, 512MB) & 8GB MicroSD Card Bundle
32.99
ADD TO BAG
ADD TO BAG
ADD TO BAG
ADD TO BAG
ADD TO BAG
107 Comments(46 Replies)
https://www.modmypi.com/blog/tutorialhowtogiveyourraspberrypiastaticipaddress
8/12
2/16/2016
ModMyPi|TutorialHowtogiveyourRaspberryPiaStaticIPAddress
ADD TO BAG
Sam Fitzgerald
February 04, 2016 02:52
My server was working perfectly fine until I updated to the Static IP, upon following the instruction to
sudo reboot, it just sits at
"[ ok ] Starting system message bus: dbus.
[ ok ] Starting periodic command scheduler: cron.
[ ok ] Starting OpenBSD Secure Shell server: sshd.
My IP address is 10.0.0.15
_"
This has been sitting here for a half hour now and this also the second attempt with the same result...
Reply
chfakht
January 24, 2016 13:07
i have used raspberrypi_defconfig configuration under BUILDROOT to mount the OS on the pi ... this
method didn't work !!!
Reply
FAISAL
January 14, 2016 18:27
i cant understand how to give static ip address to raspbarry pi..?
Reply
waleed
December 23, 2015 13:50
I purchased my new raspberry pi 2 and i burn on it (raspbian wheezy) and then i opened my cmd and
write ( apt -a ) then it show dynamic IP address. i copied that IP and write on ( putty ) then its open small
screen and ask to enter login name?. i entered ( pi ) password ( raspberry ) but its say ( access denied ).
now what i do?.
in login (pi) its accepted but password denied
please help me guys.
Reply
https://www.modmypi.com/blog/tutorialhowtogiveyourraspberrypiastaticipaddress
9/12
2/16/2016
ModMyPi|TutorialHowtogiveyourRaspberryPiaStaticIPAddress
Coldus
January 18, 2016 08:30
I've had the same issue, connect it to a screen, turn it on, and press shift while it boots.... More
here:https://www.raspberrypi.org/forums/viewtopic.php?t=20397
For me it did help , Good luck :)
urs
December 16, 2015 22:45
the same as Hesham wrote: it does NOT work
after reboot it's the same address as before.
Reply
nobody
December 20, 2015 19:56
try this:
https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=124423
John
December 23, 2015 08:41
If you are using Raspbian Jessie have a look at th link :
http://raspberrypi.stackexchange.com/questions/37920/how-do-i-set-up-networking-wifi-static-ip
Hesham
December 11, 2015 19:40
Hello Jessi,
I do everything as written, but after reboot the interfaces file is refreshed as it was first time without any
of my changes! I tried this twice. Any clue?
Reply
PREV 1 of 18 NEXT
Leave a Comment
Leave a Reply
* Name:
* Comment:
https://www.modmypi.com/blog/tutorialhowtogiveyourraspberrypiastaticipaddress
10/12
2/16/2016
ModMyPi|TutorialHowtogiveyourRaspberryPiaStaticIPAddress
Verification code:
Submit
Information
Customer Service
Home
Contact Us
About Us
Site Map
Delivery Information
Returns Policy
Privacy Policy
Terms & Conditions
WEEE
Find us on Google+
My Account
My Account
Order History
Wish List
Your Email
Newsletter
Submit
https://www.modmypi.com/blog/tutorialhowtogiveyourraspberrypiastaticipaddress
11/12
2/16/2016
ModMyPi|TutorialHowtogiveyourRaspberryPiaStaticIPAddress
https://www.modmypi.com/blog/tutorialhowtogiveyourraspberrypiastaticipaddress
12/12