There are two options to do this. You can find the first way on the respective wiki page. We will handle the second way when we come to it.
Always create a backup of your current network settings. Then, if something were to go wrong, at least you can go back to the previous settings.
The IP configuration of the network adapters is saved in the configuration file dhcpcd.conf in the /etc folder. Open the file with the nano editor:
At the bottom of the file, add the following lines:
Once you have changed the file, save the adjustments with Ctrl + X, y, enter`.The changes will not be visible immediately. So you're probably better of restarting your raspberry pi at this point.
After the restart, you can find the raspberry pi on the IP address you have configured.
That's it. Your Raspberry Pi is now accessible via SSH. Ensure the device is connected to the internet before establishing an SSH session.
sudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf.backup
sudo nano /etc/dhcpcd.conf
interface eth0
static ip_address=192.168.1.30/24
static routers=192.168.0.1
static domain_name_servers=9.9.9.9
sudo reboot -h 0