SystemMen - This article, I will guide you to set up static ip on Debian 9. How the Debian 9 works is similar to Debian 8. Configuring static ip on Debian 9 or Debain 8 is very simple.
Configure static ip in Debian 9
Step 1, you open the file /etc/network/interface using the following command.
Step 2, add the following code to the file.
auto enp0s8 iface enp0s8 inet static address 192.168.56.31 netmask 255.255.255.0 dns-nameservers 126.96.36.199 188.8.131.52
At this point, you must delete the old configuration lines of the enp0s8 interface. Edit the information that matches your system.
Read more: Configure static IP on Debian 8.
- address: your statis IP, ex: 192.168.56.31
- netmask: your subnet mask, ex: 255.255.255.0 or 24
- gateway (optional): your gateway IP, add this line if you use this interface as default route. Ex: 192.168.56.1
- dns-nameservers: define ip of dns server.
After you add the code, press Ctrl + X -> press y -> press Enter to save the configuration.
Restart networking service
Last step, you need to restart the network service on Debian 9 so that it reads the new configuration you just added.
systemctl restart networking.service
- If the server has only one interface, you need to perform setup static ip on the console window. Because you will lose connection to the server when the old IP is removed.
- If the server has multiple interfaces, you should connect to the server using another interface’s IP and perform the setup.
Now you can try ssh to the server via the new IP.If 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.