CONFIGURING STATIC IP ADDRESS ON CENTOS 7
Configuring the network and setting up servers into the network is the primary administration task of any System Administrators.
In some cases, It can be automated using DHCP (Dynamic Host Configuration Protocol) Which will automatically assign IP Address to the servers/Desktops.
But In larger Infrastructured companies, In order to avoid network issues, We have to configure static IP Address.
Here is some information we will be using in this tutorial:
NETMASK : 255.255.255.0
DNS SERVER 1: 22.214.171.124
DNS SERVER 2: 126.96.36.199
DOMAIN NAME: linuxcloudops.com
To find the available network interfaces on the server, You can use any one of the commands:
#ip a [or]
The output may look like below.
We can see that We have one network interface name eth0.
If you wish to change the IP Address of this network interface, We have to edit the network interface file.
Configure Static IP Address
The network interface file will be under /etc/sysconfig/network-scripts/ directory.For example, We can use device name as eth0
Open this file and update this interface file as per the requirement, save and close the file.
You can also use nmtui a text-based user interface which is used to configure network interfaces.
To use this command, We need to install NetworkManager-tui if not already installed, Like below:
#yum install NetworkManager-tui
Once installed, Just enter nmtui in the terminal and Enter
You will see the following screen.
Choose Edit a connection and press Enter. You will see the below screen.Choose Edit and Press Enter
Set the IP Address and all the required information and enter OK.
Restart the Network Service
We need to restart the network service to have changes take effect.
#systemctl restart network
Verify IP Address
If you wish to verify the IP Address you have set, Use the below command to check:
Verify DNS Entries
To check the DNS entries:
You will see something like this:
If you wish to change the name servers, You can edit /etc/resolv.conf file.
That’s All.Thanks for reading this tutorial.Hope It helped you to configure IP Address in your Infrastructure successfully.