Check the current IP:
ip -4 address
Edit the file /etc/network/interfaces to configure the static IP.
-
Change the value in the "primary network interface" seccion from
dhcptostatic. -
Add the following parameters:
- address
- netmask
- network
- broadcast
- gateway
Example:
iface enp2s0 inet static
address 192.168.1.20
netmask 255.255.255.0
network 192.168.1.1
broadcast 192.168.1.255
gateway 192.168.1.1
Configure DNS
Edit the /etc/resolv.conf file and add it as follow:
nameserver 8.8.8.8
nameserver 1.1.1.1
👉 Source