Posts tagged: Static IP address to DHCP

Feb 05 2010

Linux DHCP to Static IP Address

———————Linux DHCP to Static IP Address

/etc/hosts – This is for Hostname and IP address
/etc/resolv.conf – This is for DNS
/etc/sysconfig/network – This is for Gateway change
/etc/sysconfig/network-scripts/ifcfg-eth0 – IP,Subnet and Type

1. Host Name and IP information change in /etc/hosts file
[root@RAC01 etc]# pwd
/etc
[root@RAC01 etc]# cat hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.5.80 rac01.localdomain rac01

2. Static IP address information update in Device file

[root@RAC01 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@RAC01 network-scripts]#
— Before Change
[root@RAC01 network-scripts]# cat ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0C:29:6C:66:60
ONBOOT=yes
DHCP_HOSTNAME=RAC01
[root@RAC01 network-scripts]#

— After Change
[root@RAC01 network-scripts]# cat ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.5.80
NETMASK=255.255.248.0
HWADDR=00:0C:29:6C:66:60
ONBOOT=yes

3. DNS information update – Resolv.conf file – No Change required as it is in the same DNS

[root@RAC01 etc]# cat resolv.conf
; generated by /sbin/dhclient-script
nameserver 192.168.1.1
nameserver 192.168.2.1
[root@RAC01 etc]#

4. Gateway information
—Before Change
[root@RAC01 sysconfig]# pwd
/etc/sysconfig
[root@RAC01 sysconfig]# cat network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=RAC01
[root@RAC01 sysconfig]#

— After Change
[root@RAC01 sysconfig]# pwd
/etc/sysconfig
[root@RAC01 sysconfig]# cat network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=RAC01
GATEWAY=192.168.0.3
[root@RAC01 sysconfig]#

Alibi3col theme by Themocracy