Categories: Core Linux

How to assign a IP address on Ubuntu Server !!!

Assigning IPs to the server running Ubuntu as OS.

 

 

Here in the scenario we will consider that the server already has 1 IP address 192.168.1.2 added and with network address 192.168.1.1 and you wish to add 92.168.1.3 to the server

To check the available Ethernet interfaces on the server, you can use the ifconfig command as shown below

ifconfig -a | grep eth

This will give the output as below

eth0 Link encap:Ethernet HWaddr 00:15:c5:4a:16:5a

Now to add the IP temporarly use the command

sudo ifconfig eth0:1 192.168.1.3 up

OR

sudo /sbin/ifconfig eth0:1 192.168.1.3 up

This will add the IP address temporarly to add it permemantly you need to follow the below steps
The ethernet configuration on Ubuntu server is in the configuration file is /etc/network/interfaces

Edit the file

sudo vi /etc/network/interfaces

Append the following configuration:

auto eth0:1
iface eth0:1 inet static
name Ethernet alias LAN card
address 192.168.1.3
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0

Save the file and restart system or restart the network:

sudo /etc/init.d/networking restart


Vishwajit Kale
Vishwajit Kale blazed onto the digital marketing scene back in 2015 and is the digital marketing strategist of Hostripples, a company that aims to provide affordable web hosting solutions. Vishwajit is experienced in digital and content marketing along with SEO. He's fond of writing technology blogs, traveling and reading.

Recent Posts

The Ultimate Guide to WordPress Maintenance: Tips and Tricks

When you’re running a business that relies on website traffic and sales to succeed. Then you need to keep it…

1 week ago

Migrate In 2024: Our Comprehensive Website Migration Manual to the Next Level

Migration! Yes, this word is very big in the web hosting industry and it has its importance. Especially for businesses…

1 week ago

Unveiling the Importance of Server Maintenance Plans: A Comprehensive Guide

The server is the backbone of the web hosting industry and it acts like a HERO in the web hosting…

2 weeks ago

IP Address is Blocked? A handpicked list of Solutions to Fix it?

Imagine you are on holiday having a cup of tea and browsing your website or blog.Then, what next?You will get…

4 weeks ago

Explained: Difference between Nameservers Vs. DNS

The web hosting industry is growing every minute, day, and year. It has many terminologies that are important to understand…

1 month ago