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.
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.
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 126.96.36.199 188.8.131.52
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 eth1If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.
If you appreciate what we share in this blog, you can support us by:
- Stay connected to: Facebook | Twitter | Google Plus | YouTube
- Subscribe email to recieve new posts from us: Sign up now.
- Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
- Become a Supporter - Make a contribution via PayPal.
- Support us by purchasing Ribbon Lite Child theme being using on this website.
We are thankful for your support.