How to Set a Static IP Address on Raspberry Pi

Make sure your Pi has the same IP every time you boot.

Static IP Address for Raspberry Pi

If you're trying to access a Raspberry Pi on your local network, there are times when you'll really need its IP address. Sure, you can usually SSH or VNC into a Pi by using its hostname, but for something like port forwarding on a router (which you'll use to create an externally-accessible Minecraft server or web server), an actual IP v4 address may be needed. The problem: every time you reboot your Pi, the IP address can change, based on what the router decides to assign at the moment.

Fortunately, there's a simple way to make sure that your Raspberry Pi always gets the same IP address on your local network or, at least, always tries to get the same address on your local network. It almost goes without saying that if, at the time it boots, another device that's powered on is already using the address in question, your Pi will either have no IP v4 address at all or (if you configured it as such) it will choose an alternative one. So keep that in mind.

Note that this tutorial assumes you already have a Raspberry Pi that's connected to your network. If not, please see our tutorials on how to set up a Raspberry Pi and how to set up a headless Raspberry Pi (no monitor required).

How to Assign a Static IP to a Raspberry Pi

1. Determine your Raspberry PI's current IP v4 address if you don't already know it. The easiest way to do this is by using the hostname -I command at the command prompt. If you know its hostname, you can also ping the Pi from a different computer on the network.

hostname -I

2. Get your router's IP address if you don't already know it. The easiest way to do this is to use the command ip r and take the address that appears after "default via."

enter ip r at the command prompt

3. Get the IP address of your DNS (domain name server) by enter the command below. This may or may not be the same as your router's IP. 

get the address of your local DNS

Now that you have the IP address your Pi is currently using, the router's IP address and the DNS IP address, you can edit the appropriate configuration file.

Stay on the Cutting Edge

Join the experts who read Tom's Hardware for the inside track on enthusiast PC tech news — and have for over 25 years. We'll send breaking news and in-depth reviews of CPUs, GPUs, AI, maker hardware and more straight to your inbox.

4. Open /etc/dhcpcd.conf for editing in nano.

5. Add the following lines to the bottom of the file. If such lines already exist and are not commented out, remove them.

Replace the comments in brackets in the box below with the correct information. Interface will be either wlan0 for Wi-Fi or eth0 for Ethernet.

In our case, it looked like this.

You may wish to substitute "inform" for "static" on the last line. Using inform means that the Raspberry Pi will attempt to get the IP address you requested, but if it's not available, it will choose another. If you use static, it will have no IP v4 address at all if the requested one is in use.

6. Save the file by hitting CTRL + X and reboot . 

From now on, upon each boot, the Pi will attempt to obtain the static ip address you requested.

Using the Raspberry Pi OS Guide to Set a Static IP

If you already have all the information about your router's IP and DNS IP, you can configure the static IP address using the Network Preferences menu instead of editing the dhcpcd.conf file.

1. Right click on the network status icon and select the Wireless & Wired Network Settings.

Select Wired & Wireless Network Settings

2. Select the appropriate interface . If you're configuring a static IP for Wi-FI, choose wlan0. For Ethernet, choose eth0.

Select interface

3. Enter the IP addresses into the relevant fields.  Your desired IP address will be in the IPv4 field, followed by a /24. Your router's IP and DNS server's IP will be in the fields named after them.

Enter the appropriate IPs

4. Click Apply , close the window and reboot your Pi.

Your Pi will now attempt to use your desired IP address at each boot. However, the Network Preferences menu sets this as a preference, not an absolute. So, if the IP address you asked for is not available, it will use another.

Avram Piltch

Raspberry Pi 5 challenger LattePanda Mu uses Intel N100 CPU to take on industry-leading single-board computer

Raspberry Pi showcase AI camera kit, new screen and long awaited M.2 HAT at Embedded World conference

DRAM pricing and supply seems largely unaffected by Taiwan earthquake, firm claims

  • AusMatt Typo: grep "namesever" /etc/resolv.conf Should read: grep "name r sever" /etc/resolv.conf Reply
  • alan tracey wootton With an Arduino that is serving a web page one can use mDns instead of keeping track of the local IP address. Add this to your Setup(): if (MDNS.begin("esp32")) { MDNS.setInstanceName("count server demo"); MDNS.addService("http", "tcp", 80); MDNS.addServiceTxt("http","tcp","counter","true"); }Then that webpage is available locally in chrome and safari as: http://esp32.local./I didn't test the other browsers. I'm sure this works for a Pi also even though I haven't tried it yet. mDns might be on by default. The url would be http:// raspberrypi .local./To check, try this command: dns-sd -B _http._tcpWhen I do that I find that both of my printers are serving http (a supply level page) in addition to the microcontroller. Reply
  • wl84 When I run the nameserver command I get two results back - 192.168.11.1 and 192.168.68.1. I tried both in the config and I can't connect to anythign with either. I'm trying to setup pihole Reply
  • View All 3 Comments

Most Popular

By Les Pounder February 28, 2024

By Les Pounder February 26, 2024

By Sammy Ekaran February 24, 2024

By Les Pounder February 19, 2024

By Avram Piltch February 18, 2024

By Sammy Ekaran February 12, 2024

By Sammy Ekaran February 11, 2024

By Avram Piltch February 06, 2024

By Sammy Ekaran February 04, 2024

By Avram Piltch February 03, 2024

By Les Pounder January 24, 2024

setting a static ip raspberry pi

Set up a static IP-address on the Raspberry Pi

By default, the Raspberry Pi will get a dynamically allocated IP-address, meaning it changes as you restart it or potentially when new devices are added to the network. To make it easier to connect and have a more stable connection I recommend to set up a static IP address.

Table of contents

Get a static ip-address, setting-up using the desktop, setting-up with the terminal, prioritising internet interface, disabling static ip-address.

To get a static IP-address that works, it will need to be within the range provided by the router. We will therefore first need to find the router’s ip address. This tends to be written on the bottom of the router. If not, simply open a terminal window and type in netstat -nr . Now look under Gateway :

internet gateway

You can also use the command ip route | grep default | awk '{print $3}' .

In this example it is 192.168.0.1 . Using the router’s ip address we can choose a static ip address in the range between 1 and 255, which will become the last number of your ip-address, e.g. 192.168.0.40 .

Determine if you want a static ip address over WiFi or Ethernet. The interfaces are called respectively wlan0 and eth0 .

It is very simple to set up your static ethernet address. Simply right-click on the Wi-Fi icon in the menu bar (top-right on the left of the speaker icon) and select the Wireless & Wired Network Settings .

Now click the empty dropdown menu and select the network interface you want to configure. Now for IPv4 Address enter your chosen ip address, for Router the IP address of the router. AS DNS Servers add 8.8.8.8 . When wanting to add multiple DNSs make sure to add them one after another separate by a space. Finally, click the Disable IPv6 option.

One can also set up a static IP-address via the terminal. For this we need to change the dhcpcd.conf file:

Now scroll to the bottom, and add the following text:

replacing the words in capital by what is desired. Now save the file by pressing ctrl+x then y to exit.

When you are using multiple internet interfaces, such as Ethernet over Wifi, it is important to make sure the internet interface has priority over the other such that you get a working internet connection. To do so, we need to add a metric number to each, with the higher metric being prioritised first. Open the dhcpcd.conf file:

And add the metrics. For example:

Now finally reboot your Raspberry Pi for the changes to be incorporated:

Once your raspberry pi has finished restarting, connect to it locally to verify the static IP address hostname -I or ping from it on a networked computer ping YOURSTATICIP .

In many cases you may not want your Raspberry Pi set to use a static IP address. You can change the network configuration back by editing dhcpcd.conf again ( sudo nano /etc/dhcpcd.conf and removing all the lines you added in the previous steps.

RaspberryTips

3 Easy Ways To Set A Static IP Address On Raspberry Pi

When you plug a Raspberry Pi into the network and boot it, it will generally get a “random” IP from the DHCP server. This IP address might change almost every time you use it, which is not convenient at all. Let’s see how to set a fixed IP address, so the Raspberry Pi always use the same one.

There are three ways to set a static IP address on Raspberry Pi: assign an IP address to your Raspberry Pi in the router configuration, set a static IP in the desktop environment, or change the network configuration manually to always use the same IP.

We’ll explore these 3 methods, but first, let’s make sure you understand your current network, it’s an important prerequisite to avoid any IP address conflicts or network malfunctions.

If you’re looking to quickly progress on Raspberry Pi, you can check out my e-book here . It’s a 30-day challenge where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.

Prerequisites: Understand the network configuration

I put the word “random” in quotation marks in my introduction because there is nothing truly random with computers. Before picking an IP address and trying to configure it on the Raspberry Pi, we need to take a few minutes to study the current network.

Get the IP address of your router

On most networks, especially at home, the main router is your Internet provider box. It provides Internet access for all devices and is often the DHCP server too (the main equipment in charge of assigning IP addresses to all devices).

By accessing its web interface, you can generally get a clearer overview of the network configuration.

The IP address of the router is mentioned as the gateway when you check the network configuration of any device connected to it.

From a Raspberry Pi or Linux computer, you can use this command to find the IP address: route -n

setting a static ip raspberry pi

Join Our Community!

Connect, learn, and grow with other Raspberry Pi enthusiasts. Support RaspberryTips and enjoy an ad-free reading experience. Get exclusive monthly video tutorials and many other benefits.

setting a static ip raspberry pi

In my case, my router IP address is 192.168.222.1 (because I configured it). But in most cases, it will be 192.168.1.1 or 192.168.1.254.

On Windows, you can use the system settings, or start a command prompt, and type: ipconfig

setting a static ip raspberry pi

Once you have the IP address, you can try to access the web interface via your web browser. It will be password protected, so you may need to find your Internet provider documentation to access it.

Once connected, I recommend doing two things to make sure you don’t do anything wrong by using one of the three methods mentioned in the article:

  • Find the DHCP range for the clients , meaning the list of IP addresses that can be assigned automatically by your router (if possible, your static IP should be outside this range).
  • Find the already used IP addresses , to avoid any conflict.

I’ll show you how to do this now.

Get the DHCP range

First, you need to find the DHCP range. In general, you have a network that goes from 192.168.1.1 to 192.168.1.254, but the DHCP range is maybe only from 1.100 to 1.150. This will be useful to avoid any conflict.

We don’t want to set the Raspberry Pi IP address to 1.110 if the DHCP may assign it to your computer.

You can also find this information in your DHCP server configuration (so your Internet provider router in most cases). For me, it looks like this:

setting a static ip raspberry pi

Well, I guess my configuration is not typical, as it covers all the IP addresses, probably because I changed it. A smart move, if you have something similar, would be to reduce the range (from 222.2 to 222.100 for example).

If you find that your DHCP range is from 1.100 to 1.150 for example, we’ll just avoid picking an IP address in this range. You can, for example, use 1.160 if it’s not taken by another device with a static IP.

How do you know? That’s the last step before changing the Raspberry Pi configuration.

Get a list of the currently used IP addresses

To be safe, it’s a good practice to get a list of the IP addresses that are currently used on the network. This can be done from the router interface directly, or via a network scan.

On the router configuration page, you may have access to a list of all the computers and other devices connected to your network, with their current IP addresses. Not only the one assigned by the DHCP server but all of them.

This will give a good overview of the current state of the network. If you can’t find this, don’t worry, you can also do a network scan.

From a Windows computer, you can also use the Advanced IP Scanner tool, which will give you something like:

setting a static ip raspberry pi

And on Linux, you can install nmap with: sudo apt install nmap And use it to do a network scan: nmap -sP <network> | grep report So, for example:

setting a static ip raspberry pi

The grep command is used as a filter, to only show the lines we are interested in ( more details here ).

In most cases, your DHCP server assigns IP addresses at the beginning of the range . In both examples, all IP addresses are given between 2 and 40. IP addresses 100 and 150 are static IPs. So, if I pick something like 200 for my Raspberry Pi, it should be safe (192.168.222.200).

At this point, you should know which IP address you’ll configure on your Raspberry Pi. I’ll give you 2 methods, one from the desktop environment, and the other one in the command lines.

Are you a bit lost in the Linux command line?  Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can have the commands at your fingertips.

Set a static IP for the Raspberry Pi on the router

The easiest way to set a static IP address for the Raspberry Pi is to assign it a static lease in the DHCP server configuration (most likely your Internet router).

The interface will be slightly different for each provider and router brand, but in my case, it looks like this:

setting a static ip raspberry pi

I can pick the name of any device on my network, and set a static IP address. I can also enter a MAC address if the device is not listed (here is how to find the MAC address on Raspberry Pi ).

If you can find something similar on your router, it would be the easiest solution. Nothing to change on the Raspberry Pi, and even when you reinstall the Raspberry Pi, it will stay with the same IP address.

It will also avoid most issues as it’s configured directly on the DHCP server.

Set a static IP on Raspberry Pi OS Desktop

On Raspberry Pi OS Desktop, a static IP address can be set manually by editing the wireless and wired network settings. Click on the network icon in the top-right panel, open the settings and fill the configuration manually.

Here are the exact steps:

  • Click on the network icon in the right corner of the top panel.

setting a static ip raspberry pi

  • Take a free IP address to put in the “Address” field. If possible, try to pick something outside the DHCP range. But in general, DHCP servers are smart enough to not assign an IP address that is already taken. The network mask (“netmask”) is generally 24 on most networks.
  • The gateway is the router IP address we got earlier with: route -n
  • And the DNS server is often the same for a home network. You can either check your current configuration with: cat /etc/resolv.conf And use the same IP. Or use a public DNS server, like the one offered by Google (8.8.8.8) or OpenDNS (208.67.222.222). If you use Pi-Hole or AdGuard , you obviously need to adjust this and set it to the other Raspberry Pi IP address.
  • Click “Save” to apply the changes , and then close everything.

To really apply the changes, you need to restart the network by using one of these methods: reboot the Raspberry Pi (main menu > Shutdown > Reboot), unplug/plug the network cable, or disable/enable the Wi-Fi interface.

After the reboot or reconnection, you can put your mouse over the network icon to find out if your IP address has changed to the configured static IP address ( more details here ).

Note : This tutorial has been updated for Raspberry Pi OS Bookworm, the steps might be slightly different on older versions. And the next section, via the command line, is not working with older versions (you have to edit /etc/dhcpcd.conf in this case).

Set a static IP via the command line

If you don’t have access to the desktop interface, or want to use command lines, you can do the same thing via the network manager configuration tool.

Here are the steps to follow:

  • Open Network Manager UI with: sudo nmtui
  • Choose “Edit connection”

setting a static ip raspberry pi

  • On the next window, scroll the cursor to the “IPv4 Configuration” line and select “Automatic” .

setting a static ip raspberry pi

  • Scroll to the bottom of the form to find the “Ok” button to save and exit the tool (press “ESC” several times after that).

As with the previous solution, the change will only apply on the next connection. You can either disconnect/reconnect your network cable, Wi-Fi or simply reboot the Raspberry Pi: sudo reboot

And that’s it. Once the network is reconnected, the IP address should now be the new one you just set:

setting a static ip raspberry pi

Once, you have a good idea of your network configuration and know where to change the Raspberry Pi configuration, it’s not that complicated.

I hope this article was useful, and if you want to learn more about network administration, you should check these other tutorials on the website:

  • How to use Raspberry Pi to monitor network?
  • Network Boot With Raspberry Pi: Everything you need to know
  • How to use your Raspberry Pi as a DNS Server (And Speed Up Internet)

Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.

  • 25 awesome Raspberry Pi project ideas at home
  • 15 best operating systems for Raspberry Pi (with pictures)
  • My book: Master your Raspberry Pi in 30 days

Does a Raspberry Pi need a static IP?

Using a static IP on Raspberry Pi is convenient, but not mandatory. Its utility is minimal for desktop use. For servers, a unique hostname serves the same purpose as a static IP address in most cases.

For specific network servers (DNS, DHCP, ad-blocker, etc.) where you use the IP address in the clients configuration, it’s recommended to set a static IP. But when the hostname can be use, or a quick scan done, it’s not mandatory.

How to set a static IP address before booting?

The easiest way to set a static IP address before booting is to assign a reserved IP address in the DHCP server configuration. The MAC address is the only information required, the system doesn’t matter.

You can follow the instructions given in the first method listed in this article to know how to do this on your router.

What’s the difference between a public and private IP addresses?

Public IP addresses identify devices on the internet, enabling global access to the Raspberry Pi. Private IP addresses are used within local networks, like home setups, allowing communication with devices such as your main computer.

If your goal is to give access to your Raspberry Pi via Internet from anywhere in the world, you should probably read this: How to Install and Use No-IP on Raspberry Pi? (Dynamic DNS) .

Whenever you’re ready, here are other ways I can help you: The RaspberryTips Community : If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads. Master your Raspberry Pi in 30 days : If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides. The Raspberry Pi Bootcamp : Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects. Master Python on Raspberry Pi : Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts. You can also find all my recommendations for tools and hardware on this page .

' src=

I'm the lead author and owner of RaspberryTips.com. My goal is to help you with your Raspberry Pi problems using detailed guides and tutorials. In real life, I'm a Linux system administrator with web developer experience.

Similar Posts

How To Install EndeavourOS On Raspberry Pi (Beginner Guide)

How To Install EndeavourOS On Raspberry Pi (Beginner Guide)

EndeavourOS is a new Linux distribution available for Raspberry Pi. Based on Arch Linux, the installation is a bit different and less straightforward for beginners. Even for me, it took me a lot of time to get it right, but I learned a lesson and will share my tips with you in this step-by-step guide….

Getting Started With VNC on Raspberry Pi (Bookworm update)

Getting Started With VNC on Raspberry Pi (Bookworm update)

VNC is a tool that allows you to get access to the remote desktop environment from another computer. On Raspberry Pi, using VNC is one of the easiest ways to remotely access it. If you use Raspberry Pi OS, VNC is preinstalled so you only have to enable it to get started. Let’s see how…

How to turn a Raspberry Pi into a file server?

How to turn a Raspberry Pi into a file server?

Have you always dreamed of having a family NAS with your backups and movies? But you do not necessarily have the budget for that?Raspberry Pi allows you to do that at a lower cost, and I will give you all the details in this post. How to turn your Raspberry Pi into a file server?To…

The Easiest Way To Get Minecraft Java On Raspberry Pi (2024)

The Easiest Way To Get Minecraft Java On Raspberry Pi (2024)

Even though Minecraft is the most popular game of all time, with over 200M copies sold, it isn’t easy to install on all devices. As a Raspberry Pi owner, you use Linux on a specific architecture that isn’t supported by the developers. So, how do you get Minecraft on your Pi? The official Minecraft launcher…

How to Properly Shut Down Your Raspberry Pi (Avoid data loss)

How to Properly Shut Down Your Raspberry Pi (Avoid data loss)

When a Raspberry Pi is not shut down properly, you run the risk of irreversible damage to the data on the SD card. In this article, we’ll explore the different ways to perform a proper shutdown avoid this issue. The shutdown options from the main menu, or the “shutdown” command in the terminal are the…

How to Install and Use No-IP on Raspberry Pi? (Dynamic DNS)

How to Install and Use No-IP on Raspberry Pi? (Dynamic DNS)

Whether you want to host a server on your Raspberry Pi (and share it with the world), or simply use No-IP to overcome the fact that you don’t have a static public IP address with your provider, this article is for you.In my case, I don’t have a static IP address, so I use this…

Every Raspberry Pi User’s Secret? This Downloadable Linux Command Cheat Sheet!

It's FOSS

Set Static IP Address on Raspberry Pi

Abhishek Prakash

Recently, I set up Jellyfin media server on my Raspberry Pi. My Pi is wirelessly connected to the router and one problem I faced with this setup is accessing the media server on the TV or other devices.

Why? Because the Pi got assigned a random IP address at times between reboots. And since I was trying to access the media server running on Raspberry Pi though the IP address, it became an issue.

I had to manually enter the IP address on the TV every time the IP address changed. Finding the IP address of the Raspberry Pi was another challenge.

This is where static IP comes into play. If you Pi uses static IP, the IP address remains the same between the reboots.

This is one of the many scenarios where you are better off with a static IP assigned to your Pi. And in this tutorial, I'll discuss how you can achieve that.

Assigning static IP on Pi device vs on the router

Yes! There are two approaches for your Pi to have a static IP.

  • You can set static IP on the Raspberry Pi itself
  • You can have your router assign a static IP to the Pi

Both methods have their pros and cons.

Let's say you set the static IP on the Raspberry Pi . Your Pi will always seek the same IP address from the router (let's say 192.168.1.51). That's fine as long as the router remains the same. If you change your router and the new router insists on using a different subnet (let's say in the 172.16.12.0/32 range), then your PI won't be connected to WiFi like before. You'll have to manually update the network settings on the Pi again to use the new IP range. This could work when you just a couple of Pi devices and you can directly login to them (instead of SSH) or connect to them via Ethernet cable. For a fleet of Pis in random locations in the house.

