Configure RHEL 5 Networking

 

Configure RHEL 5 Networking

Change Host Name

echo layer7 > /proc/sys/kernel/hostname

* See Redhat Linux Change Host Name

Setup Network Card: eth0

vi /etc/sysconfig/network-scripts/ifcfg-eth0
# VMware VMXNET3 Ethernet Controller
DEVICE=eth0
BOOTPROTO=static # static IP address
ONBOOT=yes
HWADDR=00:0a:20:56:14:0b
IPADDR=192.168.1.61
NETMASK=255.255.255.0
PEERDNS=no  # This prevents /etc/resolv.conf from getting overwritten by /sbin/dhclient-script

Setup Networking

vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=layer7.mytest.local
GATEWAY=192.168.1.1
NETWORKING_IPV6=no

Setup DNS

vi /etc/resolv.conf
search mytest.local
nameserver 192.168.1.21

Setup /etc/nsswitch.conf

vi /etc/nsswitch.conf
hosts: files dns

Setup /etc/hosts File

* If nameserver is not setup, then we need to setup hosts file.
* If you have in /etc/nsswitch.conf file “hosts: files dns”, then /etc/hosts configuration overrides dns configuration.

vi /etc/hosts
192.168.1.61    layer7

Restart Networking

/etc/init.d/network restart

Issues

network restart: device eth0 seems not to be present

* Issue: When you clone or import a CentOS 6 virtual machine, for example by importing OVF template, you’ll notice that:
– eth0 is missing when you issue ifconfig command
– When you try to restart networking with network restart command, you get “device eth0 seems not to be present” error message
* Reason:
– CentOS 6 caches the original network card address in /etc/udev/rules.d/70-persistent-net.rules file
– When Centos first starts, it sees the conflicts and renames eth0 to eth1
* To fix, remove the cache file and reboot

rm /etc/udev/rules.d/70-persistent-net.rules
reboot
This entry was posted in redhat and tagged , . Bookmark the permalink.

Leave a Reply

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


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.