Ubuntu Basics - Set A Static IP On Ubuntu

In this article you will learn how to set static IP address on Ubuntu  from  command line. However, much of Linux administration involves the editing of text files, and assigning a static IP address is no different. You’ll need to edit the following file:

If you have more than one network card, please be sure to make changes to the correct network interface. to verify and check the network card name you can use #ifconfig command

/etc/network/interfaces Initially, the file only contains information about your local loopback address:

auto lo
iface lo inet loopback

To assign a static IP address, you’ll need to make some changes to this file.
Let’s say you want to assign a static IP of  to your eth0 network connection (the first Ethernet adapter on your system; if you only have one, it will be eth0), with a subnet mask of and a local gateway of

$sudo vim /etc/network/interfaces 

Once the file is open, add the following lines:
iface eth0 inet static

Once you’ve added these lines, save the interfaces file to disk, and exit your text editor.
You’ll have restart your network service in your system to load the new IP configuration. You can do that by  restarting the service  you can use this command to force Ubuntu to re-read the configuration files:

$ sudo ifup eth0


$sudo /etc/init.d/networking restart 
Now Your system will then have a static IP address. you can verify using #ifconfig command

Ubuntu Basics - Set A Static IP On Ubuntu Ubuntu Basics - Set A Static IP On Ubuntu Reviewed by Unknown on July 29, 2016 Rating: 5

No comments:

Get Your Business Online Now

Powered by Blogger.