Wednesday, September 3, 2014

Ubuntu : How to configure static ip address through command line in Ubuntu

How to configure static ip address through command line in Ubuntu

In this tutorial we will learn simple steps to configure the static ip address in Ubuntu by using command line.
It is always be a good practice to work on Linux or Unix system using command line.As a system admin we always prefer to work by using command line.
Follow the given below steps to configure static ip address through command line in Ubuntu
Step 1: Login into your system and become a superuser or root
Step 2: Now edit the file /etc/network/interfaces. Before this first of all you have to check what is the ethernet device name which is available in system and on which we will configure the static ip address.

First of all run the below command and find the ethernet device name,here for eg, we are using eth0
eth0
Now edit the /etc/network/interfaces file using your favorite file editor and paste the given below content as per your information. (Here I am using the vi editor)
Replace the given value
aa.bb.cc.dd replace with the ip address assigned for the system
yyy.yyy.yyy.yyy replace with Netmask of IP Address
pp.qq.rr.ss replace with Gateway IP Address
For eg.

Step 3:
 Now restart the network service
Step 4: To change the Nameserver settings. Edit the resolv.conf file. In below example I am using Google Nameserver IP Address. You can replace the nameserver information as per your network requirement.

No comments: