Static IP Address Ubuntu

During the installation, Ubuntu installer has configured this server to get it’s ip address via DHCP. This post will show you how to configure static ip address on Ubunt linux server. This steps may working on other versions of Ubuntu.

Edit /etc/network/interfaces as per below command :

[email protected]:~# sudo vi /etc/network/interfaces

Original network interface configuration on Ubuntu server is as below :

This file describes the network interfaces available on your system
and how to activate them. For more information, see interfaces(5).

The loopback network interface

auto lo  
iface lo inet loopback 

The primary network interface

auto eth0  
iface eth0 inet dhcp  

As an example, configure static ip address as below :

This file describes the network interfaces available on your system
and how to activate them For more information, see interfaces(5).

The loopback network interface

auto lo  
iface lo inet loopback  

The primary network interface

auto eth0  
iface eth0 inet static  
        address 192.168.0.50
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 8.8.8.8 8.8.4.4

How to restart the network interface :

[email protected]:~# sudo /etc/init.d/networking restart