How to Configure Network Interface IP on Debian

Here is an example:

Edit /etc/network/interfaces

It’s best to make a backup first

cp /etc/network/interfaces /etc/network/interfacesbackup

iface eth0 inet static

address 192.168.0.16

netmask 255.255.255.0

gateway 192.168.0.1

Set the DNS server in /etc/resolv.conf,

nameserver 192.168.0.1

#Since my gateway is also the DNS server here, they are the same

Finally, reboot or run #/etc/init.d/networking restart


 

My own approach:

Originally, my machine used DHCP to dynamically assign the IP, so it was written like this

iface eth0 inet dhcp

I copied the original interfaces file to interfaces.dhcp

Through the modification above, I copied interfaces to interfaces.static

Leave a Comment

Your email address will not be published.