Adding IP to an interface

Hi, How are you !! Hope you doing good....
I got introduced to Cloud initially. As I went ahead learning what is cloud and how it works, then got to know a field which is DevOps that makes Cloud model more effective.
So, as I started working & got good experience on AWS. I have been learning the DevOps tool and technologies on how to use it with the Cloud, which will give me good understanding on how Cloud and DevOps go hand in hand to deploy my applications.
Last Blog Review →
In the last blog we understood, the importance of network interface multiple tools used in linux to query the network configuration.
What does Adding ip to an interface is ?
Adding an IP address to an interface in Linux essentially means assigning a unique network identifier to a specific network device on the system. This allows the Linux machine to communicate on a network using that particular address.
Way of assigning IP address to an interface ?
DHCP
Static assignment
DHCP -
dhclient -
If we are connected to a network with DHCP server running, then dhclient command can get the IP address for the machine interface
dhclient <interface>
/etc/network/interfaces
We can make change to “/etc/network/interfaces“ file for the interface to be bring up on boot and obtain DHCP IP
auto eth0
iface eth0 inet dhcp
Static Configuration -
Permanent change
If we want to statically configure the interface settings we could do in the /etc/network/interfaces file.
auto eth0 #Bring up the interface on boot iface eth0 inet static address 1.1.1.1 netmask 255.255.0.0 gateway 1.0.0.0 dns-nameservers 10.1.1.1 dns-nameservers 10.2.2.2This change remains after the reboot too.
Temporary change
A static IP address could be added on an interface using ifconfig
ifconfig <interface> <ip-address/mask> up
Conclusion →
In this blog we understood, what is meaning of Adding ip to an interface, how to do it. DHCP can add IP address to an interface and static assignment.




