element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Documents Static IP Address for my Pi
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: PEarle
  • Date Created: 28 Apr 2013 1:13 PM Date Created
  • Last Updated Last Updated: 8 Oct 2021 5:29 AM
  • Views 4844 views
  • Likes 3 likes
  • Comments 14 comments
Related
Recommended

Static IP Address for my Pi

Like most people, I want to run my Pi 'headless' - i.e. I want to connect to it remotely using my laptop keyboard and screen. It means that I don't have to hook anything up to the Pi, and I don't need to get a second screen and keyboard. There's several ways of doing this - using VNC for example, or Putty (for a command line interface) and there's lot of information on the web about how to set these up. However, if like most people, you are behind a broadband router that assigns dynamic IP addresses, then you will find that the IP address of your Pi keeps changing. This means that you can't connect to it remotely unless you know the IP address - and to find that out you have to connect a screen, which rather misses the point of trying to run headless!

 

Fortunately its fairly easy to do this - there's several pieces I found on the 'Net, and the following is a record of my own successful attempt. If this doesn't work its probably because of the way your router is set up, and you will need more help than given in this article - but this worked for me!

 

The first thing you need to do is to find out what range of addresses is available to you. If you do an ipconfig command on your PC you find out what its IP address is, and that will give you an idea of the range of IP addresses being used assigned by your router.

As you can see below the IP address for my PC is 192.168.1.3 - so my router is assigning addresses in the range 192.168.1.nnn

There are a couple of other bits on information which we will need in a minute - the subnet mask and the gateway - circled below in red.

image

 

I picked an IP address to assign ion the range that the router is using, but high enough so that it wouldn't assign it to a device I was already using. That isn't the most scientific way of doing it, but it seemed to work for me! I decide to use 192.168.1.10 for my Pi.

 

Logging on to the PI, all I e to do was to edit file /etc/network/interfaces as follows;

 

At a command prompt on the pi enter sudo nano /etc/network/interfaces

 

In the file you will see the line iface eth0 inet dhcp as shown below

 

image

 

Edit the line iface eth0 inet replacing dhcp with static

Then add the following lines

 

address the ip address you are going to use

netmask the subnet mask shown in tthe PC ipconfig screen

gateway the default value shown in the PC IP config scree

 

e.g.

 

address 192.168.1.10

netmask 255.255.255.0

gateway 192.168.1.1

 

The file should look like this

 

image

 

 

Thats it! - save the file and reboot your Pi. You should now be able to access it using the IP address you have decided - as a test, ping it from your PC, and you should see something like this;

 

image

  • pi
  • ip_address
  • Share
  • History
  • More
  • Cancel
  • Sign in to reply

Top Comments

  • mgt6910
    mgt6910 over 12 years ago +1
    How about setting up a fixed address for the Pi in the router ? After that you can rewrite the Pi's Sd-card as often as you wish (or need), and still use DHCP to set up Pi's networking.
  • Gough Lui
    Gough Lui over 6 years ago in reply to koudelad +1
    Mikrotik user here too - love having the flexibility to lots of interesting and useful networking configurations that consumer gear doesn't allow. Setting up static DHCP leases (or bindings) is nice to…
  • shabaz
    shabaz over 6 years ago +1
    Things may have changed since this original blog post is now almost 6 years old, some routers may automatically assign the same IP address every time anyway, by default. With a cheap home router (as supplied…
  • andycrofts
    andycrofts over 12 years ago

    My pi's using WiFi. I somehow bumbled through the router i/f and bound the Pi's MAC address (of the A-link wifi dongle - ifconfig -a(?) gave it me) to a fixed LAN address. Didn't take more than a few minutes. (The A-link WNU dongle worked straight out of the box using Raspbian, BTW)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mgt6910
    mgt6910 over 12 years ago

    I can take the router down while I'm alone for a few days, I'll let you know how I get on.

    (PS: my router is a NETGEAR CVG834G   (WirelessCable Voice Gateway)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • PEarle
    PEarle over 12 years ago in reply to mgt6910

    Sounds like a good idea - do you know how to do that ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mgt6910
    mgt6910 over 12 years ago

    How about setting up a fixed address for the Pi in the router  ? After that you can rewrite the Pi's Sd-card as often as you wish (or need), and still use DHCP to set up Pi's networking.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
<
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube