First it’s a good idea to check if dhcpcd service is activated:

    $ sudo service dhcpcd status

The command will display the status of the service:

pi@raspberrypi:~ $ sudo service dhcpcd status
● dhcpcd.service - dhcpcd on all interfaces
   Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/dhcpcd.service.d
           └─wait.conf
   Active: active (running) since Fri 2021-07-16 11:10:24 BST; 1h 52min ago
 Main PID: 397 (dhcpcd)
    Tasks: 1 (limit: 877)
   CGroup: /system.slice/dhcpcd.service
           └─397 /sbin/dhcpcd -q -w

Jul 16 11:10:16 raspberrypi dhcpcd[269]: eth0: soliciting an IPv6 router
Jul 16 11:10:16 raspberrypi dhcpcd[269]: eth0: soliciting a DHCP lease
Jul 16 11:10:16 raspberrypi dhcpcd[269]: eth0: offered 192.168.0.16 from 192.168.0.1
Jul 16 11:10:17 raspberrypi dhcpcd[269]: eth0: probing address 192.168.0.16/24
Jul 16 11:10:22 raspberrypi dhcpcd[269]: eth0: leased 192.168.0.16 for 86400 seconds
Jul 16 11:10:22 raspberrypi dhcpcd[269]: eth0: adding route to 192.168.0.0/24
Jul 16 11:10:22 raspberrypi dhcpcd[269]: eth0: adding default route via 192.168.0.1
Jul 16 11:10:24 raspberrypi dhcpcd[269]: forked to background, child pid 397
Jul 16 11:10:24 raspberrypi systemd[1]: Started dhcpcd on all interfaces.
Jul 16 11:10:28 raspberrypi dhcpcd[397]: eth0: no IPv6 Routers available

If the results display that the service is not active, to activate it do the following:

    $ sudo service dhcpcd start
    $ sudo systemctl enable dhcpcd

To set the static IP edit the /etc/dhcpcd.conf file:

    $ sudo nano /etc/dhcpcd.conf

Scroll down the file to find an example of static IP configuration:

# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=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

Uncomment or copy the lines and modify them according to the IP you want to assign and the router address:

interface eth0
static ip_address=192.168.0.200/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

The last step is to reboot the system, execute:

    $ sudo reboot

After the reboot you should be able to find the Raspberry Pi on the IP address you have set.

Another way to set a static IP is to use the kernel boot command line:

Power down the Raspberry Pi and insert the SD card into your PC. Look for file cmdline.txt in the boot partition and edit it. Add the following after “rootwait” adding one space in between and not adding any new lines:

   rootwait ip=192.168.0.200::192.168.0.1:255.255.255.0:rpi:eth0:off

Unmount the SD card, plug into the Raspberry Pi and check the IP address after booting up!