5.2 Static IP

In some systems, particularly ones that do not have DHCP servers, NICs must be configured to use static IP addresses (abbreviated as static IP).

To do this, you have to edit /etc/network/interfaces. If there is a iface line with eth0 (or the interface that you want to configure), commment it out. Then specify the following:

iface eth0 inet static  
  address 192.168.0.1   # IP address of the interface  
  netmask 255.255.255.0 # netmask of the subnet  
  gateway 192.168.0.254 # gateway to go outside of the subnet  
    

Obviously, the actual addresses and netmask depends on the subnet that the NIC is connecting to!

After making changes to the file, you can restart the computer to make it effective. Alternatively, you can also run the command ifdown eth0 to bring down the interface. Then, run ifup eth0 to bring the interface up again.