During the installation, Ubuntu installer has configured this server to get it’s ip address via DHCP, then we have to change this because a server should have a static IP address. This post will guide you how to configure static ip address on Ubuntu 11.10 linux server. This steps may working on other versions of Ubuntu.
Edit /etc/network/interfaces as per below command :
root@ubuntu11:~# vi /etc/network/interfaces
Original network interface configuration on Ubuntu 11.10 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.1.49 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1
How to restart the network interface :
root@ubuntu11:~# /etc/init.d/networking restart