Change Ubuntu Server from DHCP to a Static IP Address

First, we will check the ip address of our ubuntu server, which is assigned by DHCP server:

Let’s open up the /etc/network/interfaces file.

sudo nano /etc/network/interfaces

primary interface, normally eth0, contains these lines:

Currently, we are using dhcp, in order to change it from dhcp to static, then modify and add these lines:

We also need to edit the DNS settings by editing the resolv.conf file:

sudo nano /etc/resolv.conf

Add the appropriate server address after “name server

At the end, restart the networking components:

sudo /etc/init.d/networking restart

Check the new assigned ip address using ifconfig command:

Ping http://www.google.com. If you get a response, name resolution is working:

Hope this will help you!

Please Remember me in your prayers!

One response to “Change Ubuntu Server from DHCP to a Static IP Address

  1. Pingback: How to add static DNS in Ubuntu 12.04 LTS « Lazy Geek -:)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: