Adding static ip address to ubuntu

staticip
staticip

In today’s tutorial we are going to configure static ip in ubuntu. The steps are as follows:

Install vim editor if have not previously:

Now open interfaces file in networks using the following command:

Add the following code:

The address,netmask and gateway value will change according to each os. The address and netmask has to be added from parameters in ifconfig command:

 

Add inet addr as address and Mask value as netmask in interfaces file.

For gateway we need to run the following command:

Copy the gateway value from above to interfaces file.

Once you are done with editing save and close the interfaces file.

Next run the following commands to start using static ip address:

or

Thats all for today’s tutorial.

Bonus tip:

If you are trying to assign static ip to a docker container make sure you add following tag in the run command:

Connect deeper:

You can like our facebook page to get notified about similar posts in the future here: Technoetics

Share post-
About Saurabh Mhatre 71 Articles
Currently working in web and hybrid application development