Add a static IP to Linux (updated 2017) - Sion IT

Add a static IP to Linux (updated 2017)

To change a Linux system from DHCP to a static IP you need to edit the interfaces file as below.

edit the file /etc/network/interfaces:

 sudo nano /etc/network/interfaces

Change:

 auto eth0
 iface eth0 inet dhcp

To:

 auto eth0
 iface eth0 inet static
 address 172.16.10.10
 netmask 255.255.0.0
 network 172.16.0.0
 broadcast 172.16.255.255
 gateway 172.16.10.1
 dns-nameservers 172.16.10.1 172.16.10.2

Then you should restart the networking:

 sudo /etc/init.d/networking restart

Lastly, use ifconfig to check your changes.

Posted on December 28, 2017 at 11:41 by simon · Permalink
In: Linux

Leave a Reply