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.
$ vi /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 # This value should be same as file postfix (i.e eth1 for ifcfg-eth1) HWADDR=08:00:27:87:7B:70 TYPE=Ethernet UUID=ce2a0c5f-fee6-44e1-89e8-bc68162a9a04 ONBOOT=no NM_CONTROLLED=yes BOOTPROTO=dhcp
We need to do following changes to make setup Static IP.
BOOTPROTO=static #To use Static IP as a protocol ONBOOT=yes #To activate device on boot time
IPADDR=192.168.1.10 #Static IP Address (should not conflicted with any other IP in network) GATEWAY=192.168.1.1 #Network Gateway DNS1=184.108.40.206 #Public DNS of Google for internet access NETMASK=255.255.255.0 #Netmask Value BROADCAST=192.168.1.255 #Broad cast IP address
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.
$ vi /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.10 master.backtobazics.com master
Step 3: Network Configuration
Add below configuration in
$ vi /etc/sysconfig/network NETWORKING=yes #YES if to configure network HOSTNAME=master #Hostname without domain name
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.
$ service network restart Shutting down interface eth1: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth1: [ OK ]
Step 5: Verification
The final step is to verify the changes using various commands.
- Command to verify IP Address
$ hostname –i 192.168.1.10
- Command to verify Hostname
$ hostname master.backtobazics.com
- Command to verify Domain Name
$ dnsdomainname backtobazics.com
I hope all steps are clear enough to understand. Know more about next steps of setting up a new cluster in my further posts.