How to configure Static IP Address in linux RHEL/ CentOS 5/6

To configure network setup in produciton server you need valid ip address, Subnet mask, Gateway address and DNS IP .
Server Information
Operating System: Centos - 5.4
IP Address: 192.168.1.5
Subnet mask: 255.255.255.0
Gateway IP: 192.168.1.1
DNS IP: 8.8.8.8
Network Configuration file: /etc/sysconfig/network-script/ifcfg-eth0
DNS configuration file: /etc/resolv.conf

Edit file to setup network configuration
# vim /etc/sysconfig/network-scripts/ifcfg-eth0
Syntax:
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.5
NETMASK=255.255.255.0

Edit File to setup Gateway IP Address in specific file

# vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=vncserver.shahzad
GATEWAY=192.168.1.1

Restart networking service
# service network restart

Permanently on Network service on startup
# chkconfig network on

Now configure DNS

# vim /etc/resolv.conf
Nameserver 8.8.8.8

Test configuraiton

# ping 192.168.1.1   ( Ping your gateway ip address)
# ping 8.8.8.8
#ping google.com    











Both gateway and DNS ip address should ping. If both address is pinging then you have setup networking successfully. 
Share on Google Plus

About Penguin Technology

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

0 comments:

Post a Comment