#!/linuxSucks/Setup a Static Ip Address In Debian

Aug 27, 2021

Check the name of the interface

ip a show

Search for the adapter name, it should be something similar to

enp2s0 <-- Ethernet
enp3s0
wlp1s0 <-- Wifi Adapter

Open and edit interfaces file

sudo vim /etc/network/interfaces

Edit the file with your own settings, here is a example of

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

### Network Adapter wire network 2
auto enp2s0
iface enp2s0 inet dhcp

### Network Adapter wire network 2
auto enp3s0
iface enp3s0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
dns-nameservers 8.8.8.8 1.1.1.1

### Wifi adapter wireless network
allow-hotplug wlp1s0
iface wlp1s0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
dns-nameservers 8.8.8.8 1.1.1.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Save and close the file, reboot your computer or restart the network

sudo systemctl restart networking

Home  Linux  Notes  Blog Spot