Howto Red hat enterprise Linux 5 configure the network card

Q. I’ve installed Red Hat enterprise Linux 5 and now added one more LAN card (NIC). How do I configure the network card from the command line? I can see 2nd my network card detected while booting the IBM server.

A. 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) Cent OS Linux
(2) Fedora Core Linux
(3) Red Hat Enterprise Linux (RHEL) 3/4/5

Note: If you are using Debian or Ubuntu Linux, please see this configuration howto.

Method # 1: GUI tool system-config-network

Type the following command at shell prompt (open x terminal):
$ system-config-network &

Red hat enterprise Linux 5 configure the network card - system-config-network

You will see Window as above. Now select your Ethernet card (eth0 or eth1) and click on Edit button. You can now setup IP address, netmask, default gateway and other properties.
setup IP address, netmask, default gateway and other properties

You can obtain IP address using DHCP or setup manually. Once IP address assigned, click on Ok button to save the changes. You can activate card by clicking on Activate button.

Method # 2: Command line tool system-config-network-tui

If you don’t have X windows GUI installed type the following command at shell prompt:
# system-config-network-tui &
Command line tool system-config-network-tui
(click to enlarge image)

You will see text based GUI as above. Select your Ethernet card (eth0 or eth1) and hit [Enter] or [F12] special key.

Cent OS, Fedora Core, RHEL configure the network card - system-config-network-tui
(click to enlarge image)

You can obtain IP address using DHCP or setup manually. Once IP address assigned, click on Ok button to save the changes

Method #3: Edit 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.nixcraft.in
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 10.0.80.11
nameserver 10.0.80.12
nameserver 202.67.222.222

Save and close the file. Now you can ping the gateway/other hosts:
$ ping 10.0.80.12
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 cyberciti.biz
Output:

Server:         10.0.80.11
Address:        10.0.80.11#53

Non-authoritative answer:
Name:   cyberciti.biz
Address: 75.126.43.232

You can also use host command:
$ host nixcraft.in
Output:

nixcraft.in has address 75.126.43.232
nixcraft.in mail is handled by 10 mail.nixcraft.in.

See also

=> Howto configure Ubuntu Linux/Debian Linux network configuration

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 1 trackback }

ifconfig: configurare una scheda di rete con linux
05.26.07 at 1:19 pm

{ 22 comments… read them below or add one }

1 Tapan 04.17.07 at 6:08 pm

hi i want to create whole dns with master and slaves so i want entire steps for this please do send it to me.

Thanks & Regards

2 squirrelking 06.30.07 at 9:08 pm

Very useful info. Thanks!

3 mehfuz alam 08.28.07 at 8:20 am

hi,
I want to install the wireless land card on machine with access point of d-link
my wireless is d-link Airplus gdwl g510 pci adapter.plz help me out of this.

4 Dhanesh kumar Solanki 12.11.07 at 2:06 pm

i want to know about rhce exam.

5 nitingupta 02.02.08 at 7:43 am

how to configure master and slave dnd server in redhat version 5 and understanding if each and every file in configuration of dns.

Diffrent types of dns available
Kindly send the reply of this on my mail id

6 David Nilson 02.11.08 at 4:03 pm

Hey, somone chomped down on the text for the commandline tool and listed it as system-config-network, when it should be system-config-network-tui.

All is explained farther down but for those thhat only read what they want, you oughta fix this.

7 DESDERY 02.21.08 at 12:03 pm

Could you please send me the manual book about linux networking

8 alisir.bd 04.05.08 at 10:07 am

Dns Configaration file send

9 Brian Manahan 05.11.08 at 10:54 pm

Very usefull

10 anurag yadav 05.17.08 at 1:24 pm

I made a user in my system and i am login with that user and i want to access neat from that user desktop ,what process should i do ?

11 ashi 09.25.08 at 8:16 am

How to set ip address through yast command?

12 keary.suon 01.16.09 at 3:00 pm

This is an useful website that I never met.

13 inder 02.10.09 at 3:02 pm

im facing problem of editing eth0 by command promt. i had tried ifcfg-eth0 command but its not saving error message is geeting on when i save that script. overrite error message getting. i had tried manny times but still its getting error message. after compliting the script for saving i esc and then shift+zz but its not saving. can u help me out of this problem.

