Sunteți pe pagina 1din 6

6/12/2016 ModMyPi|HowtogiveyourRaspberryPiaStaticIPAddressUPDATE

Login | Register

Select Language

Home Blog How to give your Raspberry Pi a Static IP Address - UPDATE

How to give your Raspberry Pi a Static IP


Address - UPDATE
April 20, 2016
This tutorial will show you how to set a static IP address on your Pi with the release of Raspbian Jessie. At
the time of writing, the latest release date of Raspbian Jessie is 18-03-2016 with Kernal version 4.1.

I recommend doing this on a fresh install, however if you have attempted to set a static IP address already,
you may have found yourself editing the interfaces le (/etc/network/interfaces). I hope you made a backup,
because youll need to remove any edits you have made, and revert it back to its original state!

The following is done over SSH, but you could just as well plug your Pi into a monitor, hook up a keyboard
and mouse, and use the Terminal instead.

Start by editing the dhcpcd.conf le

sudo nano /etc/dhcpcd.conf

Scroll all the way to the bottom of the le and add one, or both of the following snippets. Depending on
whether you want to set a static IP address for a wired connection or a wireless connection eth0 = wired,
wlan0 = wireless.

Youll need to edit the numbers in the snippet so they match your network conguration.

CODE

http://www.modmypi.com/blog/howtogiveyourraspberrypiastaticipaddressupdate 1/6
6/12/2016 ModMyPi|HowtogiveyourRaspberryPiaStaticIPAddressUPDATE

interfaceeth0

staticip_address=192.168.0.10/24
staticrouters=192.168.0.1
staticdomain_name_servers=192.168.0.1

interfacewlan0

staticip_address=192.168.0.10/24
staticrouters=192.168.0.1
staticdomain_name_servers=192.168.0.1

interface = This denes which network interface you are setting the conguration for.
static ip_address = This is the IP address that you want to set your device to. (Make sure you leave the /24 at
the end)
static routers = This is the IP address of your gateway (probably the IP address or your router)
static domain_name_servers = This is the IP address of your DNS (probably the IP address of your router).
You can add multiple IP addresses here separated with a single space.

To exit the editor, press ctrl+x


To save your changes press the letter Y then hit enter

Now all you need to do is reboot, and everything should be set!

reboot

You can double check by typing

ifcong

And checking the interfaces IP address

http://www.modmypi.com/blog/howtogiveyourraspberrypiastaticipaddressupdate 2/6
6/12/2016 ModMyPi|HowtogiveyourRaspberryPiaStaticIPAddressUPDATE

Last update: April 20, 2016


6 Comments(2 Replies)

james
May 21, 2016 22:53
Thank you! Finally! A simple how-to for Static IP with Jessie. Worked perfectly! Saving this locally for
reference!

No idea why they changed Raspbian so much with this Jessie release. What was wrong with the way it
was before? Anyways, thanks again!

Reply

sam hook
May 19, 2016 15:43
How do i setup multiple static ip addresses?
(sorry i am another noob)

Reply

Eric Tai
May 18, 2016 13:07
Is it possible for a string to be used for the static IP address? Sorry, beginner here.

Reply

Dimitris Dermanis
May 06, 2016 08:58

could someone explain the use of /24 after the ip address


http://www.modmypi.com/blog/howtogiveyourraspberrypiastaticipaddressupdate 3/6
6/12/2016 ModMyPi|HowtogiveyourRaspberryPiaStaticIPAddressUPDATE
could someone explain the use of /24 after the ip address

Reply

Bob McLean
May 08, 2016 15:46
The /24 denotes that the leading 24 bits are common to all IP addresses on this network. It's
equivalent to the old way of providing a net mask:
255.255.255.0 (leading 24 bits are 1's)

John Paton
May 03, 2016 10:11
How would you enter the SSID and WPA key if using WiFi?

Thanks,

John

Reply

Charles P.
May 05, 2016 04:10
It is set in conguration le referenced by the main networking conguration le.

1. sudo nano /etc/network/interfaces

allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

2. sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

network={
ssid="MyNetwork"
psk="MyPreSharedKey"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
}

It is possible to add more than network{} blocks. Use priority=# to indicate higher priority.

Jairo Sanchez
April 27, 2016 03:30
Thank you. Funcion para mi raspberry pi 3.

Reply

PREV 1 of 1 NEXT

Leave a Comment
Leave a Reply
* Name: * Comment:

* E-mail: (Not Published)

http://www.modmypi.com/blog/howtogiveyourraspberrypiastaticipaddressupdate 4/6
6/12/2016 ModMyPi|HowtogiveyourRaspberryPiaStaticIPAddressUPDATE

Website: (Site url with http://)

Verication 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 Keep in the loop

My Account
Your Name
Order History

Wish List Your Email

Newsletter
Submit

http://www.modmypi.com/blog/howtogiveyourraspberrypiastaticipaddressupdate 5/6
6/12/2016 ModMyPi|HowtogiveyourRaspberryPiaStaticIPAddressUPDATE

http://www.modmypi.com/blog/howtogiveyourraspberrypiastaticipaddressupdate 6/6