The correct config file is this one:
/etc/network/interfaces
And to update this file, please use
sudo nano /etc/network/interfaces
Add the below content (detailed settings are specific in your own environment)
auto ens160 ##the network interface name
iface ens160 inet static
address 192.168.0.xx ##the static IP address you'd like to assign to this machine
netmask 255.255.255.0
gateway 192.168.0.xx ##the gateway IP address
dns-nameservers 192.168.0.** ##the DNS server's IP address
For where to find the network interface’s name, execute:
ip a
And the likely output should show the NIC’s name (in this case) “ens160”:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:8f:7e:20 brd ff:ff:ff:ff:ff:ff
altname enp3s0
inet 10.0.0.7/24 brd 10.0.0.255 scope global dynamic ens160
valid_lft 85290sec preferred_lft 85290sec
inet 192.168.0.xx/24 brd 192.168.0.255 scope global ens160
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe8f:7e20/64 scope link
valid_lft forever preferred_lft forever
Leave a Reply