How to configure static ipadddress in RaspberryPi
The Raspberry Pi is a tiny and affordable computer that you can use to learn programming through fun, practical projects.
This tutorial explains the steps to configure static ipaddress in RaspberryPi.
Step1: Open the configuration file
nano /etc/dhcpcd.conf
Step2: Update the configuration like the example given below.
FOR Wired,
interface eth0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
FOR Wifi,
interface wlan0
static ip_address=192.168.0.200/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
Step3: Reboot the system
Note:
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.