Admin
Digital Marketing
Sed mi leo, accumsan vel ante at, viverra placerat nulla. Donec pharetra rutrum sed allium lectus fermentum enim Nam maximus.
Setting a static IP ensures your Raspberry Pi always uses the same address on your local network, making remote access and port forwarding more reliable. Follow these steps to configure a static IP:
Open the terminal and run:
hostname -I
This will display your Raspberry Pi’s current IP address.
To get your router's IP, run:
ip r | grep default
The first IP in the output is your router’s gateway address.
cat /etc/resolv.conf OR grep "nameserver" /etc/resolv.conf
Edit the DHCP client configuration file using:
sudo nano /etc/dhcpcd.conf
Scroll to the bottom and add the following lines, replacing placeholders with actual values:
interface [INTERFACE]
static_routers=[ROUTER IP]
static domain_name_servers=[DNS IP]
static ip_address=[STATIC IP ADDRESS YOU WANT]/24
Example:
interface eth0
static_routers=192.168.1.100/24
static domain_name_servers= 8.8.8.8
static ip_address=192.168.1.100/24
If using Wi-Fi, replace `eth0` with `wlan0`.
Press `CTRL+X`, then `Y`, and `Enter` to save the file. Restart your Raspberry Pi for the changes to take effect:
sudo reboot
Your Raspberry Pi should now consistently use the assigned static IP address, ensuring seamless connectivity for projects requiring reliable networking. 🚀
Comments