Raspberry Pi Tips

Configure static IP address to RaspPi

Raspberry Pi 3 Model B V1.2

  $ cat /etc/debian_version
  9.11

1: Login to router and confirm the range of IP address

Check your router's DHCP server function and the range of assigned IP address. Note that you need to assign static addres outside of this range.

Note that router has a specific list that eliminate assigning the DHCP address. Also, new static IP address should not duplicated to pre-defined IP address.

2: Check /etc/dhcpcd.conf and configure it

At the setting of /etc/network/interfaces, there is suggestions saying "For static IP, consult /etc/dhcpcd.conf" and "man dhcpcd.conf"

  $ man /etc/hhcpd.conf
  ~
  # Example static IP configuration: 
  #interface eth0 
  #static   p_ad‐dress=192.168.0.10/24               
  #static   ip6_ad‐dress=fd51:42f8:caae:d92e::ff/64    
  #static   routers=192.168.0.1
  #static   domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1
          

Before udpate /etc/dhcpcd.conf, I backed up the file

$ sudo cp -p /etc/dhcpcd.conf /etc/dhcpcd.conf.bk


In my local environment at home, I configred Wifi IP address as follows

$ sudo vi /etc/dhcpcd.conf
~
interface wlan0
static ip_address=192.168.11.21/24
static routers=192.168.11.1
static domain_name_servers=192.168.11.1

3: Restart Raspberry Pi

$ sudo shutdown -r now


Refs: