Using dhcpcd.conf (recommended)
- Open the config file
sudo nano /etc/dhcpcd.conf - Scroll to the bottom and add something like:
For Ethernet (wired)
interface eth0 static ip_address=192.168.1.50/24 static routers=192.168.1.1 static domain_name_servers=192.168.1.1 8.8.8.8For Wi-Fi
interface wlan0 static ip_address=192.168.1.50/24 static routers=192.168.1.1 static domain_name_servers=192.168.1.1 8.8.8.8 - Restart networking (or reboot)
sudo reboot