The following describes two ways to set a static IP for the Raspberry Pi:
Using the settings of the router to assign a static IP to the MAC room (room can be downloaded, for example, with the command ifconfig).
Setting a permanent IP address in the configuration files of the Raspberry Pi. For this you need to change the file using for example nano text editor by typing the command in the terminal:
sudo nano /etc/dhcpcd.conf
The default IP is loaded from the DHCP server to set static IP to connect via Ethernet and wi-fi, you must add the following code to the end of the file:
Then save the file and exit the text editor (Ctrl+X) confirming the overwriting of the file by the letter "Y".
After the restart we will set a static IP for the cable connection. To connect via wi-fi you need to make changes to the file:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
adding the following entry:
ssid – network identifier
psk password is the network
After the changes save the file and exit the text editor (Ctrl+X).
Now our raspberry already has a permanent IP, which you can check in any time with the command ifconfig.
In order to check if all is configured correctly, you must call from any
of course, changing the IP specified in the earlier configuration.