Ubuntu: Linux Static IP Configuration in Ubuntu 22.04 and Debian 7/8

Most of the time, we want to have a Static IP address for our Linux servers, So that we can easily reach them. Today in this article, we are going to discuss how to setup the Static IP configuration on Ubuntu Linux.

 

Linux Static IP Configuration in Ubuntu 14.04 :

Open Terminal and become sudo.
sudo su

Then Open network interfaces file using any editor, I am using vim editor here.

vim /etc/network/interfaces

Then edit the eth0 section (In my case, I am changing eth0, your machine may have multiple NIC cards so select appropriate interface).

Here is my configuration after making necessary Changes..

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.36.31
netmask 255.255.255.0
gateway 192.168.36.4
dns-nameservers 8.8.8.8

Then reboot the system.

Now, You can verify your Static IP address using the ifconfig command.

ifconfig
eth0      Link encap:Ethernet  HWaddr 7a:bb:fe:fb:43:bc  
          inet addr:192.168.36.31  Bcast:192.168.36.255  Mask:255.255.255.0
          inet6 addr: fe80::78bb:feff:fefb:43bc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13967 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7627 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:16228155 (16.2 MB)  TX bytes:715215 (715.2 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

That’s it, you are successfully configured static IP address for your ubuntu Machine.


Venkatesh

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

Leave a Reply