Configuring Static IP in Cent-OS

1. Log on as root on terminal.

# cd /etc/sysconfig/network-scripts
# ls -la | grep ifcfg- 

It will list files-
For Example-

-rw-r--r--  3 root root   244 Nov 02  2012 ifcfg-eth0
-rw-r--r--  3 root root   141 Nov 02  2012 ifcfg-eth1

In this example, I am going to edit ifcfg-eth0 file and add IP information in it.

# vi ifcfg-eth0

Gives-

# Intel Corporation 82574L Gigabit Network Connection
DEVICE=eth1
HWADDR=00:25:90:0B:A3:E5
ONBOOT=no
HOTPLUG=no
BOOTPROTO=dhcp
TYPE=Ethernet

Now for Assigning static IP, edit file accordingly:

# Intel Corporation 82574L Gigabit Network Connection
DEVICE=eth1
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:25:90:0B:A3:E5
IPADDR=10.35.34.226
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT=yes

To setup DNS servers, edit /etc/resolv.conf, enter

# vi /etc/resolv.conf

Put this configurations-

nameserver 8.8.8.8
nameserver 8.8.4.4

We need to restart network service

# /etc/init.d/network restart
Or
# service network restart

To Check new IP:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s