5 Steps to Setup Static IP And FQDN to CentOS Machine

Most of the when we start to setup any kind of cluster (for Hadoop, Spark etc…) from scratch, we as a beginner often  face certain problems while performing steps (like setup Static IP address or setup FQDN) after installation of Linux flavour OS on our VM or Machine. There are very less forums where you can get all of these bazics steps together along with full understanding. Here I have tried to explain you the process of setting up static IP address and FQDN (Fully Qualified Domain Name) in 5 steps. All of these steps are tested on VM/Machine available straight after minimal installation of CentOS 6.4.

So here are the steps after you login with your root user on your machine.

Step 1: Changing Ethernet Interfaces to Configure Static IP address

First thing is to change configuration of Ethernet Interface in /etc/sysconfig/network-scripts/ifcfg-ethX (CentOS 6 onwards) or /etc/sysconfig/network-scripts/ifcfg-emX (Prior to CentOS 6). Your current configuration would look like below.

We need to do following changes to make setup Static IP.

Update:

Add:

Step 2: Setup FQDN (Fully Qualified Domain Name)

After updating Static IP address we need to map that IP to domain name in /etc/hosts file by adding one entry with IP address FQDN and hostname.

Step 3: Network Configuration

Add below configuration in /etc/sysconfig/network file.

Step 4: Restart Network Service

Now we are done with our configuration and in order to make those changes effective we need to restart network service using below command.

Step 5: Verification

The final step is to verify the changes using various commands.

  • Command to verify IP Address
  • Command to verify Hostname
  • Command to verify Domain Name
I hope all steps are clear enough to understand. Know more about next steps of setting up a new cluster in my further posts.

 

One comment

  1. Hi,
    when i try to update the statick ip with command /etc/sysconfig/network-scripts/ifcfg-eth2 i am getting the blank page.

    Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *