SystemMen - Configure static IP on Debian 8. I wrote a similar post for Ubuntu 16. Generally, Ubuntu-based or Debian-based operating systems have a pretty similar configuration.
Define the interface to configure static ip
Define the interface you want to set up. A server with multiple network interfaces is normal. So you need to determine which interface you want to configure the static IP.
You can use one of the following commands to display all the interfaces that are present in the server.
ifconfig -a
ip a
ip link show
Personally I think you should use the command ip link show
.
Configure static IP on Debian
Step 1, open the /etc/network/interfaces
file using the nano command below.
nano /etc/network/interfaces
Step 2, copy the following configuration to the file and change the information that matches your system. For example, I would set up an interface named eth1.
auto eth1 iface eth1 inet static address 192.168.56.30 netmask 255.255.255.0 gateway 192.168.56.1 dns-nameservers 8.8.8.8 8.8.4.4
Step 3, restart the server’s network service to apply the new configuration. Note that you need to make sure that it is possible to console or connect to another server’s IP. Because after restart the network service, the old IP of the interface will be lost.
systemctl restart networking.service
Check new IP
Now you can type the following command to test whether the IP has been applied to the interface you want or not.
ip a | grep eth1
«« How to change hostname in Debian 8How to change hostname in Debian 9 »»