Let's say you want to assign the Pi a static IP from the router . This way, you are changing nothing on the Pi. If you change the router, the Pi will get an IP address assigned automatically through the DHCP server. The problem is that it's not easy to assign static IP to devices on all the routers. Some internet companies provide routers with very little scope of configuration changes.

I cannot show how to assign static IP to different devices on the router, as it depends on what kind of router you have. So, I'll discuss how you can set static IP on the Raspberry Pi itself.

Setting static IP on Raspberry Pi

The procedure comprises the following four steps:

  • Get the current IP address of the Pi (if you want to use this one as static IP)
  • Get the gateway IP (router's IP)
  • Get the DNS server address (optional)
  • Use the above information to change network configuration

The first three steps can be easily done in the command line. The third step can be done easily in both the command line and GUI.

Step 1: Get the IP address of Pi

If you want to use the current IP address as the static IP,

This is very simple. In the terminal, type the following command:

You may also use this command:

Both will give you the current IP address of the Raspberry Pi.

Get IP address of Raspberry Pi

As you can see in the screenshot above, my Raspberry Pi's IP address is 192.168.1.34.

Step 2: Get the gateway IP

This is also quite simple. To get the gateway IP address (your router's IP address), use this command:

As you can see in the screenshot below, the gateway IP in my case is 192.168.1.1.

Get gateway IP address

Step 3: Get the DNS server details (optional)

Some people like to keep the same DNS server which is currently being used on the system. I think you can do without that as well. Most home users have the DHCP server handle it automatically anyway.

Still, if you want, you can get the DNS server address with:

DNS server IP address

Step 4 (Terminal Method): Change network configuration to set static IP

If you are accessing Raspberry Pi via SSH or if you prefer the command line, you can use the nmtui (network manager in terminal) tool.

Run this command:

You'll see an interface like this. Here, select Edit a connection and press Enter.

Edit network connection in Network Manager

It will show the connections you have had in the past on your Pi. I believe you want to set the static IP for the currently connected network. Move down to the appropriate network. Now press tab a couple of times to select the Edit option and press enter.

Edit network connection in nmtui

Use the arrow key to scroll down to the IPv4 CONFIGURATION option. Change it from Automatic to Manual .

Change IPv4 configuration

Next, select the Show option of IPv4 CONFIGURATION line.

Setting static IP in Raspberry Pi by changing IPv4 configuration

Use the arrow keys to move down again and reach the IPv4 CONFIGURATION section again. This time you'll see option to add Address, Gateway and DNS servers.

IPv4 configuration change

Go to the Addresses line and click enter key. It may take you to the beginning. Scroll down back again.

Static IP set in Raspberry Pi

Fill all the details such as IP address with mask, Gateway IP and DNS.

Changing IPv4 config to set static IP on Raspberry Pi

If you notice above, I used the gateway IP in DNS too. I also added 1.1.1.1, DNS of Cloudflare as an alternative.

After filling all the details, scroll down to the bottom, select OK and press enter.

Your changes are saved. You can exit the nmtui interface the same way (press Back and then Quit options).

Restart your Pi for the changes to take effect. You have successfully set up static IP on Raspberry Pi.

Step 4 (GUI Method): Change network configuration to set static IP

The same can be achieved from the graphical interface of Raspberry Pi OS.

First, click on the network icon and then go to the Advanced options and click Edit connections.

Edit connections in Raspberry Pi

Here you go to IPv4 Settings, set it to manual and then add all the details such as IP address, mask, gateway IP, DNS server etc. You have all the details.

Set static IP on Raspberry Pi

Restart your system and you can see that the static IP is now set on your Pi.

Going back to non static IP

If you don't want to use static IP anymore on Raspberry Pi, you can easily revert the steps and go back to dynamic IP.

How? Simply edit the network connection in question again. This time, change the IPv4 configuration to 'automatic' and save your changes. And that's it. You don't have to provide IP address, gateway IP etc anymore.

As I mentioned at the beginning of this tutorial, you should use a static IP from the router end specially if your Pi won't be easily accessed physically.

But if your device is in your hands all the time, you have the liberty of accessing and changing its configuration.

I hope you find this tutorial on setting a static IP on Raspberry Pi helpful. Please let me know if you have any questions.

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

How to Install Ubuntu Desktop on Raspberry Pi 4

How to install raspberry pi's raspbian os with pixel desktop on any computer, behold here is a $89 open source laptop running linux, run llms locally on raspberry pi using ollama ai, raspberry pi 3 vs 4: which one should you get, become a better linux user.

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Your link has expired.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.

How Do I Set a Static IP Address on Raspberry Pi?

If you're using your Raspberry Pi as a media or game server, setting a static IP address will make things far easier.

If you’re using your Raspberry Pi as a home server or often need to access it remotely from another device, setting a static IP address for it is a very good idea. This means you’ll be able to find it at the same Raspberry Pi static IP address every time, rather than a new address being set dynamically whenever it is rebooted. This is also useful to avoid confusion when you have multiple Raspberry Pi devices connected to your network.

Fortunately, once you know how, it's a fairly simple and quick process to set a Raspberry Pi static IP address. We’ll show you how to change the IP address in Raspberry Pi OS / Raspbian to make it permanent.

What Is an IP Address?

An Internet Protocol (IP) address is used to uniquely identify each device on a computer network, or the network itself on the internet – more on that later. The IP address is normally written in ‘dot-decimal’ notation: four decimal numbers, each ranging from 0 to 255, separated by dots. An example is 192.168.1.107 .

By default in Raspberry Pi OS, which is a Linux-based operating system, your Raspberry Pi’s IP address is reconfigured automatically each time you reboot it, so it may well change. Naturally, this is not ideal when you need a reliable address at which to connect to the Raspberry Pi from another device, such as when using it as a server. So it’s better to set a static IP address on Raspberry Pi.

Private vs. Public IP

A public IP address is used to identify your local network on the wider internet. This typically changes every time your router connects to the internet, although you may be able to make it static depending on your internet service provider.

You can find the public IP address on a Linux system such as Raspberry Pi OS by entering a special Terminal command, or simply by doing a web search for "What's my IP?". It is only required if you intend to connect to a device from outside your network, which we won’t cover here.

Instead, we are looking at the private IP addresses used to identify each device on your own local network. While it may be possible to reserve a certain IP address for your Raspberry Pi in your wireless router’s settings for the same purpose, here we’ll be showing you how to set a static IP from the Raspberry Pi itself.

1. DHCP Configuration

Raspberry Pi OS (formerly known as Raspbian) uses DHCP (Dynamic Host Configuration Protocol) to assign an IP address to the Raspberry Pi automatically whenever it is rebooted. You can find out more in our guide to DHCP .

To change Raspberry Pi OS's behavior so that it uses the same static IP address each time, you will need to modify the configuration file for the DHCP client daemon, dhcpcd.conf .

Before that, you will need some information on your current network setup so that you can add the required details to the configuration file. You will require the following info:

• Type of network connection: This is either wlan0 if your Raspberry Pi is connected to the router wirelessly, or eth0 if it’s connected using an Ethernet cable.

• Raspberry Pi’s currently assigned IP address: it’s safest to reuse this for the Raspberry Pi static IP so that you can be sure the latter hasn’t already been to another device on the network. If not, make sure another device isn't already using it.

To find the Raspberry Pi’s current IP address, enter the following command in a Terminal window:

• Your router’s gateway IP address: this is the one used to contact it from the local network, not its public IP. It varies depending on the router model, but typically starts with 192.168.

To find it, enter the following command and note the first IP address given:

• Your router’s DNS (Domain Name System) IP address: This is typically the same as its gateway address, but may be set to another value to use an alternative DNS – such as 8.8.8.8 for Google, or 1.1.1.1 for Cloudflare.

To find the current DNS IP address, enter the command:

Note the IP address after nameserver – that's the DNS address – and then press Ctrl + X to close the file.

2. Add Static IP Settings

Now you have found all your network connection information, it’s time to edit the dhcpcd.conf configuration file to add the settings you need to set up a static IP address for your Raspberry Pi:

If you haven’t edited the file previously, it will mainly contain various comment lines preceded by a hash (#) symbol. At the bottom, add the following lines, replacing the emboldened names with your own network details:

Replace the emboldened names as follows:

  • NETWORK – your network connection type: eth0 (Ethernet) or wlan0 (wireless).
  • STATIC_IP – the static IP address you want to set for the Raspberry Pi.
  • ROUTER_IP – the gateway IP address for your router on the local network.
  • DNS_IP – the DNS IP address (typically the same as your router’s gateway address).

Here is an example configuration to set the static IP to 192.168.1.120 with a wireless connection to a router at 192.168.1.254:

Once you have entered the settings, press Ctrl + X and then Y and ENTER to close and save the modified configuration file.

3. Reboot the Raspberry Pi

With the dhcpcd.conf configuration file modified, restart your Raspberry Pi to effect the changes and set the static IP address for it:

Rather than using an address assigned automatically by DHCP, the Raspberry Pi will now attempt to connect to the router using the new static IP address that you set in the dhcpcd.conf file.

To check that it is working correctly, enter the following command:

You should now see the static IP address that you set in the dhcpcd.conf configuration file.

Set a Static IP Address: Success

Congratulations: you have set up a static IP address on your Raspberry Pi, and it should now retain that address automatically whenever it boots up. Now you can go ahead and use your Pi system as a NAS, media or game server, and connect to it reliably at the same Raspberry Pi static IP address every time.

You'll Need 1

How to Configure a Static IP Address on the Raspberry Pi

setting a static ip raspberry pi

What you'll need

setting a static ip raspberry pi

Posted in these interests:

setting a static ip raspberry pi

Raspberry Pi

The network capabilities on the Raspberry Pi make it possible to create some really fun projects. Once in a while, you’ll come across a project that could benefit from a static IP address. If you’re using your Raspberry Pi for storage as a NAS device, an FTP server—or any other kind of server for that matter—a static IP address can be a big help.

1 – Update Raspberry Pi OS

setting a static ip raspberry pi

This guide should work with any Raspberry Pi using Raspberry Pi OS (formerly Raspbian). Make sure your copy of is up to date. If you’re not sure where to begin, visit our guide on  how to update Raspberry Pi OS .

setting a static ip raspberry pi

How to Install Raspberry Pi OS on Your Raspberry Pi Get the new official Raspberry Pi OS on your Pi.

2 – Find your router IP address

setting a static ip raspberry pi

We’ll need both your  router  IP address and  name server  IP. We can find this information by running a few commands in a terminal on the Pi.  Remote into the Pi using SSH  or open a terminal window from within Raspberry Pi OS.

setting a static ip raspberry pi

How to Connect to a Raspberry Pi Remotely via SSH The preferred (and most common) method of connecting to your Pi to run commands.

To find your router IP address, enter the following command:

The router IP address will appear after the text “default via”—take note of it. The name server can be found in the  resolv.conf  file. Open it using the following command.

Take note of the name server IP address and close the file with  CTRL  +  X .

3 – Edit the dhcpcd file on the Raspberry Pi

setting a static ip raspberry pi

The static IP is set by adding it to a file on the Raspberry Pi. In the terminal window, run the following command to edit the  dhcpcd.conf  file.

4 – Set the static IP address

setting a static ip raspberry pi

This document has a few lines of code that can be activated by removing the  #  to the left of each line. Use the following ledger to properly set your static IP address.

  • Network  = If you’re using a wired connection, set this to  eth0 . If you’re using a wireless connection, set this to   wlan0 .
  • Static_IP  = This is the static IP address you want to assign to the Raspberry Pi.
  • Router_IP  = This is the IP address for the router.
  • Name_Server  = This is the name server address. You can use another DNS IP here if you’d like.

Enter your information into the file, be sure to remove the  <>  brackets. Check the screenshot for an example.

When that’s completed, save the file using  CTRL  +  X .

5 – Test the static IP address

When the changes have been made, restart the Raspberry Pi. Now is a good time to test your project and make sure the IP address isn’t changing. Disconnect and reconnect your Pi from the network. If the IP address changes, verify the information in the previous step saved properly. If it stays the same, congratulations! You’ve set a static IP on the Raspberry Pi.

How to Run a Minecraft Server on the Raspberry Pi

setting a static ip raspberry pi

There are several ways to go about running a Minecraft server on the Raspberry Pi. In this guide, I’ll cover how to install Nukkit—a cross-platform Minecraft server that’s super easy to set up on the Raspberry Pi. This server should work with PCs, consoles, and tablets running Minecraft 1.14. I’ll be using a Raspberry Pi

In these interests

Raspberry pi pi • 92 guides, share this guide.

 467 guides

Introducing Howchoo, an enigmatic author whose unique pen name reflects their boundless curiosity and limitless creativity. Mysterious and multifaceted, Howchoo has emerged as a captivating storyteller, leaving readers mesmerized by the uncharted realms they craft with their words. With an insatiable appetite for knowledge and a love for exploration, Howchoo's writing transcends conventional genres, blurring the lines between fantasy, science fiction, and the surreal. Their narratives are a kaleidoscope of ideas, weaving together intricate plots, unforgettable characters, and thought-provoking themes that challenge the boundaries of imagination.

Related to this guide:

There are several ways to go about running a Minecraft server on the Raspberry Pi. In this guide, I&

setting a static ip raspberry pi

HeaterMeter: Control your Grill Using a Raspberry Pi!

With summer right around the corner, it’s time to fire up the grill! But who will watch the gr

setting a static ip raspberry pi

How to Set Up a New Raspberry Pi

So you just got your brand new Raspberry Pi. Awesome! This guide will show you how to set up a brand

setting a static ip raspberry pi

RetroPie scrapers: what they are and how to use them

You’ve put so much work into setting up RetroPie or EmulationStation. You load it up

setting a static ip raspberry pi

Power Your Raspberry Pi Zero with a Battery Using the JuiceBox Zero

The Raspberry Pi Zero is an incredible tool for building a wide variety of IoT devices. And until la

howchoo

How do I connect my Raspberry Pi to my computer?

There are many reasons you may want to connect your Raspberry Pi to your computer, and there are a f

setting a static ip raspberry pi

How to Set Up Homebridge on a Raspberry Pi

Home automation is growing in popularity, but one of the biggest hurdles is compatibility betwe

setting a static ip raspberry pi

Build Your Own Raspberry Pi Car Computer, or “Carputer”, with AutoPi

Have you ever wanted to add an entertainment system to your car, only to find that most units are ex

setting a static ip raspberry pi

The Best Raspberry Pi HATs for Your Next Project (2022)

There are so many cool HAT extensions for the Raspberry Pi to make your next project literally sing

setting a static ip raspberry pi

How to Choose the Best Camera for OctoPrint (including USB)

OctoPrint is a platform designed for the Raspberry Pi that makes it possible to monitor and control

Discover interesting things!

Explore Howchoo's most popular interests.

  • Entertainment
  • Beebom Gadgets

How to Set a Static IP Address on Raspberry Pi

' src=

Set a Static IP Address on Raspberry Pi

Set a static ip address using raspberry pi’s terminal.

Connect Headless Raspberry Pi to Windows Laptop Without Ethernet or Monitor

3. After that, execute the below command to open the dhcpcd.conf file via Nano editor. Keep in mind that Nano is a keyboard-based editor , so you can’t use your mouse to move between lines and edit the file.

How to Set a Static IP Address on Raspberry Pi

8. That’s it. You have assigned a static IP address to your Raspberry Pi in a few easy steps. Now, your router will only use the static IP address you have set for your Raspberry Pi.

Using the Router Settings to Set Static IP on Raspberry Pi

Configure Your Router

4. Click on “Add” and enter the IP address of Raspberry Pi in the “Reserved IP Address” field. You can find the IP address of your RPi board by entering hostname -I in the Terminal. To find the MAC address of your RPi , scroll down and look for the client list mentioned on the same admin page. Next, give a name in the “Description” field and turn on the “Enable This Entry” checkbox. Finally, click on “Save”. It will reserve Raspberry Pi’s current IP address, making it a static IP.

dhcp server

Assign a Static IP Address to Raspberry Pi in a Few Easy Steps!

' src=

Passionate about Windows, ChromeOS, Android, security and privacy issues. Have a penchant to solve everyday computing problems.

WTF… This is all WIFI! What if I have my RPi connected to my router via a 1000MHz ethernet cable? You shd be more general, and not assume everyone connects thru ther wifi.

Add new comment

Apple to Upgrade Mac Lineup with AI-Powered M4 Chip Later This Year

Circuit Basics

  • Raspberry Pi
  • DIY Electronics
  • Programming

Select Page

How to Set Up a Static IP on the Raspberry Pi

Posted by Scott Campbell | Raspberry Pi | 31

How to Set Up a Static IP on the Raspberry Pi

Have you ever tried logging in to your Raspberry Pi  via SSH and were denied because the IP address couldn’t be found? Do you have to scan your network every time you connect to find your local IP address? If the IP address of your Raspberry Pi changes all the time, it’s because you’re using a  dynamic IP address . If you want your Pi to have an IP address that doesn’t change automatically, assign it a static IP address . With a static IP, you can be sure that the same IP will work each and every time.

PCBWay Ad

In this tutorial, I’ll show you how to configure a static IP address using a clean installation of Raspbian Jessie and Raspbian Jessie Lite. There are pros and cons to each type of IP though, so let’s first talk about why you would want a static IP over a dynamic IP.

Static IP vs. Dynamic IP

Dynamic IP’s are good to use if you’re concerned about security. If a hacker gets access to your IP address, you’ll be less vulnerable to attack since your IP changes frequently. A dynamic IP can change every time you log in, or only at certain intervals. A program installed on your network router called the dynamic host configuration protocol (DHCP), automatically changes and assigns new dynamic IP addresses to computers on your network.

A static IP (as you could probably tell by the name) is one that doesn’t change. This makes it more reliable when using services that depend on a stable internet connection, like online gaming, VOIP, or remote desktop applications. With a static IP, you’ll be able to use the same IP address every time you connect to your Pi.

Setting up a Static IP on the Raspberry Pi

Before starting, make sure you’ve already set up and configured a way to access the command prompt. Check out our tutorials  How to Set Up WiFi on the Raspberry Pi  and How to Set Up a Raspberry Pi Without a Monitor or Keyboard  to see how to do that if you haven’t already.

In this tutorial we’ll set up static IP’s for both WiFi and ethernet connections. If you only need one or the other, just omit the code below for the connection you don’t need.

Find Out Your Network Information

The first step is to find out your  default gateway IP . This is the local IP address of your network router. The computers on your network use it to communicate with the router and access the internet. If you already know what it is, just skip this step. If not, do continue…

Power up and log into your Raspberry Pi via WiFi or ethernet, then enter route -ne at the command prompt to see your network routing information:

How to Set Up a Static IP for your Raspberry Pi - route -ne

Under the “Gateway” column, you can see your default gateway IP (10.0.0.1 in my case). The “Iface” column lists the names for each connection – ethernet (eth0) and WiFi (wlan0). Write down your default gateway IP, we’ll need it in a minute.

Now we need to find out the IP addresses of your  domain name servers. Your Pi sends the domain names you enter into your browser (i.e. www.google.com) to domain name servers, which convert the domain names to IP addresses (i.e. 8.8.8.8). Your Pi then uses the IP address to access the website’s server.

Enter cat /etc/resolv.conf at the command prompt to find the list of domain name servers:

How to Set Up a Static IP for your Raspberry Pi resolv conf conf file contents

Copy these IP addresses to a text editor on your PC or write them down for later.

Configure the Network Settings

Now we’re ready to configure the network settings. By default the Pi is configured with a dynamic IP address. To assign it a static IP address, you need to add your static IP, default gateway IP, and domain name servers to the dhcpcd.conf file.

At the command prompt, enter sudo nano /etc/dhcpcd.conf to edit the dhcpcd.conf file:

How to Set Up a Static IP for your Raspberry Pi - Sudo Nano dhcpcd conf

Now, without changing anything else in the file, add this code at the bottom of the dhcpcd.conf file, replacing the IP addresses with your own IP addresses found above:

  • static ip_address :  This is the static IP address you’ll use to SSH or remotely connect to your Pi. Take your default gateway IP (found in the steps above), and change the last number to any other number between 0 and 255.
  • static routers :  This is your default gateway IP address.
  • static domain_name_servers :  These are the IP’s we found in the resolv.conf file above. Separate each IP with a single space.

For example, my default gateway IP address is 10.0.0.1. To get the  static ip_address  for my ethernet connection (eth0), I replaced the 1 with 100 to get 10.0.0.100. To get the static ip_address for my WiFi connection (wlan0), I replaced the 1 with 99 to get 10.0.0.99. I’ll use these IPs to log in to my Pi from now on.

The file should look like this (with your own IP addresses):

Static IP Address for Raspberry Pi - dhcpcd File Contents

Once you’ve replaced the IP addresses in the example code with your own IP addresses, press Ctrl-X and Y to exit and save the dhcpcd.conf file. Now enter sudo reboot to reboot the Pi. Log in with your new static ethernet IP or static WiFi IP:

Static IP Address for the Raspberry Pi in PuTTY

To check that everything is working correctly and the Pi has access to the internet, let’s ping Google. Enter sudo ping www.google.com  at the command prompt:

How to Set Up a Static IP for your Raspberry Pi - Direct Ethernet Connection Ping Google

Press Ctrl-C to stop the pinging. If the connection is successful, you’ll see the packets that have been sent and received. If your connection isn’t successful, you will get a “Network is unreachable” error:

How to Set Up a Static IP for your Raspberry Pi - Direct Ethernet Connection Ping Google Network Unreachable

You should probably test the connection by pinging Google with both ethernet and WiFi static IP’s.

You can watch me set this up step by step in this video:

Now that you have a static IP set up, your Pi’s connection to the internet will be a lot more reliable. But another really useful way to connect to your Pi is with a direct ethernet connection to your laptop or desktop. A direct connection is extremely fast and stable. If you connect to your Pi via SSH a lot, I would definitely recommend setting this up. Check out our article,  How to Connect to a Raspberry Pi Directly with an Ethernet Cable to learn how.

Thanks for reading! Let me know in the comments if you have any questions about setting up your static IP, and I’ll do my best to help. And be sure to subscribe! We send out a quick email each time we publish new articles.

setting a static ip raspberry pi

Related Posts

How To Detect Keyboard and Mouse Inputs With a Raspberry Pi

How To Detect Keyboard and Mouse Inputs With a Raspberry Pi

November 19, 2020

Build a Remote Storage Device with the Raspberry Pi

Build a Remote Storage Device with the Raspberry Pi

April 19, 2021

How to Access the Raspberry Pi Desktop with a Remote Desktop Connection

How to Access the Raspberry Pi Desktop with a Remote Desktop Connection

January 29, 2015

How to Write and Run a Shell Script on the Raspberry Pi

How to Write and Run a Shell Script on the Raspberry Pi

August 11, 2015

31 Comments

Great article. Just a few weeks too late for me as I finally figured it out…

It can be as simple. Lots of articles about fixed ip on the web, read at least 10 of them. All of them wrong or at least outdated (no jessie). Yours worked in no time. Mni thanks for that!

Thanks a Lot on How to setup static ip address, I looked few web site and most had wrong information.

Thank you, many “so called current” info on this on the web but all seem outdated, this is 100% correct. Thank you again.

works fine in setting static address but when trying to ping Google I get “unknown host http://www.google.com ” If I comment out the added lines the ping works fine I use TightVNC to connect to the PI – router address is 192.168.1.1

@JarJarGeek Very nice guide, I would use this for server, but for general Pi;s I find avahi-deamon more flexible.

When i type in the cat for either files or even sudo nano it either says that te file or directory doesn’t exist or the document comes up blank (implying that it doesn’t exist).

i am using a raspberry pi 3 and am using the latest raspbian os as of may 15th 2016.

please help that way i don’t end up having to set my pi up every time i want to use it.

nevermind. got it working.

had to share this on my @RebelMouse. Thank you! https://t.co/6mLwym7uQO

When I tried this it fails to connect. I think the problem is in the static router address. As per your instructions I came up with 0.0.0.0…

pi@VIDraspberrypi:~ $ route -ne Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0

Oops… rebooted a second time and now ALL works! THANK YOU FOR WRITING (AND VIDEO RECORDING) SIMPLE, CONCISE AND UP TO DATE INSTRUCTIONS!!!!!!!!!!!

will this allow graphics from a python program running on pi like pygame? or is the screen functionality merely a window into the terminal?

How will you ensure that the DHCP won’t assign this address to another device?. If my understanding is correct the DHCP does not know about this static IP and can therefore assign it to something else. If this happens there will be an IP conflict. is there anyway out of this ?

Most dhcp servers will try to ping address before assigning it to a client. But if your static IP device is switched off, the address still may be used by dhcp, and conflict will happen when you switch it on.To avoid this, you have to exclude address from your dhcp server’s address distribution range. Or you can make a reservation for that address in dhcp. In some cases reservation is even an alternative to static IP.

How can I set network mask to? Because this way it gives me mask of 255.0.0.0 which is not correct in my case, Also I need to set additional classless route for 10.10.0.0/16 via another gateway.

In fact I don’t need static address. If I do, I’d rater prefer to setup a dhcp reservation. I came to your article finding solution to a problem I have: My raspbian jessie / pi3B does not get default gateway from DHCP. It receives normaly everything else – IP address, default domain, dns and ntp servers, additional classless routes but not default gateway! What can be wrong? The DHCP server is Windows 2012 R2, if that does mater.

With Raspian Jessie (2016/09/23) a need to add “routers” and “domain_name_servers” BOTH under eth0 and wlan0:

interface eth0 static ip_address=192.168.x.x/24 static routers=192.168.x.x static domain_name_servers=x.x.x.x

interface wlan0 static ip_address=192.168.x.x/24 static routers=192.168.x.x static domain_name_servers=x.x.x.x

Thanks for the update! I’ll add this to the post.

i share with you a video on youtube how to configure your ip from dhcp to static. https://www.youtube.com/watch?v=3uixbMXZeNs&t=4s

When i run “sudo ifdown wlan0, sudo ifup wlan0” i get “ifdown: interface wlan0, not configured”. what is the fix for this ?

Amazing! Its truly amazing article, I have got much clear idea concerning from this piece of writing.

wicd-curses

Hi, we have the products of raspberry pi and arduino components, and very interest in working with you.

How do i make it so the ip is the same on any network?? Working on a project and need a way to ping the pi on any network it goes to.

Great article, thank you so much for explaining each of the lines in the dhcpcd.conf file. so many articles tell you to “just add this” without explaining what it means and why. Led to me following several and losing SSH access to the pi until I reverted it.

Doesn’t get much easier that that. Thanks.

Thanks, confirming this worked for me using Raspbian Buster in January 2019

Thank you so much, this helped me a lot. May 2020

I have set static IP in Pi and check by ping and it is working fine but when I enter static IP in putty for ssh getting network error connection time out. I have checked SSH is enabled in pi as well. Can anyone please help me why getting this error?

Worked like a charm. Thank you!

Hello Your tutorial is really helpful. But I have a problem. It seems that I have mistype my static IP address so I can’t connect with my RPi. The static ip_address should be “192.168.1.xxx” but I typed it “192.168.201.xxx” Is there any way I could fix it? Thank you

I am having a strange issue where my resolve.conf file keeps resetting upon reboot or shutdown and I have to do the setup again!!!  The requirement for the static IP is because I am running my own VPN server with OpenVPN and the client I am using on the other end for connecting is Orbot for PC. I don't want to start from scratch hence the reset is not a choice. I did try changing the user and also chmod to 775 giving full permissions or locking it down, without much luck. Any guidance is appreciated.

Leave a reply Cancel reply

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

Notify me of follow-up comments by email.

Notify me of new posts by email.

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use .

I agree to these terms (required).

Get new tutorials sent to your inbox!

Ultimate Guide to the Arduino SIDEBAR NEW

Quick Start Guide for Setting Up a Static IP on the Raspberry Pi

Enter your name and email and I'll send it to your inbox:

Consent to store personal information: I agree to let Circuit Basics store my personal information so they can email me the file I requested, and agree to the Privacy Policy

Email me new tutorials and (very) occasional promotional stuff: Yes No

Check your email to get the PDF!

Linux Guides, Tips and Tutorials | LinuxScrew

Home » Linux » Raspberry Pi » Raspberry Pi Static Ip

Setting a Static IP Address on a Raspberry Pi

Setting a Static IP Address on a Raspberry Pi [With Screenshots]

If you followed our article on  how to SSH to your Raspberry Pi  so that you can control it over a network, you might be tired of having to run the commands to find out what its current IP address is on your network.

Most networks assign IP addresses  dynamically , which means each device on the network is assigned an IP address from a pool of available IP addresses. The address for a specific device may change over time if it is rebooted or the address is automatically reassigned for some reason. This is called DHCP  –  Dynamic Host Configuration Protocol .

Giving your Raspberry Pi a  static IP address  on your network means that it will always have the same address for you to connect to.

This article assumes you are running Raspberry Pi OS.

Step 1 – SSH to Your Raspberry Pi (or Attach a Screen & Keyboard)

If you don’t have a screen and keyboard attached to your Raspberry Pi, you will need to SSH to get things set up.

It’s highly recommended that you set a static IP address using a screen and keyboard just in case you make a mistake – you may not be able to reconnect if the network configuration isn’t valid.

Step 2 – Find Out Which Interface is Connected

The  ip  command can tell us all we need to know about the current state of the network on your Raspberry Pi.

Run the following in your terminal to see what interfaces are connected:

Which will output something that looks like this:

ip addr show

Here you can see the connected network  interfaces . Each entry in the above output represents an interface – each entry taking the format

The interface named  lo  is the  LOOPBACK interface, used for the computer to communicate with itself. It’ll always be there on most systems.

Below is the only other connected network interface wlan0 , the wireless network connection on this Raspberry Pi. We can tell it is connected as it says  UP  in the block of information next to it!

If the wired ethernet connection were connected rather than the wireless, you’d see eth0  instead of  wlan0 . It’s possible but unlikely on a default installation of Raspberry Pi OS that your network interfaces will have different names than those shown here.

Step 3 – Finding your Network and Gateway

You will probably want to assign your Raspberry Pi an IP address on the network it’s already connected to. To do so, we will need to know what network addresses we should use to talk to other devices already there.

Finding the Network

This current IP address assigned to your Raspberry Pi is visible in the previous step’s output.

The IP address following  inet will tell you the current IP. Yours will be different but will be for a local IP address range.

To find out more about IP addresses, check out our article on IP Addresses and Subnets.

Finding the Gateway

For your Raspberry Pi to talk to the outside world, it will also need to know the address of your gateway – your internet modem/router. Run the following to do so:

This will output the current network routes configured on your system:

ip r show

We are interested in the default  route on the first line. This tells us that by default, traffic is routed  via   192.167.1.254 – now we know the gateway’s address.

Finding Your DNS Servers

You will also need to know what DNS servers you are currently using (if any) if you wish to access the internet. These can be found by running:

Which will output the contents of the  resolv.conf  file as generated by your system.

cat /etc/resolv.conf

Here you can see the default nameserver assigned is your router –  192.168.1.254 .

Step 4 – Finding an Available IP Address

This step is dependent on the brand and configuration of the router you have.

When  DHCP assigns an IP address automatically, your router will choose one from a range of IP addresses defined in its configuration. We should not assign the Raspberry Pi a static address that falls into that range, as otherwise, it may conflict if another device receives that address automatically.

You’ll have to check your router configuration or user manual to find out what this range is so that you can make sure you avoid using an address from it.

Step 5 – Assigning the IP Address to the Connected Interface

My network has a DHCP range of 192.168.100 to 192.168.200, from which addresses will be automatically assigned, so I will assign my Raspberry Pi the address:

This is to make sure that it doesn’t conflict with an existing IP (or the router’s IP address, which is 192.168.1.254).

Assigning a Static IP Address Temporarily

To assign a static IP address until the next reboot, just run:

Replacing  192.168.1.201 with the IP address you wish to assign and  wlan0 with the interface’s name to assign it to.

To find out more about IP addresses and the format they are displayed above, check out our article on IP Addresses and Subnets.

Assigning a Static IP Address Permanently

The network configuration will need to be edited to assign an address permanently. Edit the relevant configuration file by running:

The configuration file(s) which you will need to edit will differ depending on your Linux distribution – this method is tested on Raspberry Pi OS in its default state

Add the following lines to the end of the file:

  • Lines beginning with  #  are comments and are not read as configuration entries
  • interface is the name of the connected interface and tells the configuration that the configuration lines following it will be applied to that interface – for this example, it is  wlan0
  • static ip_address  is the static IP address you wish to assign to this interface –  192.168.1.201  in this case
  • static routers  is the IP address of the gateway/router on your network.  192.168.1.254  is the IP address of the router for this example.
  • static domain_name_servers are the DNS servers we wish to use for this network. As seen above, mine is  192.168.1.254 as my router acts as the DNS server. I’ve added a second DNS server separated from the first by a single space.  8.8.8.8 is Google’s DNS server, which will act as a second/fallback DNS server.

To apply these changes, save the document by pressing CTRL + X and pressing Y to save. Then, reboot.

Your Raspberry Pi now has a Static IP!

  • Setting up a LAMP Stack on Ubuntu 20.04 (And Raspberry Pi)
  • TwisterOS For Raspberry Pi Does It All [Screenshots/Review]
  • How to Install Ubuntu MATE 2020.10 on a Raspberry Pi (With…
  • How to Install OSMC Media Center on Raspberry Pi…

Photo of author

1 thought on “Setting a Static IP Address on a Raspberry Pi [With Screenshots]”

I gave this a shot on ubuntu server 20.04, adapting it a bit where needed, and I just couldn’t get it to stick between restarts. Ended up using netplan with success so far.

Either way, great guide! I had fun tinkering, and I’ll back back in a few weeks when I grab a pi.

Leave a Comment Cancel reply

Save my name, email, and website in this browser for the next time I comment.

Privacy Overview

How to set a static IP address on a Raspberry Pi

The Raspberry Pi is a fine addition to your home for a crazy number of reasons, but you'll probably need a static IP for it first.

Raspberry Pi Zero

The Raspberry Pi continues to be one of the most impressive computers on the planet. Not for its power, but for the possibilities. This thing can be programmed with a mind-boggling number of purposes, from small servers and NAS to controlling your home automation or even just a small Linux computer to learn some new IT skills.

Whatever you want to use it for, it's a pretty solid bet that you'll need a static IP for it. Unless you're using something like the Raspberry Pi 400 hooked up to a display, you're likely using it headless. That is, without a GUI. In the case of the Raspberry Pi Zero, this is even more likely.

Setting a static IP for your Pi is really easy, and doesn't have to involve your home router which sometimes can mess it up anyway. Case in point, the last Raspberry Pi I set up on my home network I assigned a static IP in the router settings, and it just sort of forgot about it and assigned a totally different IP to my ad blocker so it didn't actually work properly. That's why you should follow these steps and set it up on the Pi itself for the best results.

Setting up your Raspberry Pi

Raspberry Pi 3

This guide assumes that your Raspberry Pi is already set up and you've flashed it with the Raspberry Pi OS already. If you haven't and need a helping hand, we have a guide on setting up a headless Raspberry Pi using nothing but your Windows PC.

Before you can set a static IP for your Raspberry Pi you will need to know what IP address it's currently on. At this point, the quickest method is probably to log into your router's software and grab it there, especially if you're doing a headless setup. You'll need the IP address to connect over SSH and do the rest.

With the IP address in hand, open a terminal (WSL or PowerShell is fine), and connect with the following command:

Accept the fingerprint by typing yes and hitting enter. If this is the first boot you'll need to log in with the default password, which is raspberry . It's a good idea to change this, but for the purposes of what we're doing here you don't need to and can just carry on with the next step.

Get the Windows Central Newsletter

All the latest news, reviews, and guides for Windows and Xbox diehards.

How to set a static IP on your Raspberry Pi

To set the static IP properly you'll need a few things. The first is the current IP of the Pi which you've already got, the next is your router's gateway IP and the current DNS IP address. We can get these last two from the Raspberry Pi terminal.

Router gateway IP address

Enter this command into the terminal:

Note down the first IP address given as this is the one you want.

Router DNS IP address

Again in the terminal, enter this command:

This will open a file in the nano text editor and the IP address you're looking for is immediately after nameserver . Note this down and press Ctrl + X to close out.

Setting the static IP address

Raspberry Pi Static Ip Config

The final step is to set the static IP address for your Raspberry Pi. It involves appending some details to the end of a configuration file. You must make sure you either use the IP address already given to your Raspberry Pi or that you're using an address that is currently vacant.

To begin, enter this command:

This will open up the dhcpcd.conf file in the nano text editor. Use your cursor keys to navigate all the way to the bottom.

Make sure not to change any of the existing items in this file, then at the bottom, you'll be entering a block of text following this template:

You'll replace the terms in capitals with the following:

  • NETWORKTYPE — Type either eth0 for ethernet or wlan0 for wireless.
  • YOURSTATICIP — Whatever static IP you want to assign to the Raspberry Pi.
  • YOURROUTERIP — The gateway IP address acquired above.
  • YOURDNSIP — The DNS IP address acquired above.

When finished you'll end up with something that looks a bit like this:

Now, press Ctrl + X followed by Y to close and save the file. You'll need to reboot the Pi for the changes to take effect, which you can do with this command. 

Give it a minute to reboot, reconnect over SSH, and then use this command. 

This will confirm the IP address matches what you set above. It should match, and now your Raspberry Pi should retain this IP any time it boots. Ensure you don't assign anything to this IP address, either manually or through your router settings, and you should be good to go!

Richard Devine

Richard Devine is a Managing Editor at Windows Central with over a decade of experience. A former Project Manager and long-term tech addict, he joined Mobile Nations in 2011 and has been found on Android Central and iMore as well as Windows Central. Currently, you'll find him steering the site's coverage of all manner of PC hardware and reviews. Find him on Mastodon at mstdn.social/@richdevine

  • 2 Microsoft begins showing full screen Windows 11 ad on Windows 10 PCs as end of support date looms
  • 3 How to change file formats on Windows 11
  • 4 Palworld shows off teaser trailer for upcoming PvP mode, 'Pal Arena'
  • 5 Call of Duty sees a new peak player count on Steam following a free trial for Multiplayer and the launch of Season 3

setting a static ip raspberry pi

ESP for Beginners logo

Recent Posts

Raspberry Pi

How to set a static IP address on a Raspberry Pi

Raspberry Pi's are transforming how we interact with technology, making it more accessible and versatile than ever. Whether you've dabbled with setting up a service on your Raspberry Pi or planning to, you probably know the importance of having a consistent IP address to maintain smooth sailing. It's no secret that IP addresses on Raspberry Pi's will reset after every reboot - and that can spell trouble for your services as it renders them unreachable. Sounds like a scenario you'd rather avoid, right? Well, that's where a static IP address comes in handy.

In this post, I'll walk you through the simple steps of setting a static IP address for your Raspberry Pi. But first, let's dive in a bit deeper to understand what a static IP address is and why there isn't a one-size-fits-all approach to achieving it.

What is a static IP address?

In the simplest terms, a static IP address ensures your devices maintain a constant IP address on your Local Area Network (LAN) - yes, even after rebooting. This comes with an array of benefits. From knowing exactly what services run on what IP address to allowing you to set up intricate systems with different devices.

What are some ways to set a static IP address?

Styles may be different, but the end goal is the same. There are several routes to set a static IP address, and each achieves the same result. One simple approach is to allocate an IP address to your device directly from your router. This method is usually the easiest and most reliable because it eliminates potential IP conflicts. The router takes on the role of allocating IP addresses which means no duplicates.

But let's look at an alternative method. We'll be assigning a static IP address to the device itself. Here's a simple analogy to understand it better. Instead of the router saying, "Hey, you're 192.168.1.10!" the device says, "Can I be 192.168.1.10?". While straight-forward, this method has the potential for IP conflicts, especially with a lot of devices needing management through the router. Don't worry, though! This is a relatively rare occurrence for home networks and is more commonly seen in larger spaces with multiple devices, like offices.

Setting a static IP address in your Raspberry Pi

Armed with an understanding, it's time we dive in. Begin by switching on your Raspberry Pi and opening a terminal. You can achieve this through the device itself or SSH, but I'd recommend doing it directly through the device for more straightforward navigation.

Now, open the configuration:

Scroll to the bottom of the file and insert these lines:

Let's break it down:

  • interface wlan0 - This is for the Wi-Fi connection. For a wired connection, switch wlan0 with eth0.
  • static ip_address=192.168.1.10/24 - This sets the static IP to 192.168.1.10. Feel free to customize this to any IP address you prefer.
  • static routers=192.168.0.1 - This should be the IP address of your router. Be mindful as this may vary, so double-check if necessary.
  • static domain_name_servers=192.168.0.1 - Set the name_server to your router as well. This ensures your Raspberry Pi allows the router to resolve any potential network issues.

With these steps done, save the file and use the final command to activate the changes:

Consequently, this refreshes the network service and requests your static IP. If you face any network connection issues within about 10-20 seconds, there may be an IP conflict. Don't sweat it. Just repeat the steps and choose a different static IP address.

A crucial note for those using SSH is that once you run the last command, you'll be logged out. Why? The device's temporary disconnection from the network. After a brief period (10-20 seconds), you can log back in using your new static IP.

Setting a static IP address for your Raspberry Pi is as easy as 1-2-3 and has a multitude of benefits. Prime among them is optimizing your network by making it easier to locate your services. Not to mention, you'll be able to access any established services on the same IP address, despite restarting your Raspberry Pi.

Have any questions, hitches, or ingenious solutions on this topic? Feel free to reach out to me on Twitter . I'd love to hear your thoughts!

Frequently asked questions

Sign up for our daily newsletter

  • Privacy Policy
  • Advertise with Us

How to Use a Static IP Address and Setup SSH on a Raspberry Pi

Gary Sims

Like most Linux systems, the Raspberry Pi allows you to connect to it over SSH and although it is possible to make a SSH connection to a Pi with a dynamically allocated IP address, it is much easier to configure the device with a static IP address. By default, the Raspberry Pi is set up to get its IP address dynamically using DHCP. This is great for many situations, however where the Pi is acting as a server (which it does when you connect over SSH) then having a fixed IP address means you always know the address of your Pi without having to log in and run ipconfig to obtain the current address.

The IP address is configured in the file /etc/network/interfaces and we will need to edit this file to change the configuration from dynamic to static. But before we do that, we need to discover what address range is being used on your network. A typical home network uses one of the following ranges of IP address: 192.168.1.1 – 192.168.1.255 or 10.1.1.1 to 10.1.1.255. There are other variations as in fact all the addresses between 192.168.0.0 – 192.168.255.255 and 10.0.0.0 – 10.255.255.255 are designated for use on private networks.

To discover your current IP address use the following command:

raspberry-pi-ifconfig

In the eth0 section, the second line displays the Internet address, the Broadcast address and the Netmask. Note down the Internet address and the Netmask for later on.

Most networks have a default gateway (often the router or modem from your Internet Service Provider) where all traffic is routed if it can’t be resolved locally. This is normally configured via DHCP when the IP address is assigned, but for a static address it needs to be defined manually. To discover the current default gateway type:

raspberry-pi-route-n

The default gateway is listed on the line with the G flag, in my case 192.168.1.1 which is actually the router from my ISP. Note down the default gateway for later on.

Before editing the /etc/network/interfaces file, you need to decide what IP address you want to use as the permanent address for your Pi. On your network the .1 or .254 addresses are probably taken by your router, modem or wireless access point. There will also be a range of addresses assigned for DHCP, normally by your router or modem. If you don’t know what that range is and you don’t know how to use your router’s web interface to check, then the easiest thing to do is pick an address far away from the dynamic one your Pi currently has. For example, my Raspberry Pi has an IP address of 192.168.1.164. Since there are a few PCs and the odd tablet in my house I could take a guess that the DHCP address range defined by my router starts at 192.168.1.160, which it does. Therefore a good IP address for my Pi would be somewhere far from that range, say 192.168.1.20. By picking an address away from the DHCP range and away from .1 or .254 then I am limiting the chances of there being an address clash. Of course, the correct way to do this is discover how your router or modem is configured and then plan your network accordingly, don’t ever tell a real network engineer that you did it by guessing!

If you want a better picture of your network, try installing the nmap package and use nmap -sn 192.168.1.* to find which devices are on your network. Where 192.168.1.* is the first three parts of the network address you are using plus an asterisk.

Once you have picked an IP address edit the /etc/network/interfaces file:

Find the line which reads iface eth0 inet dhcp and replace it with:

But put the address, netmask and gateway that you noted down previously. Press “Ctrl + X” to leave the nano editor and type “Y” to confirm that the file should be saved. Press ENTER to keep the current filename (i.e. /etc/network/interfaces). Now reboot.

Now that your Pi has a static IP address you can configure the SSH server. This is done via raspi-config .

raspberry-pi-enable-ssh

From within raspi-config , select option 8 ( Advanced Options ) and then option A4 ( SSH ). When asked “Would you like the SSH server enabled or disabled”, select “Enable” and finally select “OK”.

You can now connect to your Pi using SSH. If you have another Linux machine, simply use the ssh command. For Windows try the popular PuTTY program or alternatively use the SSH extension for Chrome.

Image credit: Regular Raspberry Pi

Our latest tutorials delivered straight to your inbox

Gary Sims

Gary has been a technical writer, author and blogger since 2003. He is an expert in open source systems (including Linux), system administration, system security and networking protocols. He also knows several programming languages, as he was previously a software engineer for 10 years. He has a Bachelor of Science in business information systems from a UK University.

How to Set a Static IP Address on a Raspberry Pi 5

This tutorial explains how to set a static IP address on a Raspberry Pi 5 using nmcli

nmcli vs. dhcpcd

Setting the static ip, my ip address changed but ping 8.8.8.8 doesn't work.

Ideally you already have your Raspberry Pi set up and connected to a network that has assigned you an IP address using DHCP. In my case, the network I will be modifying was set up when I imaged the Raspberry Pi OS to my SD card (the Wi-Fi connection).

A lot of tutorials you may find for setting a static IP address on a Raspberry Pi will mention dhcpcd. As discussed here , dhcpcd was replaced with nmcli in the newer releases.

First, we need to find the name of the configuration to update. Run nmcli con show to show all connections, this will output something like this:

I want to update the configuration associated with Wi-Fi which is device wlan0 - this means the configuration I need to update is "preconfigured".

Next set the the IPv4 address, you will need to substitute your configuration name and IPv4 address in CIDR notation in this command: nmcli con mod <configuration name> ipv4.addresses <ip address> . So I would run,

Next set the IPv4 gateway, for a lot of people, this will be the IP address of your router,

Next set the DNS, again, you could use your router but you could also use another like 8.8.8.8 ,

Next set the addressing from DHCP to static,

Restart the connection to pick up these changes,

Check your new IP address with ip addr show wlan0 (or whatever device you are using). Lastly check your network connectivity by doing a quick ping using ping 8.8.8.8 .

Potential Issues

If you can see the Raspberry Pi has the new IP address but it cannot talk to the internet, you may have forgotten to set the DNS or have set it to something that isn't a DNS.

  • Feature image

ElectronicsHacks

How to Extract Gold from Electronics Without Chemicals?

Raspberry Pi Serial (UART) Tutorial

Raspberry Pi Serial (UART) Tutorial

Half-Bridge vs. Full-Bridge: What is the Difference?

Half-Bridge vs. Full-Bridge: What is the Difference?

How to set a static ip address on raspberry pi.

setting a static ip raspberry pi

From building smart home systems to crafting intricate web servers, the Raspberry Pi’s potential seems boundless. Yet, amidst this technological marvel, lies a fundamental consideration that often determines the efficiency and accessibility of these projects: the choice between a dynamic and a static IP address.

An IP address, akin to a digital passport, distinguishes each device within a network, facilitating data transmission and routing across the internet or a local connection [1] . While dynamic IP addresses are automatically assigned by routers through DHCP, a static IP address offers a consistent, predetermined identity for a Raspberry Pi, a feature indispensable for projects necessitating unwavering connectivity and accessibility. This guide illuminates the nuanced journey of configuring such a steadfast address, providing step-by-step instructions to navigate the process with confidence and ease.

By equipping users with the knowledge to harness a static IP address for their Raspberry Pi, this guide transcends the mundane and ventures into a realm where digital landscapes are seamlessly interconnected, where web services hum with reliability, and where remote access is as straightforward as it is secure.

As we embark on this exploration, we unveil the significance of a static IP address and empower Raspberry Pi enthusiasts to transcend the boundaries of dynamic networking, ensuring that their projects thrive with uninterrupted communication and steadfast connectivity.

What Is An IP Address?

It serves two primary purposes:

  • Device Identification: An IP address is used to uniquely identify devices (such as computers, smartphones, servers, routers, etc.) on a network. Just as a street address helps identify a physical location, an IP address identifies a device’s location in the digital world;
  • Routing and Communication: IP addresses are crucial for routing data packets across the internet or any network. When you send data over the internet, it is broken down into small packets, and these packets are routed from one device to another based on their IP addresses. IP addresses help ensure that data reaches the intended destination and can be sent back if a response is needed;

IP addresses come in two main versions: IPv4 (Internet Protocol version 4) and IPv6 (Internet Protocol version 6). IPv4 addresses are written in a format like “192.168.1.1”, consisting of four sets of numbers ranging from 0 to 255. Due to the rapid growth of devices connecting to the internet, IPv4 addresses are running out, which led to the development of IPv6. IPv6 addresses are much longer and follow a hexadecimal format like “2001:0db8:85a3:0000:0000:8a2e:0370:7334” [2] .

What Is An IP Address?

IP addresses are managed by regional internet registries (RIRs) that allocate blocks of addresses to internet service providers (ISPs), organizations, and other entities. ISPs then assign IP addresses to their customers, allowing them to connect to the internet.

IP addresses play a fundamental role in Internet communication, enabling devices to find and interact with each other across vast networks.

Private vs. Public IP

Private ip address.

A private IP address is used within a local network to uniquely identify devices. Private IP addresses are not directly reachable from the internet and are primarily meant for local communication. They are commonly used in homes, businesses, and other organizations to establish a network of devices.

Private IP addresses are part of reserved address ranges defined by the Internet Assigned Numbers Authority (IANA). The most common private IP address ranges for IPv4 are:

10.0.0.0 to 10.255.255.255 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255

These addresses can be assigned to devices within a local network, such as computers, printers, smartphones, and other devices connected to a router. Private IP addresses are used for internal communication, such as file sharing, device discovery, and data exchange within the same network [3] .

Public IP Address:

A public IP address is assigned to a device by the internet service provider (ISP) and is used to identify the device on the global internet. It is unique across the entire internet and serves as the address that other devices use to communicate with the device over the internet. Public IP addresses are essential for accessing websites, sending and receiving emails, and other internet-based activities.

When you access a website or send data to a server on the internet, your device uses its public IP address to establish the connection. The server’s response is then sent back to your public IP address, and your router forwards the response to the appropriate device within your local network.

Public IP addresses are a limited and valuable resource, which is why ISPs allocate them based on their available address pool. In some cases, multiple devices within a local network share a single public IP address using a technique called Network Address Translation (NAT). NAT allows multiple devices to access the internet through a single public IP address by mapping internal private addresses to a single public address.

Private vs. Public IP

Why Do You Need A Static IP Address For Your Raspberry Pi?

Before delving into the benefits of a static IP address, it’s important to grasp the concept of an IP address. An IP (Internet Protocol) address is a unique numerical label assigned to each device connected to a network. It serves as the device’s digital identifier, enabling it to send and receive data over the internet or a local network. Think of an IP address as a virtual home address that helps data packets find their way to the correct recipient.

Dynamic vs. Static IP Addresses

By default, most networks assign dynamic IP addresses to devices. A dynamic IP address is temporary and subject to change each time a device connects to the network. While this setup works well for general internet browsing and casual use, it may not be ideal for certain scenarios, particularly those involving devices that need consistent and predictable connectivity, like a Raspberry Pi [4] .

A static IP address, on the other hand, is one that remains constant and does not change each time the device connects to the network. It’s like having a dedicated parking spot for your device on the network. This static assignment can be especially advantageous for Raspberry Pi projects that require uninterrupted communication and accessibility.

Benefits of a Static IP Address for Your Raspberry Pi

Reliable access and connectivity.

When your Raspberry Pi has a static IP address, you can access it reliably from other devices on the network. This is particularly important for remote access, such as SSH (Secure Shell) connections, VNC (Virtual Network Computing) access, or accessing web-based applications hosted on the Raspberry Pi. With a dynamic IP address, you might find yourself searching for the device’s new IP address each time it reconnects to the network, causing inconvenience and potential disruptions.

Easy Networked Services Setup

Many Raspberry Pi projects involve setting up services that other devices interact with. These could be a file server, a media center, a home automation system, or even a web server. Having a static IP address simplifies the process of configuring these services, as you can reliably specify the Raspberry Pi’s address in your configurations. This makes it easier for other devices to locate and communicate with the Raspberry Pi.

Port Forwarding and External Access

If you intend to expose your Raspberry Pi to the internet for tasks like hosting a website or accessing it remotely from outside your local network, a static IP address is crucial. When you have a static IP, you can easily set up port forwarding on your router, directing incoming requests to the Raspberry Pi’s fixed address. This ensures that external devices can reliably connect to your Raspberry Pi without having to constantly update IP addresses.

Benefits of a Static IP Address for Your Raspberry Pi

Network Monitoring and Security

For network monitoring and security purposes, having a consistent IP address can be invaluable. With a static IP, you can easily track Raspberry Pi’s activity, apply access control rules, and monitor traffic patterns. This is especially important if you’re using the Raspberry Pi for network analysis, intrusion detection, or other security-related tasks.

Integration with DNS and Domain Names

If you’re hosting services like websites or applications on your Raspberry Pi, having a static IP address simplifies domain name configuration. You can associate a domain name with Raspberry Pi’s fixed IP address, allowing users to access your services using a memorable and user-friendly URL.

How to Setup a Raspberry Pi Static IP Address:

1. required equipment.

  • Raspberry Pi (any model);
  • Micro SD Card (with Raspberry Pi OS installed);
  • Power supply;
  • Ethernet cable or Wi-Fi dongle (depending on your network preference);
  • Raspberry Pi case (for protection);
  • HDMI cable;
  • USB keyboard;

Having the recommended equipment will ensure a smoother setup process, while the optional items can enhance your overall Raspberry Pi experience.

2. Prerequisites: Get the Network Configuration

Before you begin setting up a static IP address, it’s important to gather some information about your network configuration. You’ll need details such as the IP address range used by your router and the IP address of the router itself. This information is vital for configuring the static IP address effectively [5] .

3. Get the IP Address of Your Router

Log in to your router’s administration interface. This is usually done by entering the router’s IP address into a web browser. Once logged in, navigate to the network settings section, where you can find the router’s IP address. Note down this IP address; you will need it later.

4. Set a Static IP for the Raspberry Pi on the Router

Within the router’s administration interface, look for the option to set static IP addresses. This option might be labeled as “Static IP Reservation” or something similar. Associate your Raspberry Pi’s MAC address with a specific IP address within the router’s DHCP settings. This ensures that the router assigns the same IP address to your Raspberry Pi every time it connects to the network.

How to Setup a Raspberry Pi Static IP Address:

5. Get the DHCP Range

While still in the router’s administration interface, find the DHCP range. This is the range of IP addresses that the router can automatically assign to devices when they connect to the network. Make a note of the starting and ending addresses of this range.

6. Get a List of the Currently Used IP Addresses

To avoid assigning an IP address that is already in use, check the list of currently assigned IP addresses on your network. Most routers provide a list of connected devices along with their IP addresses. Make sure the IP address you choose for your Raspberry Pi is outside the DHCP range and is not already in use by another device.

7. Set a Static IP on Raspberry Pi OS Desktop

If you’re using the Raspberry Pi OS desktop version, follow these steps:

  • Click on the network icon in the top-right corner of the desktop;
  • Select “Wireless and Wired Network Settings”;
  • In the “Connection” tab, click on the wired or wireless connection you’re using;
  • Click on the gear icon to open the settings for that connection;
  • In the IPv4 tab, change the method to ‘Manual”;
  • Enter the IP address, subnet mask, gateway, and DNS server addresses;
  • Click “Apply” to save the settings;

8. Set a Static IP in the Command Line

If you’re comfortable working with the command line, you can set a static IP address using the terminal:

  • Open a terminal window on your Raspberry Pi;
  • Edit the dhcpcd.conf file: sudo nano /etc/dhcpcd.conf;
  • Scroll down to the interface you’re using (e.g., eth0 for Ethernet or wlan0 for Wi-Fi);

Add the following lines, replacing the values with your network information:

interface static ip_address=/24 static routers= static domain_name_servers=

Press Ctrl + O to save the file, then Ctrl + X to exit.

Restart the dhcpcd service: sudo service dhcpcd restart

9. Setting Up the Terminal

If you prefer the terminal approach, follow these steps [6] :

  • Edit the interfaces file: sudo nano /etc/network/interfaces;
  • Find the interface configuration (e.g., eth0 for Ethernet or wlan0 for Wi-Fi);

iface inet static address netmask gateway dns-nameservers

Restart the networking service: sudo service networking restart

How to Setup a Raspberry Pi Static IP Address:

10. Prioritizing Internet Interface

If you’re using both Ethernet and Wi-Fi connections, you can prioritize one over the other. To do this:

Scroll to the bottom of the file and add the following lines:

interface metric

Replace with the name of the interface (e.g., eth0 or wlan0) and with a lower value for the interface you want to prioritize.

Press Ctrl + O to save the file, then Ctrl + X to exit

11. Disabling Static IP Address

If you wish to revert to using a dynamic IP address, follow these steps:

  • Find the interface configuration and remove the static IP settings you added;
  • Press Ctrl + O to save the file, then Ctrl + X to exit;
  • Restart the dhcpcd service: sudo service dhcpcd restart;

12. Testing the Static IP

To ensure that your Raspberry Pi is successfully configured with a static IP address, follow these steps:

  • Reboot your Raspberry Pi: sudo reboot;
  • After the reboot, check the IP address: ip a;

You should see your chosen static IP address listed alongside the network interface you configured.

How to Assign a Static IP to a Raspberry Pi:

Determine raspberry pi’s current ip v4 address.

Before making any changes, it’s important to know your Raspberry Pi’s current IP address. This can be easily found using the following command in the terminal:

hostname -I

Make a note of this IP address, as you will need it for reference during the configuration process.

Get Router’s IP Address If You Don’t Already Know It

To assign a static IP to your Raspberry Pi, you’ll need to access your router’s configuration page. This typically involves typing the router’s IP address into a web browser. If you’re unsure of your router’s IP address, you can often find it in your router’s manual or through a quick online search.

How to Assign a Static IP to a Raspberry Pi:

Get the IP Address of DNS (Domain Name Server)

DNS servers translate domain names (like www.example.com) into IP addresses that computers can understand. You’ll need to know the IP addresses of your DNS servers to ensure proper connectivity. Your ISP’s DNS servers are usually used by default, but you can also use public DNS servers like Google’s (8.8.8.8 and 8.8.4.4) or Cloudflare’s (1.1.1.1) [7] .

Open /etc/dhcpcd.conf For Editing In Nano

To begin the static IP assignment process, you’ll need to edit the dhcpcd.conf file. This file controls various network settings, including IP addresses, on your Raspberry Pi. Open the file using the Nano text editor:

sudo nano /etc/dhcpcd.conf

Add The Following Lines To The Bottom Of The File

Navigate to the bottom of the dhcpcd.conf file, where you’ll add the configuration for the static IP address. The format should look something like this:

interface static ip_address=/ static routers= static domain_name_servers=

Replace with the appropriate interface (e.g., eth0 for Ethernet or wlan0 for Wi-Fi), with the desired static IP address, with the appropriate subnet mask (often /24 for a common home network), with your router’s IP address, and with the IP address of your preferred DNS server.

Save The File By Hitting CTRL + X And Reboot

Once you’ve added the necessary lines, save the changes to the dhcpcd.conf file by pressing Ctrl + X, then Y to confirm the changes, and finally Enter.

To apply the new static IP configuration, you’ll need to reboot your Raspberry Pi:

sudo reboot

After the reboot, your Raspberry Pi should be using the static IP address you configured.

How to Assign a Static IP to a Raspberry Pi:

Testing the Static IP Address

To confirm that the static IP address has been successfully assigned to your Raspberry Pi, you can use the ifconfig command. Open a terminal window and type:

Look for the interface you configured (e.g., eth0 or wlan0) and verify that the assigned IP address matches the one you set as static.

Using the Raspberry Pi OS Guide to Set a Static IP

To begin the process of setting a static IP address on your Raspberry Pi, you’ll utilize the user-friendly interface of the Raspberry Pi OS. Follow these steps:

  • Locate the Network Status Icon: In the top-right corner of your Raspberry Pi OS desktop, you’ll find a network status icon, often represented as two arrows pointing up and down. This icon signifies your network connection status;
  • Right Click: Right-click on the network status icon to reveal a context menu. This menu provides access to various network-related options;
  • Select Wireless & Wired Network Settings: From the context menu, navigate to the “Wireless & Wired Network Settings” option. Clicking on this option will open a new window where you can configure your network settings;

Select The Appropriate Interface

Carefully review the available interfaces and select the appropriate one that corresponds to your network connection. For example, if you’re connected via Ethernet, choose the “eth0” option. If you’re using Wi-Fi, select “wlan0”.

Using the Raspberry Pi OS Guide to Set a Static IP

Enter the IP Addresses Into The Relevant Fields

Setting a static IP address involves entering specific values into the relevant fields. These values include the desired IP address, subnet mask, gateway address, and DNS server addresses.

Follow these steps to input the necessary information:

  • IP Address: In the “IPv4 Method” section, select the “Manual’ option. This indicates that you’ll be manually entering the IP address;
  • Static IP Address: Enter your chosen static IP address in the designated field. Ensure that the IP address you select is within the valid IP range for your network;
  • Subnet Mask: Input the subnet mask for your network. The subnet mask helps define the network’s boundaries and enables proper communication between devices;
  • Gateway: Enter the IP address of your router or gateway. This address serves as the entry point for communication between your Raspberry Pi and other devices on the network;
  • DNS Servers: Finally, input the IP addresses of your preferred DNS servers. DNS servers are responsible for translating domain names into IP addresses, facilitating internet connectivity [8] ;

Click Apply, Close The Window, And Reboot Your Pi

After entering the necessary IP address details, it’s time to apply the changes and ensure that they take effect. Follow these steps:

  • Apply Changes: Once you’ve entered the required IP address information, locate the “Apply” button within the “Wireless & Wired Network Settings” window. Click on the “Apply” button to implement the changes;
  • Close the Window: After applying the changes, close the “Wireless & Wired Network Settings” window. Your static IP address configuration is now in place;
  • Reboot Your Raspberry Pi: To ensure that the static IP address settings are fully integrated, it’s recommended to reboot your Raspberry Pi. You can do this by clicking on the Raspberry menu in the top-left corner, selecting “Shutdown”, and choosing the “Reboot” option;

Using the Raspberry Pi OS Guide to Set a Static IP

1. How to assign a static IP address to my Raspberry Pi?

To assign a static IP address to your Raspberry Pi, you need to edit the network configuration file. Here’s a step-by-step guide:

Open a terminal on your Raspberry Pi.

Edit the dhcpcd.conf file using a text editor like Nano:

Scroll to the bottom of the file and add the following lines (replace the values with your network configuration):

Press Ctrl + O to save the file, then Enter. Press Ctrl + X to exit Nano .

Restart the dhcpcd service:

sudo service dhcpcd restart

2. How to configure static IP in Raspberry Pi 4?

The process of configuring a static IP on a Raspberry Pi 4 is the same as on other Raspberry Pi models. Follow the steps mentioned above for assigning a static IP address to your Raspberry Pi.

3. Does Raspberry Pi have a static IP address?

By default, the Raspberry Pi obtains an IP address dynamically from a DHCP server. However, you can manually configure a static IP address for your Raspberry Pi by editing the network configuration file (dhcpcd.conf).

4. How can you set a static IP address free?

Setting a static IP address for your devices, including a Raspberry Pi, is typically a configuration option provided by your router’s settings. Most home routers allow you to assign static IP addresses to devices on your network through the router’s administration interface. This feature is usually available without any additional cost.

5. What is the IP address 127.0.0.1 Raspberry Pi?

The IP address 127.0.0.1 is the loopback address, also known as the “localhost”. It always refers to the current device itself. When used on a Raspberry Pi or any other device, it points to the device’s own network interface. It’s commonly used for testing network software and services on the local machine.

6. What are static IP and DHCP in Raspberry Pi?

A static IP address is manually assigned to a device and remains constant. It doesn’t change each time the device connects to the network. DHCP (Dynamic Host Configuration Protocol) is a network protocol that dynamically assigns IP addresses to devices on a network. Raspberry Pi can use either a static IP or obtain an IP dynamically through DHCP.

7. Why does static IP keep changing Raspberry Pi?

If a static IP address keeps changing on your Raspberry Pi, it may be due to incorrect configuration or conflicts with other devices on the network. Make sure that the chosen static IP is outside the DHCP range and not assigned to another device. Additionally, ensure the correct configuration in the dhcpcd.conf file.

8. What is the command for the Raspberry Pi IP address?

To view the IP address of your Raspberry Pi, open a terminal and use the command:

9. How to set a static IP address in the command prompt?

Setting a static IP address involves editing the network configuration file. Open a terminal and use a text editor like Nano to edit the dhcpcd.conf file:

Then, follow the steps mentioned earlier for adding the static IP configuration.

10. How to set a static IP address in Arduino?

Arduino devices typically don’t have built-in network interfaces like Raspberry Pi. However, if you’re referring to connecting an Arduino to a network, the process depends on the specific hardware and networking shield you’re using with the Arduino. Consult the documentation for your Arduino hardware and networking shield to configure network settings.

11. Is static IP better for gaming?

A static IP address isn’t inherently better for gaming. It can be useful if you want to ensure that your gaming device (like a console or PC) consistently uses the same IP address on your local network. However, it doesn’t directly impact gaming performance. Other factors, such as network quality and latency, have a more significant impact on the gaming experience.

12. Does Raspberry Pi IP address change?

By default, the Raspberry Pi’s IP address can change if it is configured to obtain an IP address dynamically from a DHCP server. However, if you set up a static IP address, it will remain constant unless you manually change it.

13. Why doesn’t Raspberry Pi get an IP address?

If your Raspberry Pi is not obtaining an IP address, it could be due to network configuration issues, DHCP server problems, or connectivity problems. Check your router’s DHCP settings, network cables, and ensure that your Raspberry Pi is correctly connected to the network.

14. How to enable SSH on Raspberry Pi?

To enable SSH on your Raspberry Pi, follow these steps:

  • Open a terminal on your Raspberry Pi;
  • Run the command: sudo raspi-config;
  • Navigate to “Interfacing Options” and select “SSH”;
  • Choose “Yes” to enable SSH;
  • Reboot your Raspberry Pi;

15. What is the SSH password for Raspberry Pi?

The default SSH password for the Raspberry Pi user “pi” is “raspberry.” It’s recommended to change this password for security reasons after enabling SSH.

16. Does static IP cost more?

Assigning a static IP address to a device within your local network usually does not incur any additional costs. However, if you’re obtaining a public static IP address from your internet service provider (ISP), there may be associated costs. Public static IPs are often used for hosting websites or remote access and may require a fee from your ISP.

17. Is static IP more secure than DHCP?

Static IP addresses themselves do not inherently provide better security than DHCP. Security is influenced by various factors, including firewall settings, network infrastructure, and software configurations. However, using static IP addresses can simplify network management and reduce the risk of IP address conflicts, which could indirectly contribute to a more stable and potentially secure network environment.

Useful Video: How to Assign Static IP Address to Raspberry Pi!

  • https://www.tomshardware.com/how-to/static-ip-raspberry-pi
  • https://www.makeuseof.com/raspberry-pi-set-static-ip/
  • https://www.ionos.com/digitalguide/server/configuration/provide-raspberry-pi-with-a-static-ip-address/
  • https://phoenixnap.com/kb/raspberry-pi-static-ip
  • https://raspberrypi-guide.github.io/networking/set-up-static-ip-address
  • https://raspberrytips.com/set-static-ip-address-raspberry-pi/
  • https://pimylifeup.com/raspberry-pi-static-ip-address/
  • https://lededitpro.com/static-ip-address-on-raspberry-pi/

What Does the Battery Fuse Do?

What Does the Battery Fuse Do?

How to protect outdoor extension cord from rain.

What Does a Fiber Optic Cable Look Like?

What Does a Fiber Optic Cable Look Like?

Klipper raspberry pi alternatives.

How to Use a Raspberry Pi for Time Machine Backups?

How to Use a Raspberry Pi for Time Machine Backups?

How to Use MPU6050 Accelerometer on Raspberry Pi?

How to Use MPU6050 Accelerometer on Raspberry Pi?

How to Port Forward Raspberry Pi?

How to Port Forward Raspberry Pi?

the pi hut logo

  • Compute Module 4
  • Kits & Bundles
  • Flash Drives
  • Card Readers
  • Accessories
  • Power Supplies
  • Power over Ethernet (PoE)
  • Breakout Garden
  • GPS, GSM & LoRa
  • Motor & Servo Control
  • Port Expanders
  • Power Management
  • Prototyping
  • Real Time Clock
  • Serial & I2C
  • Raspberry Pi 5
  • Raspberry Pi 4
  • Raspberry Pi 3
  • Raspberry Pi 3A+
  • Raspberry Pi Zero
  • Case Accessories
  • DIN & Rack
  • Display/Screen
  • Media Centre
  • Retro Gaming
  • Heatsinks & Fans
  • Cooling Cases
  • Camera Modules
  • USB Cameras
  • Mini Displays
  • Medium Displays
  • Large Displays
  • Touchscreen Displays
  • ePaper Displays
  • GPIO Connection
  • HDMI Connection
  • Display Accessories
  • Adapters & Accessories
  • Game Controllers
  • Keyboards & Mice
  • Remote Controls
  • WiFi & Ethernet
  • Buttons & Joysticks
  • HATs & Control Boards
  • Merch & Accessories
  • Wires & Connectors
  • Merch & Clothing
  • Notepads & Pens
  • Peripherals
  • Stickers & Badges
  • Amplifiers & Modules
  • Cables & Connectors
  • Microphones
  • Speakers & Headphones
  • ADC & DAC
  • Flat Cable (FFC/FPC)
  • GPIO Expanders
  • GPS & GSM
  • Logic Level
  • DIY Cables & Connectors
  • Buttons & Switches
  • Component Kits
  • Integrated Circuits
  • Oscillators
  • Transistors
  • Circuit Playground
  • QT Py & XIAO
  • Trinkey & Trinket
  • Kits & Projects
  • DotStar & APA102
  • NeoPixels & WS2812
  • Standard LEDs
  • Strips & Sticks
  • Battery Holders
  • Boost Converters
  • Power over Ethernet
  • Regulators & Buck Converters
  • Breadboards
  • Crocodile Clips
  • Jumper Wires
  • PCBs & Perfboard
  • SMT Breakouts
  • Wire & Heat Shrink
  • Motor Drivers
  • Mounting Hubs
  • Stepper Motors
  • Wheels & Tracks
  • Accelerometers
  • Body & Muscle
  • Environment & Air Quality
  • Fingerprint
  • Force & Weight
  • Hall, Reed & Magnet
  • IMU & Gyro
  • Light & Colour
  • Line Following
  • Liquid & Moisture
  • NFC & RFID
  • Temperature
  • Tilt & Vibration
  • Voltage & Current
  • Filament & Resin
  • The micro:bit
  • Add-ons & Extensions
  • Cables & Accessories
  • Official Arduino Boards
  • Compatible Boards
  • GPS & GSM Shields
  • Input & Button Shields
  • LED Shields
  • Prototyping Shields
  • Relay Shields
  • Robotics Shields
  • Sensor Shields
  • Serial Shields
  • Other Shields
  • Raspberry Pi Gifts
  • Maker Gifts
  • Micro:bit Gifts
  • Arduino Gifts
  • Gifts Under £10
  • Gifts Under £20
  • Gifts Under £50

Login / Signup

from just £2.99

147,000+ reviews

support portal

order by 2pm*

Your cart is empty

How to give your Raspberry Pi a Static IP Address

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

This tutorial will show you how to set a static IP address on your Raspberry 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 (but this should work on most versions).

We 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 file (/etc/network/interfaces). I hope you made a backup, because you’ll 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 file

sudo nano /etc/dhcpcd.conf

setting a static ip raspberry pi

Scroll all the way to the bottom of the file 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.

You’ll need to edit the numbers in the snippet so they match your network configuration.

interface = This defines which network interface you are setting the configuration 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!

You can double check by typing

And checking the interfaces IP address

setting a static ip raspberry pi

Featured Products

Raspberry Pi 4 Model B - The Pi Hut

Ulrich Kneidl

in a special use case i need two different addresses over the ethernet/lan port. for example 192.168.100.23 and at the same time 10.168.100.23. is this easy to realize? somewhere i read about a command eth0 add, but i don’t know how to use it.

Leave a comment

All comments are moderated before being published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

setting a static ip raspberry pi

Create your address on the web.

  • Domain Check

Move your domain name to IONOS.

  • Free Domain

Secure site traffic and build trust.

Create your own website easily.

Our experts build your website.

Create your own online store.

Fast, scalable hosting for any website.

Optimized for speed, reliablity and control.

Reach out with your own email address.

Secure and share your data on the go.

Powerful Exchange email and Microsoft's trusted productivity suite.

Pay as you go with your own scalable private server.

  • Virtual Private Servers (VPS)

Get enterprise hardware with unlimited traffic

Individually configurable, highly scalable IaaS cloud

  • Business Name Generator
  • Logo Creator
  • Favicon Generator
  • Whois Lookup
  • Website Checker
  • SSL Checker
  • IP Address Check
  • Configuration

Equip Raspberry Pi with a static IP address

How to set a Raspberry Pi with a static ip address?

A static IP address , as opposed to a dynamic IP address, doesn’t change. The single-board computer Raspberry Pi always needs a static IP address if you want to access it with other devices over a long period of time. This refers to the private IP address of the Raspberry IP that is located by a computer within the local network as well as the public IP address of the network via which the Raspberry Pi is accessible on the internet (for example, if it’s being used as a server). But how do you provide Raspberry Pi with an IP address that always remains the same? This guide explains which options you have for linking a static IP address to your Raspberry Pi.

Addressing Raspberry Pi in the LAN via a private IP address

Addressing the raspberry pi on the internet via a public ip address or ddns, assign a static private ip address to raspberry pi with a router, assign a static private ip address to raspberry pi with dhcpcd, static ip addresses for raspberry pi are sometimes vital.

Cheap domain names

Domains as original as your ideas. What are you waiting for?

Make your project a success with the perfect domain extension!

Addressing Raspberry Pi via a static IP address

For many projects with the small computer, it’s either useful or necessary to provide Raspberry Pi with a static IP address. But before we talk more specifically about the use of such a static IP address with Raspberry Pi, we’ll first outline the differences between addressing a computer in a private (local) network or on the publicly accessible internet . Private and public IP addresses are not to be confused with each other.

Within a local network (also called a Local Area Network, or LAN for short), a router distributes data to various devices. The router is also responsible for IP address assignment – more specifically, the DHCP server integrated in the router is responsible. For example, the DHCP (Dynamic Host Configuration Protocol) automatically assigns free IP addresses to the corresponding devices. Computers, smart TVs, smartphones, or a Raspberry Pi each receive such an address via which they can communicate with other devices. Therefore, all devices are uniquely identifiable via their so-called MAC address .

Since IP addresses in a private network are individually assigned by the DHCP and the coupling of devices to an IP address is only valid within your local network, here we’re talking about private IP addresses . In the default settings, Raspberry Pi also receives its IP address via the DHCP server. The private IP addresses of individual devices can change though, depending on the configuration of the DHCP server.

To be able to reach Raspberry Pi on the same address in your own LAN, you have to provide it with a static, private IP address . One such static IP address for Raspberry Pi can be used, for example, for the remote maintenance of a computer within the network protocol SSH (Secure Shell): If you have an SSH programme installed, you can control the Raspberry Pi via another computer using the SSH client. This has the advantage that you don’t have to connect a monitor and input device separately for operation anymore. But if the minicomputer only has a dynamic private IP address, then you have to reselect the current IP address for every SSH access and link it to the SSH client – you bypass this step with a static private IP address.

A static private IP address is essential for your Raspberry Pi if you want to set it up as a server in the LAN . If the Raspberry Pi server is also to continue being available outside of the local network, then you have to assign it another static address via which the server can be accessed on the internet. For example, an internet connection with a static public IP address or a DDNS service.

If the Raspberry Pi is to be used as a server accessible over the internet, then the public IP address of your internet connection comes into play. Most internet access is available via dynamic IP addresses that are changed every time they start and at the latest every 24 hours. This changes the public IP address with which the Raspberry Pi server can be reached.

If you want to set up your Raspberry Pi as an ownCloud server or in another server form, the following problem occurs: As soon as the server receives a new IP address, it can only be traced in the LAN. If you want to be found outside of the local network, you no longer know which address the server can be reached on. The solution to this is a fixed IP address. The simplest variation here would be to use an internet connection with a static public IP address . But this is usually quite expensive, and isn’t offered by all internet service providers.

Another solution is the application of dynamic DNS (DDNS) . This links your dynamic public IP address with a domain name. Every time, as soon as your IP address changes, a programme redirects the new address to the domain name and makes it permanently available on the internet. Now if you link a server on Raspberry Pi with the domain name, it’s permanently accessible online.

There are both free and paid DDNS services. Before you decide on one for yourself, you should first test which DDNS providers your router supports, and whether it supports any at all . Find the DDNS support tutorial for whichever individual router your DDNS server is intended to operate on, such as this tutorial for Linksys routers.

Many routers support the ability to provide individual devices within the local network with a static IP address. With a Linksys router, the Linksys app  allows you to manage multiple devices and handle all of the router assignments remotely. Various other routers also support similar functions, and so can be used for linking Raspberry Pi with a static IP address.

A static IP address for Raspberry Pi is set up somewhat differently for each router. The basic principle is always the same, though: You open the user interface of the router in your browser; Link the MAC address of Raspberry Pi with your LAN’s IPv4 address via the manual IP configuration. Most of the time, a tick box exists for this in the router interface. This enables you to always automatically use the IP address assigned to you.

Raspbian Jessie, or Jessie Lite – the current Raspbian operating systems at the moment – have a DHCP client daemon (DHCPCD) that can communicate with the DHCP servers from routers. The configuration file of a DHCP client daemon allows you to change the private IP address of a computer and set it up in the long term. The following instructions will assign a static IPv4 address with 32 bits (not to be confused with an IPv6 address , which has 128 bits available) to the Raspberry Pi.

Before you begin with the assignment of a private IP address for Raspberry Pi, check whether DHCPCD is already activated using the following command:

In case it’s not, activate DHCPCD as follows:

Now make sure that the configuration of the file /etc/network/interfaces has the original status . For this, the ‘iface’ configuration needs to be set at ‘manual’ for the interfaces.

For the editing of the activated DHCPCDs, start by opening the configuration file /etc/dhcpcd.conf and running the following command:

You’ll now carry out the configuration of the static IP address. If your Raspberry Pi is connected to the internet via an Ethernet or network cable, then enter the command ‘interface eth0’; if it takes place over Wi-Fi, then use the ‘interface wlan’ command.

To assign an IP address to Raspberry Pi, use the command ‘ static ip_address= ’ followed by the desired IPv4 address and the suffix ‘ /24 ’ (an abbreviation of the subnet mak 255.255.255.0 ). For example, if you want to link a computer with the IPv4 address 192.168.0.4 , then you need to use the command ‘static ip_address=192.168.0.4/24’. It goes without saying that the address used here is not yet used anywhere else. As such, it also can’t be located in the address pool of a DHCP server.

You still then need to specify the address of your gateway and domain name server (usually both are the router). Raspberry Pi turns to the gateway address if an IP address to which it wants to send something is outside of the subnet mask (in the example, this would mean outside of the range 192.168.0). In the following command, the IPv4 address 192.168.0.1 is used as an example as both the gateway and DNS server. The complete command looks like this in our example (where a network cable is used for the internet connection):

The command lines above match the IPv4 addresses that you want to use for your Raspberry Pi, or where your router is assigned. Save the changes with ‘Ctrl + O’ and then press the enter key. Close the configuration file with ‘Ctrl + X’. Restart to adopt the newly assigned static IP address in the network:

Now use a ping command to check whether the Raspberry Pi is accessible in the network with its new IP address:

If the connection of the IP address was successful, you’ll see that you can reach it under the new IP address with a ping.

In summary, it should be noted that there are basically two different IP addresses that are relevant for Raspberry Pi (and projects using it): the private IP address of the Raspberry Pi within the local network, and the public IP address of its internet connection.

A static private IP address is primarily necessary if you want to use Raspberry Pi as a server . But if you access the minicomputer via SSH more frequently, you should assign in a static address in the same way. The possibilities outlined above detail how this can be achieved with relatively simple means.

Assigning a fixed public address that allows your Raspberry Pi to be accessed via the internet is somewhat more complicated. This is necessary, for example, when attempting to make your server installed on Raspberry Pi remain constantly available online. Most internet access is available only via a dynamic public IP address, which isn’t possible here. Since a static address isn’t offered by all internet providers (and if it is, then it’s usually relatively expensive), a DDNS service presents the best solutions. But for this, you have to know which forms of dynamic DNS are supported by your router.

  • Open Source

Related articles

Creating a Raspberry Pi cloud server with owncloud

Creating a Raspberry Pi cloud server with owncloud

With ownCloud software, your Raspberry Pi can be used as a private cloud, performing the same kind of tasks as clouds from major providers such as Google, Amazon, and Dropbox. Cost-effectiveness is just one of many the benefits of creating your own personal cloud; another is the privacy and security of your data. This step-by-step Raspberry Pi cloud tutorial explains how to set up ownCloud.

Raspberry Pi mail server: using Raspberry Pi to manage e-mails

Raspberry Pi mail server: using Raspberry Pi to manage e-mails

Why use e-mail servers from commercial e-mails service providers when you can just set up your own? You can create a private server easily and affordably with a small computer known as Raspberry Pi. Having your own e-mail server, however, requires a certain amount of work and also has its disadvantages. You can find out more about how to set up your personal Raspberry Pi mail server in this…

Using Raspberry Pi as a web server

Using Raspberry Pi as a web server

Have you always wanted to operate your own web server? Raspberry Pi makes this goal more realistic, without commanding a high price and expert-level knowledge for set-up: hosting a website’s test environment or a private cloud is just as manageable for the small computer as controlling light sources, heaters, or other home devices (home automation). In our tutorial, you’ll find out all you need to…

30 Raspberry Pi projects that show the possibilities of the mini computer

30 Raspberry Pi projects that show the possibilities of the mini computer

Raspberry Pi is an inexpensive micro-computer that can behave like a standard computer in many respects. The innovative mini device can be used for a wide range of tasks - from setting up an operating system to surfing the web, to using it as a server or a media centre. Discover 30 interesting Raspberry Pi projects to try out at home.

DHCP Snooping: More Security for Your Network

DHCP Snooping: More Security for Your Network

DHCP snooping makes a network more secure. There are no two ways about it: DHCP makes network configuration so much easier. This is especially the case in large networks, where devices are constantly changing and the manual assignment of IP addresses is a never-ending task. Yet by using DHCP to simplify the process, you do relinquish controls, and criminals can take advantage of this. By using…

Get the flexible infrastructure you need to meet any demand, from fully virtualised VPS to scalable cloud solutions.

setting a static ip raspberry pi

Login to my account

Enter your e-mail and password:

New customer? Create your account

Lost password? Recover password

Recover password

Enter your email:

Remembered your password? Back to login

Create my account

Please fill in the information below:

Already have an account? Login here

Your cart is empty

Complete Guide to Setting Up a Raspberry Pi as a Firewall: How to Configure IPFire on Your LAN

April 8, 2024.

DALL·E 2024-04-08 16.27.47 - A modern and engaging book cover for 'Complete Guide to Setting Up a Raspberry Pi as a Firewall'. The cover should feature a Raspberry Pi device with .webp__PID:e390344e-9898-45cb-b247-2b3ac32d0b0f

In an increasingly connected world, safeguarding your home/small office network from external threats is paramount. One effective solution is to deploy a firewall, a barrier that monitors and controls incoming and outgoing network traffic based on predetermined security rules. With the ubiquity of Raspberry Pi and the robustness of IPFire, a Linux-based firewall distribution, creating a small yet powerful home firewall has become more accessible than ever. This guide will help to through the process of setting up a Raspberry Pi as a firewall using the IPFire distribution. Whether you're looking to protect your personal devices, secure IoT gadgets, or simply enhance your network's defense, this project offers a cost-effective and customizable solution.

1.png__PID:472b3ac3-2d0b-4fae-b724-f401e890e6b3

IPFire is an open-source Linux distribution designed to provide a robust firewall solution for small to medium-sized networks. It offers a wide range of features including firewall, VPN, proxy, Intrusion Detection System (IDS), Quality of Service (QoS), and more. IPFire is known for its security-focused design and regular updates to address emerging threats. Here are some key features of IPFire: Firewall: IPFire includes a powerful firewall that allows you to define rules to control incoming and outgoing traffic based on various criteria such as source/destination IP address, port, protocol, and interface. Virtual Private Network (VPN): IPFire supports VPN connections, allowing you to securely connect remote devices or offices to your network. It supports various VPN protocols including OpenVPN and IPsec. Proxy Server: IPFire includes a proxy server that can cache web content, filter content based on URL or content type, and provide additional security by inspecting and filtering web traffic. Intrusion Detection System (IDS): IPFire includes an IDS called Snort, which monitors network traffic for suspicious activity and alerts you to potential security threats. Quality of Service (QoS): IPFire allows you to prioritize network traffic to ensure that critical applications or services receive adequate bandwidth and performance. Updates and Security: IPFire receives regular updates to address security vulnerabilities and includes features like packet filtering, Stateful Packet Inspection (SPI), and network address translation (NAT) to enhance network security.

Installation

1.Download IPFire: Download the ARM image suitable for Raspberry Pi: https://downloads.ipfire.org/releases/ipfire-2.x/2.29-core183/ipfire-2.29-core183-aarch64.img.xz 2.Prepare the MicroSD card: Use software like Raspberry Pi Imager to flash the IPFire image onto the MicroSD card.

3.png__PID:3ac32d0b-0fae-4724-b401-e890e6b35525

3.Configure IPFire: Connect the Raspberry Pi to your network router using the Ethernet cable and power on the Raspberry Pi. 4.Initial Setup: Once booted, the Raspberry Pi will start the IPFire setup process.Follow the on-screen instructions to configure IPFire. Set passwords, network configuration, and other preferences.

4.png__PID:c32d0b0f-ae37-44f4-81e8-90e6b3552573

Configuration

5.png__PID:2d0b0fae-3724-4401-a890-e6b3552573b1

When installing IPFire on a Raspberry Pi, the network setup is similar to other platforms but may have some specific considerations due to the Raspberry Pi's hardware and network interfaces. Here's a guide to the standard IPFire installation network setup on a Raspberry Pi:

6.png__PID:0b0fae37-24f4-41e8-90e6-b3552573b1f0

1. Green Network (LAN): This network segment represents your trusted internal network where your local devices reside. Connect the Raspberry Pi's Ethernet port (eth0) to your local network switch or router using an Ethernet cable. During the IPFire installation process, assign the Ethernet interface (eth0) to the Green network segment. Configure the Green network with an appropriate IP address range (e.g., 192.168.x.x or 10.x.x.x) and subnet mask that matches your existing LAN setup.

7.png__PID:0fae3724-f401-4890-a6b3-552573b1f0b0

You can also configure the Green network to provide DHCP services to your local devices if desired. 2. Red Network (WAN - Internet): This network segment represents the untrusted external network that connects to the internet. Connect the Raspberry Pi's USB Ethernet (eth1) to your internet modem or router using another Ethernet cable. During the IPFire installation process, assign the Ethernet interface (eth1) to the Red network segment. By default, IPFire will attempt to obtain an IP address for the Red network interface dynamically via DHCP from your ISP. If you have a static IP address from your ISP, you can configure it during the installation process.

8.png__PID:ae3724f4-01e8-40e6-b355-2573b1f0b079

3. Optional Networks (Blue, Orange, etc.): If you have additional network segments (e.g., guest network, IoT network), you can configure them as optional networks during the IPFire installation process. Connect additional Ethernet adapters (if available) to the Raspberry Pi's USB ports and assign them to the desired network segments (e.g., Blue, Orange) during installation. The last thing to configure is the DHCP (Dynamic Host Configuration Protocol) Server for the Green Interface.

9.png__PID:3724f401-e890-46b3-9525-73b1f0b07928

The configuration of DHCP with the program setup is possible during installation only. However, you can change all these settings after installation with IPFire's Web UI . Which occurs after you type in browser https://ipfire.localdomain:444 or https://ipfire:444 or https://192.168.1.1:444

10.png__PID:24f401e8-90e6-4355-a573-b1f0b07928d4

You will be prompted to log in to the IPFire web interface. Use the credentials you set up during the initial configuration.

Configuring Services:

Once logged in, navigate to the "Services" tab in the web interface. Here you'll find various services that you can configure according to your needs. DHCP Server: Under the "Services" tab, click on "DHCP Server" to configure DHCP settings. You can set up the DHCP server to automatically assign IP addresses to devices on your network.

11.png__PID:f401e890-e6b3-4525-b3b1-f0b07928d442

Configure the DHCP lease range, DNS settings, and other options as needed. Firewall: Navigate to the "Firewall" tab to configure firewall rules.

12.png__PID:01e890e6-b355-4573-b1f0-b07928d442d1

You can create rules to allow or block traffic based on various criteria such as source/destination IP addresses, ports, and protocols. Configure port forwarding, NAT rules, and other firewall settings as required. Proxy Server:

13.png__PID:e890e6b3-5525-43b1-b0b0-7928d442d16c

If you want to use the proxy server feature of IPFire, navigate to the "Proxy" tab.Configure proxy settings such as cache size, access control lists, and logging options.You can also enable content filtering and set up URL filtering rules. VPN (Virtual Private Network): IPFire supports various VPN protocols including OpenVPN and IPsec.Navigate to the "VPN" tab to configure VPN settings.You can set up VPN clients and servers, configure VPN tunnels, and manage certificates and keys.

14.png__PID:90e6b355-2573-41f0-b079-28d442d16c32

After configuring the desired services, make sure to save your changes and apply them.Some changes may require a restart of specific services or the entire system. Monitor and Troubleshoot: After configuring services, monitor their performance and troubleshoot any issues that may arise.

15.png__PID:e6b35525-73b1-40b0-b928-d442d16c32f8

IPFire provides logs and monitoring tools to help you keep track of network activity and service status.

16.png__PID:b3552573-b1f0-4079-a8d4-42d16c32f8de

Recent Post

Complete Guide to Setting Up a Raspberry Pi as a Firewall: How to Configure IPFire on Your LAN

Subscribe to our newsletter

Sign up for order tracking,  exclusive offers and more! 

Free shipping on all orders

Free shipping on all orders with No Minimums

Satisfied or refunded

Free returns within 15 days

Top-notch support

Do our best to help you with any issues

Secure payments

Visa, Mastercard, PayPal, etc

How to SSH into Raspberry Pi for Remote Access on Windows

If you're planning to remotely execute commands on the Raspberry Pi, you'll need to set up SSH on the SBC

For the uninitiated, Secure Shell, or SSH , is a protocol that allows you to establish an easy-to-use yet robust connection between two devices. Typically used for sharing files or executing remote commands over a network, SSH is the perfect way to access any of your devices from your PC.

With Raspberry Pi being one of the most-used SBCs for hobbyist projects, you’re bound to require SSH functionality in the palm-sized system sooner or later. So, we’ve compiled a detailed guide to help you SSH into your Raspberry Pi and access it from any Windows machine.

How to generate SSH keys on Windows

How to enable ssh before installing an os on the raspberry pi, using raspberry pi imager.

First, you’ll need to enable the SSH functionality on your Raspberry Pi. If you haven’t already flashed an operating system onto your microSD card, you can use the OS customization settings available in the Raspberry Pi Imager app to enable SSH.

  • Click the Save button and proceed with the usual procedure to flash the microSD card.

Using the ssh file

If you're accustomed to using Balena Etcher, Rufus, or other flashing tools, you can create an empty ssh text file before inserting the microSD card into your Raspberry Pi.

How to enable SSH after installing an OS on the Raspberry Pi

Using the configuration settings.

Assuming you’re using the Raspberry Pi OS, there are several ways to turn on SSH functionality on your RPi. The simplest method involves modifying certain Configuration settings:

  • Head to the Interfaces tab.

Using the raspi-config tool

If you prefer a more BIOS-like interface, you can utilize the Raspberry Pi Software Configuration tool, which is accessible via the Terminal.

Using the terminal

Finally, if you prefer terminal commands to GUI settings, you can use the systemctl command to enable SSH on the SBC. This method is also compatible with other Debian-based Linux distros, including Ubuntu.

  • Open the terminal app.
  • sudo systemctl enable ssh

How to find the IP address of your Raspberry Pi

Before you can access your Raspberry Pi from your PC, you’ll need to find its IP address. There are many ways to do this, but we’ll use the simplest method for now.

  • Click on the Wi-Fi/Ethernet icon.

How to SSH into the Raspberry Pi on your PC

Now that you know your Raspberry Pi’s IP address and have enabled SSH, it’s time to switch to your PC. While you can use the built-in terminal emulator on Windows 11, I’ve switched to PuTTY as it’s much easier to use.

  • Make sure your Raspberry Pi is powered on and connected to Ethernet/Wi-Fi.
  • Download PuTTY from this link and run its executable file as an administrator.

Accessing your Raspberry Pi via SSH

Assuming you followed all the steps correctly, PuTTY will show user@raspberrypi as the device name, and you’re free to run as many commands as you wish from your PC. If you’re wondering what you can do with SSH, this feature will be useful when you make a NAS with your Raspberry Pi . Besides letting you use port forwarding on the SBC, SSH also allows you to remotely install any app on the Raspberry Pi.

Raspberry Pi 5 review: The holy grail of DIY projects got even better (and rarer)

IMAGES

  1. Setting Up a Static IP on the Raspberry Pi

    setting a static ip raspberry pi

  2. Setting Static IP on RPi

    setting a static ip raspberry pi

  3. Setting a Static IP Address on a Raspberry Pi [With Screenshots]

    setting a static ip raspberry pi

  4. How to Assign Static IP Address to Raspberry Pi!

    setting a static ip raspberry pi

  5. How to set Static IP on Raspberry Pi

    setting a static ip raspberry pi

  6. Setting Up Raspberry Pi Pico W With A Static IP Address

    setting a static ip raspberry pi

VIDEO

  1. Ubuntu Mate 16.04: Setup Static IP—Raspberry Pi 2018

  2. static IP on a Pi running Ubuntu

  3. How to set a Static IP Address

  4. Set up Ethernet with Static IP Address on Raspberry Pi OS

  5. How To Configure Static IP in Ubuntu 18.04 Desktop

  6. How to Set A Static IP Address on Linux

COMMENTS

  1. How to Set a Static IP Address on Raspberry Pi

    How to Assign a Static IP to a Raspberry Pi. 1. Determine your Raspberry PI's current IP v4 address if you don't already know it. The easiest way to do this is by using the hostname -I command at ...

  2. Set up a static IP-address

    It is very simple to set up your static ethernet address. Simply right-click on the Wi-Fi icon in the menu bar (top-right on the left of the speaker icon) and select the Wireless & Wired Network Settings. Now click the empty dropdown menu and select the network interface you want to configure. Now for IPv4 Address enter your chosen ip address ...

  3. 3 Easy Ways To Set A Static IP Address On Raspberry Pi

    Choose "Edit connection". Pick the connection you want to set to static, and select "Edit…" on the right. Use the arrows on your keyboard to select the connection and the action button. Press Enter to confirm the selection. On the next window, scroll the cursor to the "IPv4 Configuration" line and select "Automatic".

  4. How to Set Static IP Address on Raspberry Pi

    Restart your Pi for the changes to take effect. You have successfully set up static IP on Raspberry Pi. Step 4 (GUI Method): Change network configuration to set static IP. The same can be achieved from the graphical interface of Raspberry Pi OS. First, click on the network icon and then go to the Advanced options and click Edit connections.

  5. How Do I Set a Static IP Address on Raspberry Pi?

    Once you have entered the settings, press Ctrl + X and then Y and ENTER to close and save the modified configuration file. 3. Reboot the Raspberry Pi. With the dhcpcd.conf configuration file modified, restart your Raspberry Pi to effect the changes and set the static IP address for it: sudo reboot.

  6. How to Setup a Raspberry Pi Static IP Address

    Upon rebooting, the Raspberry Pi will attempt to connect to the router using the static IP address we defined in our "dhcpd.conf" file. Run the following command to restart your Raspberry Pi. sudo reboot Testing the Static IP. 1. Once your Raspberry Pi has finished restarting you now should be able to connect using the IP address you specified.

  7. How to Configure a Static IP Address on the Raspberry Pi

    3 - Edit the dhcpcd file on the Raspberry Pi. The static IP is set by adding it to a file on the Raspberry Pi. In the terminal window, run the following command to edit the dhcpcd.conf file. sudo nano /etc/dhcpcd.conf. 4 - Set the static IP address. This document has a few lines of code that can be activated by removing the # to the left of ...

  8. Set static IP on Raspberry Pi

    Set Static IP Address via Desktop GUI. Get started by right clicking on the network interfaces icon in the task bar at the top of your screen (the default location for the bar in Raspberry Pi OS). Then, click on Wired and Wireless Network Settings. Right clicking on the Raspberry Pi task bar to access networking settings.

  9. How to Set Up Static IP Address for Raspberry Pi

    You can also set the static private IP address for your system through the Raspberry Pi OS GUI. The steps below demonstrate the GUI procedure. 1. Right-click the network adapter icon on the right side of the top panel. 2. Select the Wireless & Wired Network Settings item to open Network Preferences. 3.

  10. How to Set a Static IP Address on Raspberry Pi

    4. Click on "Add" and enter the IP address of Raspberry Pi in the "Reserved IP Address" field. You can find the IP address of your RPi board by entering hostname -I in the Terminal. To find the MAC address of your RPi, scroll down and look for the client list mentioned on the same admin page.Next, give a name in the "Description" field and turn on the "Enable This Entry" checkbox.

  11. How to Set Up a Static IP on the Raspberry Pi

    By default the Pi is configured with a dynamic IP address. To assign it a static IP address, you need to add your static IP, default gateway IP, and domain name servers to the dhcpcd.conf file. At the command prompt, enter sudo nano /etc/dhcpcd.conf to edit the dhcpcd.conf file: Now, without changing anything else in the file, add this code at ...

  12. Setting a Static IP Address on a Raspberry Pi [With Screenshots]

    Step 5 - Assigning the IP Address to the Connected Interface. My network has a DHCP range of 192.168.100 to 192.168.200, from which addresses will be automatically assigned, so I will assign my Raspberry Pi the address: 192.168.1.201. This is to make sure that it doesn't conflict with an existing IP (or the router's IP address, which is ...

  13. How to set a static IP address on a Raspberry Pi

    You must make sure you either use the IP address already given to your Raspberry Pi or that you're using an address that is currently vacant. To begin, enter this command: sudo nano /etc/dhcpcd ...

  14. How to setup a static IP address on your Raspberry Pi

    A static IP address however will not change, it assigns your Raspberry Pi a permanent address on your network - so you know exactly where it is at all times. Setting up a static IP address on your Raspberry Pi can seem like a daunting task, but fear not, we'll walk you through it one step at a time in this tutorial.

  15. How to set a static IP address on a Raspberry Pi (2024)

    Setting a static IP address for your Raspberry Pi is as easy as 1-2-3 and has a multitude of benefits. Prime among them is optimizing your network by making it easier to locate your services. Not to mention, you'll be able to access any established services on the same IP address, despite restarting your Raspberry Pi.

  16. How do I set up networking/WiFi/static IP address on Raspbian/Raspberry

    Setup a Static IP Address. Questions about setting Static IP Address are among the most common on this site. There are very many tutorials (many wrong, obsolete or incomplete). If the reason you are contemplating a Static IP Address is you want your Pi to be assigned a predictable IP Address you can request the DHCP server to assign one.

  17. How to Use a Static IP Address and Setup SSH on a Raspberry Pi

    SSH. Now that your Pi has a static IP address you can configure the SSH server. This is done via raspi-config. From within raspi-config, select option 8 ( Advanced Options) and then option A4 ( SSH ). When asked "Would you like the SSH server enabled or disabled", select "Enable" and finally select "OK". You can now connect to your ...

  18. How to Set a Static IP Address on a Raspberry Pi 5

    Next set the addressing from DHCP to static, nmcli con mod preconfigured ipv4.method manual. Restart the connection to pick up these changes, nmcli con up preconfigured. Check your new IP address with ip addr show wlan0 (or whatever device you are using). Lastly check your network connectivity by doing a quick ping using ping 8.8.8.8.

  19. Tutorial

    Hopefully however, your Raspberry Pi is now set up with a static IP address! Popular posts. The Best Raspberry Pi 5 Cooling Cases and Heatsinks. Raspberry Pi 5 - the Little Features You Didn't Notice. How to use Two Camera Modules with Raspberry Pi 5. Raspberry Pi Pico Getting Started Guide.

  20. How to Set a Static IP Address on Raspberry Pi?

    Set a Static IP on Raspberry Pi OS Desktop. If you're using the Raspberry Pi OS desktop version, follow these steps: Click on the network icon in the top-right corner of the desktop; Select "Wireless and Wired Network Settings"; In the "Connection" tab, click on the wired or wireless connection you're using;

  21. How to give your Raspberry Pi a Static IP Address

    Start by editing the dhcpcd.conf file. sudo nano /etc/dhcpcd.conf. Scroll all the way to the bottom of the file 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. You'll need to edit the numbers in the snippet ...

  22. How to set a Raspberry Pi with a static ip adress?

    To assign an IP address to Raspberry Pi, use the command ' static ip_address= ' followed by the desired IPv4 address and the suffix ' /24 ' (an abbreviation of the subnet mak 255.255.255. ). For example, if you want to link a computer with the IPv4 address 192.168..4, then you need to use the command 'static ip_address=192.168..4 ...

  23. No internet after setting up static IP (Bookworm) : r/raspberry_pi

    IP range on the router, but if it's not configured to assign IP addresses for that range, the computer won't connect. When you're configuring your router, you're going to want to set up the DHCP settings as well to make sure that the router doesn't assign a different machine to the IP address that you want to use.

  24. Set up Raspberry Pi as Router

    The Wi-Fi interface of the Raspberry Pi will be used as the access point for other devices to connect to. Like any router, it needs to have a static IP address. To configure a static IP address for the Wi-Fi interface, we will use nano or another text editor to open the following file with administrative privileges: $ sudo nano /etc/dhcpcd.conf

  25. Raspberry Pi Documentation

    Assign a static IP address; Set up a headless Raspberry Pi. Connect to a wired network; Connect to a wireless network; Remote access; Host a wireless network on your Raspberry Pi. Enable hotspot; Disable hotspot; Use your Raspberry Pi as a network bridge; Using a proxy server. Configuring your Raspberry Pi; Update the sudoers file; Reboot your ...

  26. How to find your Raspberry Pi IP Address

    From the Pi OS desktop, click the Terminal icon at the top. To find the IP address, enter the following command: hostname -I. This command is case-sensitive, so make sure you're using a capital I ...

  27. Complete Guide to Setting Up a Raspberry Pi as a Firewall: How to

    3.Configure IPFire: Connect the Raspberry Pi to your network router using the Ethernet cable and power on the Raspberry Pi. 4.Initial Setup: Once booted, the Raspberry Pi will start the IPFire setup process.Follow the on-screen instructions to configure IPFire. Set passwords, network configuration, and other preferences.

  28. How to make a Minecraft server on Raspberry Pi

    Open the Minecraft Launcher and click on the Play button under the Minecraft Java section. Once Minecraft boots up, select Multiplayer. Click on the Add Server button. Enter the Server Name and ...

  29. How to SSH into Raspberry Pi for Remote Access on Windows

    Click on the terminal app. Type the following command within the terminal window: sudo raspi-config. Navigate to Interface options . Select SSH and tap Yes when asked for confirmation. Click on ...