How to set a static IP address on your Raspberry Pi

Rate this post

The Raspberry Pi is primarily about networking and you need to have a static IP address if you want to redirect internet traffic or automatically connect other network devices to the RPi. If the IP address continues to change, the entire setup will be interrupted and you will have to manually reconfigure the IP address. For simplicity, there is a handy guide for setting a static IP address on your Raspberry Pi. So, in that note, let’s go ahead and find a way to reserve an IP address for your Raspberry Pi.

Set a static IP address on the Raspberry Pi (2021)

This article described two ways to set a static IP address on your Raspberry Pi. If you are familiar with the terminal, you can use the first method. However, if you want to make changes through the graphical interface, follow your router’s guide. You can move to any section from the table below.

Set a static IP address using a Raspberry Pi device

1. First, Open terminal If you are using the Raspbian OS graphical user interface. You can also remotely SSH into your Raspberry Pi to connect to your terminal from your Mac, Windows PC, or smartphone.

Connect Headless Raspberry Pi to Windows Laptop without Ethernet or Monitor

2. Next, enter the following command, Current IP address Of your raspberry pie. Make a note of it as it will be static using the current IP address.

hostname -I
Raspberry Pi Web Server Setup (2021)

3. After that, execute the following command dhcpcd.conf Files via the Nano editor. Nano is Keyboard-based editorTherefore, you cannot use the mouse to move between lines or edit files.

sudo nano /etc/dhcpcd.conf
How to set a static IP address on your Raspberry Pi

4. Then scroll down to the bottom. here,”interface“.

How to set a static IP address on your Raspberry Pi

5. Go to “static ip_address” Change the highlighted part In the screenshot below, go to the Raspberry Pi’s current IP address (the one you noted in step 2). You can also assign a custom IP address if desired. You don’t have to touch anything else.

How to set a static IP address on your Raspberry Pi

6. Now, to save the file, clickCtrl + XAnd press Enter. Finally, press “Y” to save your changes.

7. In the terminal, run the following command to restart the Raspberry Pi immediately. By the way, you can check out the best Raspberry Pi commands from the linked articles.

sudo reboot
sudo reboot

8. That’s it.you have a A static IP address has been assigned Make a raspberry pie with a few simple steps. The router will now only use the static IP address you set on your Raspberry Pi.

Set static IP on Raspberry Pi using router settings

If you don’t want to mess with the Raspberry Pi’s terminal, there is another easy way to set a static IP address on your Raspberry Pi.There is a need Go to your router’s administration page..In general, it is 192.168.0.1However, it may vary depending on the router. You may need to search the internet to find the address of your router.

1. Open a browser on any device in your local network and type: 192.168.0.1, Press Enter. now, Enter the default credentials Sign in for your router.Usually both username and password adminHowever, if that doesn’t work, search the internet or the back of your router for default credentials.

Configure the router

2. Next, you need to look for “DHCP Server” or “DHCP Server”.Address reservation“Optional. I am using a TP-Link Archer C6 router, but the DHCP server settings are[詳細設定]->[ネットワーク]Available at. For other routers, it may appear on a different page, so it’s a good idea to search the internet to find the settings page.

dhcp server

3. Now scroll down to the Address Reservation section. Basically, you can reserve an IP address for your Raspberry Pi so it won’t be assigned to any other device in your home network. At the same time, assign a static IP to the Raspberry Pi. Via router..

Address reservation

4. Click Add and enter the Raspberry Pi’s IP address in the Reserved IP Address field.You can find the IP address of the RPi board by typing: hostname -I At the terminal.To find RPi MAC address, Scroll down to find the client list on the same admin page. Then name the Description field and select the Enable this entry check box. Finally, click Save. Reserve the current IP address of the Raspberry Pi and make it a static IP.

dhcp server

5. If you MAC address not found Open a terminal on the Raspberry Pi, R Pi and run ifconfig.. Under “wlan0”, check the value of “ether”. This is the MAC address of the RPi.

Mac address

7. Finally, Reboot the router, And the Raspberry Pi will always be assigned the same IP address that you reserved on your router.

Assign a static IP address to your Raspberry Pi in a few simple steps!

Here’s an easy way to set a static IP address on your Raspberry Pi. This guide is very useful if you are setting up a Pi-hole on your Raspberry Pi, or if you want to point another network device on your home network to the miniboard. Anyway, it’s all from us. If you run into any issues, please let us know in the comments below. We will try to help you.