
How to configure network card in Red Hat Enterprise Linux, CentOS, Fedora Core from CLI
Red hat Linux provides following tools to make changes to Network configuration such as add new card, assign IP address, change DNS server etc.
[a] GUI tool (X Windows required) – system-config-network
[b] Command line text based GUI tool (No X Windows required) – system-config-network
[c] Edit configuration files stored in /etc/sysconfig/network-scripts/ directory.
Following instructions are compatible with
(1) CentOS Linux
(2) Fedora Core Linux
(3) Red Hat Enterprise Linux (RHEL) 3/4/5
Configuration files stored in /etc/sysconfig/network-scripts/
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 / create 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
Append/modify as follows:
# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:30:48:56:A6:2E
IPADDR=10.10.29.66
NETMASK=255.255.255.192
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=www1.php2s.com
GATEWAY=10.10.29.65
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 8.8.8.8
nameserver 8.8.4.4
nameserver 202.67.222.222
Save and close the file. Now you can ping the gateway/other hosts:
$ping 8.8.8.8
Output
PING 10.0.80.12 (10.0.80.12) 56(84) bytes of data.
64 bytes from 10.0.80.12: icmp_seq=1 ttl=251 time=0.972 ms
64 bytes from 10.0.80.12: icmp_seq=2 ttl=251 time=1.11 ms
You can also check for Internet connectivity with nslookup or host command:
$ nslookup php2s.com
Output
Server: 10.0.80.11
Address: 10.0.80.11#53Non-authoritative answer:
Name: php2s.com
Address: 72.55.186.62
Incoming search terms:
- rhel 6 2 enable nic (2)
- add nic to centos 6 2 (1)
- how to add network card to fedora 11 (1)
- HOW TO CONFIGURE NETWORK CAR IN LINUX (1)
- linux ip configuration (1)
- network card configuration in redhat 6 linux (1)
- redhat enable second ethernet (1)
- redhat enterprise 6 config network (1)
- rhel 5 7 adding ethernet card (1)
- rhel 5 7 how to configure network card (1)



September 2nd, 2010
Frank Boros
Posted in
Tags: 




