Setting Static IP on Ubuntu Server

In this article I want to share how to set a static IP on ubuntu server. Through this way, the IP address will be stored permanently on your server. This method can also be applied to the desktop version of Ubuntu Linux.
To configure a static IP address on Ubuntu server we need to edit the file by running the
command nano intefaces. Interface file is located in /etc/network/interfaces. Written command is:
sudo nano /etc/network/interfaces

Then the editor will open interfaces. Then edit its configuration according to your wishes. Examples like this:

# The loopback network interface
auto lo
iface lo inet loopback

auto eth1
iface eth1 inet static
        address 192.168.1.10
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

Save the configuration by pressing Ctrl-O and come out with a press Ctrl-X
After that we need to configure the DNS server by editing the file /etc/resolc.conf. Give the following command:

sudo nano /etc/resolvc.conf

Then resolvc.conf editor will open. Then edit the following configuration:

nameserver 8.8.8.8

Save and exit out of the file and restart the connection by giving the following command:

root @ ubuntu: ~ # /etc/init.d/networking restart

* Running /etc/init.d/networking restart is deprecated Because It may not enable again some interfaces
 * Reconfiguring network interfaces ...
Ignoring unknown interface = eth1 eth1.
                                                         [OK]
root @ ubuntu: ~ #

If the status is OK, then the server is ready for use. Check back ip address of the server by giving the following command:


root @ ubuntu: ~ # ip addr

Good Luck....!

Comments

Popular Posts