14 Rajendra Bahadur Pal 02.11.09 at 4:14 pm

I have Red Hat enterprise Linx 5 OS n my PC.Pl tell me how to save my PC from virus.Movie player does not work. Tell me how to activate it.

15 Mahmud 03.05.09 at 3:58 am

I have install Redhat linux in my pc as dual OS with Windows XP.I am using Intel DG31PR motherboard and core 2 duo processore. I am not finding any Lan card in linux os. I also insert a D-Ling gigavit ethernet card. first time i got but after changing the hard ware address of the d-link lan this is also disapeared from linux os. please give me the solutions

Thanks
Mahmud

16 Sabuj Barman 04.06.09 at 6:02 am

Can you send me the list of lan cards which support in Redhat Enterprise.

17 Vivek Gite 04.06.09 at 7:14 am

See Redhat HCL.

HTH

18 Bassu 04.13.09 at 7:45 pm

Nice sumup Vivek. Two another minor ways to do that :

setup
ifconfig

19 Ginumon Raveendran 04.15.09 at 4:18 pm

Hi ,

I have installed RHEL 5 , in a DELL PC which was a fresh hardware with out any OS . Now , am facing an issue with configuring my network interface.

While intalling the same I didn’t get an option. Now when I try thru system config network , am not able to enable the same . Am getting some error. Not remember what was the error poped up.

Has any one faced this issue. ..?

What could be the reason..? . How can I configure the NIC now.

Any help is appreciated.

20 Sasi 05.26.09 at 4:07 am

Hi,

I’m trying to configure my dns master server but it prompts me with errors.I would appreciate if you could kindly help me with the troubleshooting.Given below is the error i received and the files i have configured. Thanks.

starting named:
Error in named configuration:
zone p0725763.com/IN: loaded serial 2005071101
zone 0.0.10.in-addr.arpa/IN: loaded serial 1997022700
p0725763_rev:2: SOA record not at top of zone (0.0.10.in-addr.arpa)
zone 0.10.in-addr.arpa/IN: loading master file p0725763_rev: not at top of zone
_default/0.10.in-addr.arpa/IN: not at top of zone

……………………………………………………………..
These are the files i configured.

/var/named/chroot/etc/named.conf

options {
directory “/var/named”;
dump-file “/var/named/data/cache_dump.db”;
statistics-file “/var/named/data/named_stats.txt”;
forwarders { 10.0.0.254; };
};

// for forward lookup

zone “xxxxx.com” IN {
type master;
file “xxxxx_for”;
allow-update { none; };
};

// for backward lookup(for network address 10.0.0)

zone “0.0.10.in-addr.arpa” IN {
type master;
file “xxxxx_rev”;
allow-update { none; };
};

// for backward lookup(for network address 10.0)

zone “0.10.in-addr.arpa” IN {
type master;
file “xxxxx_rev”;
allow-update { none; };
};
………………………………………………………..

/var/named/chroot/var/named/xxxxx_for

$TTL 86400
@ 7200 IN SOA xxxxx.com. root.xxxxx.com. (

2005071101 ; Serial
10800 ; Refresh
3600 ; Retry
604800 ; Expire
7200 ) ; Minimum

@ IN NS ns.xxxxx.com.
@ IN A 10.0.0.1
ns.xxxxx.com. IN A 10.0.0.1
ns.xxxxx.com. IN A 10.0.0.2
www IN CNAME xxxxx.com.

………………………………………………………..

/var/named/chroot/var/named/xxxxx_rev

$TTL 86400
0.0.10.in-addr.arpa. IN SOA xxxxx.com. admin.xxxxx.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
0.0.10.in-addr.arpa. IN NS ns.xxxxx.com.
5 IN PTR xxxxx.com.

21 rani 06.09.09 at 10:57 am

i am using linux system but couldnt able to assign the ip address on it. and if assigned ip address it couldnot able to activate ..message shows that wrong device ethernet card name..so how can i find out the ethernet card device details from my system

22 Akhil 07.01.09 at 7:34 am

Thanks that was useful.
specially the screenshots.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tagged as: , , , , , , , , , , ,

Previous post: Howto disable the iptables firewall in Linux

Next post: Ubuntu download: ISO and DVD file for latest Ubuntu Linux