Securing a Static IP for Your DietPi Raspberry Pi: A Guide for Fritz!Box and OpenWRT Users
Setting a fixed IP lease, often known as a static DHCP lease or DHCP reservation, ensures that a device always receives the same IP address when it requests an IP from the router. Here’s how you can set it up for a Raspberry Pi running DietPi, both on a Fritz!Box and on a router running OpenWRT:
Fritz!Box:
-
Access the Fritz!Box user interface:
- Open a web browser and go to
http://fritz.box
or the IP address of your Fritz!Box.
- Open a web browser and go to
-
Login:
- Enter your password to log in to the Fritz!Box user interface.
-
Navigate to Home Network:
- From the main menu, select
Home Network
and thenNetwork
.
- From the main menu, select
-
View Network Connections:
- Click on the
Network Connections
orDevices
tab (depending on your Fritz!Box version).
- Click on the
-
Find the Raspberry Pi:
- Look for the Raspberry Pi (it might show up as DietPi or the hostname you’ve set) in the list of devices.
-
Edit Device Settings:
- Click on the device name or the
Edit
button (which might look like a pencil or gear icon).
- Click on the device name or the
-
Assign a Fixed IP Address:
- In the device settings, you’ll find an option that says “Always assign this network device the same IPv4 address” or similar wording. Enable this option.
- The system will usually auto-fill the current IP address of the Raspberry Pi. If not, or if you wish to change it, input the desired static IP here.
-
Save Changes:
- Click on
OK
orApply
to save the settings.
- Click on
OpenWRT:
-
Access the OpenWRT LuCI interface:
- Open a web browser and navigate to
http://192.168.1.1
or the IP address you’ve set for your OpenWRT router.
- Open a web browser and navigate to
-
Login:
- Enter your password to access the OpenWRT LuCI interface.
-
Navigate to Network Settings:
- On the top menu, select
Network
, then chooseDHCP and DNS
.
- On the top menu, select
-
Static Leases Section:
- Scroll down to find the
Static Leases
section.
- Scroll down to find the
-
Add a New Static Lease:
- Click on
Add
orAdd entry
. A new row will appear with fields to fill out.
- Click on
-
Fill in the Details:
MAC Address
: Enter the MAC address of your Raspberry Pi.IPv4 Address
: Enter the desired static IP address you want to assign to the Raspberry Pi.Hostname
: This can be left as is or set to the hostname of the Raspberry Pi.
-
Save & Apply:
- Click
Save
, and then clickSave & Apply
.
- Click
For both methods, once the configuration is done, it’s a good practice to reboot both the Raspberry Pi and the router to ensure the settings take effect. Ensure that the static IP address you’re assigning doesn’t conflict with other devices or the DHCP pool range.