Wednesday, 10 July 2013

Network configuration in Linux




How to configure the network card in Red hat enterprise Linux 5 and Centos 5


You can configure network card by editing text files stored in 
/etc/sysconfig/network-scripts/ directory.

First change directory to /etc/sysconfig/network-scripts/:

# cd /etc/sysconfig/network-scripts/

You need to edit files as follows:

/etc/sysconfig/network-scripts/ifcfg-eth0 : First Ethernet card configuration file
/etc/sysconfig/network-scripts/ifcfg-eth1 : Second Ethernet card configuration file
To edit/create first NIC file, type command:
# vi ifcfg-eth0

modify as follows:


# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)

DEVICE=eth0

BOOTPROTO=static

DHCPCLASS=

HWADDR=00:30:48:56:A6:2E

IPADDR=192.168.1.2

NETMASK=255.255.255.0

ONBOOT=yes


Save and close the file. Define default gateway (router IP) and hostname in 
/etc/sysconfig/network file:

# vi /etc/sysconfig/network

Append/modify configuration as follows:
NETWORKING=yes

HOSTNAME=server1.example.com

GATEWAY=192.168.1.1


Save and close the file. Restart networking:

# /etc/init.d/network restart

Make sure you have correct DNS server defined in /etc/resolv.conf file:

# vi /etc/resolv.conf
Setup DNS Server as follows:
nameserver XX.XX.XX.XX

nameserver XX.XX.XX.XX

0 comments:

Post a Comment

 

Copyright (c) 2010 NETWORK PLANET. Design by WpThemesExpert
Blogger Template by New Blogger Templates.