Howto Red hat enterprise Linux 5 configure the network card

by on April 10, 2007 · 87 comments· LAST UPDATED October 21, 2007

in , ,

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



If you would like to be kept up to date with our posts, you can follow us on Twitter, Facebook, Google+, or even by subscribing to our RSS Feed.


{ 86 comments… read them below or add one }

1 Tapan April 17, 2007 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

Reply

2 squirrelking June 30, 2007 at 9:08 pm

Very useful info. Thanks!

Reply

3 mehfuz alam August 28, 2007 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.

Reply

4 Dhanesh kumar Solanki December 11, 2007 at 2:06 pm

i want to know about rhce exam.

Reply

5 nitingupta February 2, 2008 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

Reply

6 David Nilson February 11, 2008 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.

Reply

7 DESDERY February 21, 2008 at 12:03 pm

Could you please send me the manual book about linux networking

Reply

8 alisir.bd April 5, 2008 at 10:07 am

Dns Configaration file send

Reply

9 Brian Manahan May 11, 2008 at 10:54 pm

Very usefull

Reply

10 anurag yadav May 17, 2008 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 ?

Reply

11 ashi September 25, 2008 at 8:16 am

How to set ip address through yast command?

Reply

12 keary.suon January 16, 2009 at 3:00 pm

This is an useful website that I never met.

Reply

13 roshanarafath March 26, 2011 at 6:12 pm

this website is very useful. i got lot of help from this website

Reply

14 inder February 10, 2009 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.

Reply

15 Rajendra Bahadur Pal February 11, 2009 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.

Reply

16 Mahmud March 5, 2009 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

Reply

17 Sabuj Barman April 6, 2009 at 6:02 am

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

Reply

18 Vivek Gite April 6, 2009 at 7:14 am
19 Bassu April 13, 2009 at 7:45 pm

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

setup
ifconfig

Reply

20 Ginumon Raveendran April 15, 2009 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.

Reply

21 jagjeet singh May 6, 2010 at 11:17 am

first u have to do

1. system-config-network
2. there dialouge box appear
3. select ur eth 0 card
4. prees ok
5. there again dialouge box
6. give ip addrees
7.press ok
8. on cmd mode u have to write
service network restart
ur ip configured

Reply

22 akhtar hussain May 12, 2010 at 11:40 am

Dear jagjeet singh

your answer is the best answer i have ever found. Even a blind man can configure LAN using your answer.

Reply

23 Sasi May 26, 2009 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.

Reply

24 rani June 9, 2009 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

Reply

25 Anonymous May 24, 2010 at 6:37 am

you can configure ip address

login by root

# system-config-network

Reply

26 Akhil July 1, 2009 at 7:34 am

Thanks that was useful.
specially the screenshots.

Reply

27 Lalit July 15, 2009 at 10:13 am

Hi,
I’m using Linux 5 enterprise. How to configure LAN .

Reply

28 me August 14, 2009 at 8:22 pm
29 Vivek Gite August 14, 2009 at 9:04 pm

@ me,

He just copy and pasted from this site. Shame on him. Blogging is not all about copy and pasting other peoples hard work. It is about writing your own diary.

Reply

30 afsal September 25, 2009 at 6:51 am

i am installed the redhat enterprice linux 5.1 and i could not see the network card (NIC) in my computer (administration->network). i am reinstalled the system and again the nic card not showing. please give me an answer.

Reply

31 afsal September 25, 2009 at 7:23 am

How do I configure my Realtek RTL8168/8111 PCI-E Gigabit Ethernet NIC card to work in Red Hat Enterprise Linux 5.1 or later?

Reply

32 subrat October 8, 2009 at 1:55 pm

1)- how to ditect lan card in linux pc when i had remuved device than .

2)- ping with my local net work but google.com is pinging, if get ip by dhcp server.

3)-

Reply

33 biltong October 8, 2009 at 4:41 pm

I had similar problems with the RTL8168/8111 NIC card. There is no driver for this NIC in Red Hat Enterprise Linux 5.1. You will need to install 5.3 or later to get the driver.

Even now, I still have problems with this NIC card. e.g. when sending a large file, I see that data is transferred for maybe 10 seconds at a time, followed by maybe 20 or 30 seconds of no activity, followed by further data transfer.

In the end, I installed a different network card and configured this as eth0 and now, no problems.

Reply

34 ravi prakash November 2, 2009 at 5:22 am

how can i configure the ip and dns properly in cli

Reply

35 abhishek November 9, 2009 at 3:07 pm

i am using linux red het 4,when i check ip by
# ifconfig
lo Link encap:Local loopback
inet addr:127.0.0.0 mask:255.0.0.0
inet6 addr: ::1/128 Scope : Host
UP LOOOPBACK RUNNING MTO:16436 Metric:1
RX Packets:1304 error :0 dropped overrun:0 frame:0
TX packets:1304 error:0 dropped:0 overruns:0 carrier:0

i want to change ip address 127.0.0.1 to 10.131.90.1
how to possible that pls help me

Reply

36 Zaheeralam May 8, 2013 at 10:13 am

ya u can change it by editing

vi /etc/hosts

here u will find 127.0.0.1 u can change it acording to you

Reply

37 Suryakant November 14, 2009 at 10:07 am

i sir how are yoy’

thank’s

Reply

38 Mike Schwager November 25, 2009 at 10:55 pm

Whoops! In section 3, you forgot about editing /etc/hosts. I believe RedHat comes complete with the system’s host ip address set up in /etc/hosts. Don’t forget to give it a look.

Reply

39 abu shaied January 1, 2010 at 2:41 pm

How can i configure primary DNS and secondary DNS? Give answer step by step.

Reply

40 Kamal January 28, 2010 at 6:46 am

Thanks. This was usefull information!!!!!!!

Reply

41 abhay patil March 16, 2010 at 4:38 pm

1)whether the file exists.
2)is the file readable.

3)is the file writable
4)is the file executable

5)is the file a directory.

please output linux red hat 5 please coding.

Reply

42 abhay patil March 16, 2010 at 4:45 pm

vi editor so create file .thats may be file save command is :wq so c programming code in that write but which is the output command please
for example :
# vi abhay
#cat abhay

}
hi helloo
{

save
:wq
in this file only save
but output command please

Reply

43 Rich McIntosh March 24, 2010 at 8:51 pm

Hi I’m currently running cent-os 4.8 w/ vmware so I don’t know if this applies to a native install of the os or is just a bug in vmware, but in any case running ‘system-config-network-tui &’ , backgrounding the program will crash the program (the all familiar terminal goes wacky, gotta ctl-l it) but running it without the background ‘&’ symbol, all runs fine. Just putting it out there in case it helps anyone else. Great article by the way, cheers!

Reply

44 raichanda May 4, 2010 at 7:01 am

it is exactly what i want

Reply

45 Deepak June 21, 2010 at 10:09 am

In my Pc, I installed RHEL 5. When i confidure the LAN by system-config-network or neat, a window will open but it doesn’t show the ethernet like eth0 and i don’t know the name of my LAN hardware.
What should i do?? Please reply me on deepakkumar16@gmail.com

Reply

46 sushil July 9, 2010 at 6:59 am

type command -: ifconfig eth0/1 ip..

Reply

47 Uvais Akhtar August 19, 2010 at 11:50 pm

hii i want to configure ip address in redhat linux 5.0
please give me perfect suggestion so that i can get rid of this problem.
thanks!

Reply

48 suhu credit August 23, 2010 at 3:16 pm

I am still confused when sett IP to anynomous at Linux 5 :(

Reply

49 girish October 4, 2010 at 6:57 am

1)whether the file exists.
2)is the file readable.

3)is the file writable
4)is the file executable

5)is the file a directory.

Reply

50 Ganesh October 15, 2010 at 5:52 am

I have installed linux redhat 9 on pcso now i want to configure samba so i connect linux to xp laptop with cross cable and given both laptop c class ip but what happend from linux pc not getting ping but xp getting ping .
Pls help me to come out this issue .

Reply

51 Deepak October 15, 2010 at 6:47 am

R u giving the correct ip address and subnet mask…there may be problem of subnet mask..you have to give the ip and subnet mask of the same range or you can create a gateway…

Reply

52 Ganesh October 15, 2010 at 7:15 am

yes , i have given IP-192.168.1.11 S.B – 255.255.255.0 to linux pc & xp- 192.168.1.12 subnet mask 255.255.255.0 I think Its right

Reply

53 Deepak October 27, 2010 at 4:20 am

Check whether the cable u r using is correct and fine or working.
Ping your own machine once and check whether there is connectivity or not.

Reply

54 Anoop October 17, 2010 at 3:00 pm

hi friends I am having my dell 1545 with Recovery and windows vista
I want to install RHES 5 .
I want to make Attach server with 5 others computers without DNS configuration means only local area connections .
But I want the to use internet is when i need on only server. what would i have to do . any one help me regarding this full setup with RHES 5..

Reply

55 ak October 26, 2010 at 3:16 pm

My network card shows inactive. How to activate it. Is it compatible to redhat version 4? What is the solution.

Reply

56 Deepak October 27, 2010 at 4:21 am

make the editing in /etc/hosts

Reply

57 ak October 27, 2010 at 12:43 pm

I typed vi etc/hosts
I get a window after that. I dont know how to edit. How to check what is the ip address? I am not expert in redhat. Why my command mode has $ prompt? How can I get # prompt once my redhat start? Deepak, can I chat with you through googletalk?

Reply

58 Deepak October 27, 2010 at 12:46 pm

r u login with the root user?
yeah sure..tell me ur gmail id

Reply

59 Deepak October 27, 2010 at 12:50 pm

send me a mail
my id is deepakkumar16@gmail.com

Reply

60 ak October 27, 2010 at 1:48 pm

Please check your gmail.

Reply

61 roelf November 5, 2010 at 12:56 pm

Thanks for the info, did a manual config. All worked the first time :)

Reply

62 ashwin pawar January 4, 2011 at 8:23 pm

Very useful article. I truly appreciate your knowledge sharing. A very happy New Year to you & all the visitors on this site.

Reply

63 BISHESHWAR KUMAR February 10, 2011 at 5:38 pm

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……

Reply

64 Deepak February 10, 2011 at 6:23 pm

Hi,

May be your LAN is not working.

Procedure:

In GUI:

1. Open console->type neat->hit enter->select ethernet card->give ip->then click ok->if it is unable to configure it, then replace your LAN.

Or if it is ok, but LAN is still down:
run this command0–> ifup eth0 (eth0 is your ethernet name)

ot you can give ip in the configuration file.

Reply

65 saurav adhikary February 21, 2011 at 5:19 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……

Reply

66 Deepak February 21, 2011 at 9:36 am

Hi Saurav,

Give the ip in the configuration file, and then restart the network service.

Then check whether the ip assigned to it or not.

Otherwise, it means your ethernet card is not working.

Reply

67 ashwin February 21, 2011 at 10:45 am

Hi Saurav,
when you do ifconfig..what you see ?
1. To find the driver details:
At the shell, type :
a) lspci | grep Ethernet
b) dmesg | grep ‘eth0′
2. Once you know the type of card, take a look at /lib/modules/kernelver/kernel/drivers/net and see if you can identify the required driver. For example, if your eth0 device is an Intel PRO/1000 card, you would add the following line to your /etc/modprobe.conf file: alias eth0 e1000 (Again depends what type of card you have).
3. what is the output of this cmd :cat /etc/sysconfig/network-scripts/ifcfg-eth0

Reply

68 bharat May 12, 2011 at 7:50 pm

when in master n slave server we allow a zone transfer so what is the configuration of slave server………?

Reply

69 Deepak June 5, 2011 at 1:32 pm

Same configuration of slave as master…just in named.conf….you need to write slave instead of master

Reply

70 abra June 5, 2011 at 8:37 am

hello my dear i want do configuration and other things as follow in steps
1-different between server and client
2-how to give server permission to client
3-how i know ip address
4-how i shutdown client from server
5- how i install software both in client an server in same time
6-steps of share files
7-how i send message to client from server

Reply

71 Deepak June 5, 2011 at 1:33 pm

can you please ask your question in brief???

are you asking for a exam or what…i am not getting you..

Reply

72 abra June 5, 2011 at 4:26 pm

sorry my dear
question as follow?
how i can recognize different between client and server?
how i can shut down client from server?
how i can share file between client and server?
how i can installation software both in server and client?

Reply

73 Deepak June 5, 2011 at 4:52 pm

hey…what type of service(server) are you using…for installation of s/w u can create repository(YUM)..

Reply

74 Deepak June 5, 2011 at 5:00 pm

http://dctechsupp.blogspot.com/
Join this…and ask your question there…They will help you out of your problem..

Reply

75 Redhat is terrible June 17, 2011 at 5:24 pm

Redhat’s archaic and ineffective methods of managing NICs are yet one more reason why you should never ever use Redhat for anything. God forbid you install an OS and shit just works. Redhat is where Linux gets it’s bad rep from.

Reply

76 Nocare Munemo July 26, 2011 at 10:57 am

thanks a lot this helped me greatly.

Reply

77 Malina Kirn August 19, 2011 at 5:32 pm

Thank you very much for this info. Wonderfully complete.

Reply

78 vilas warade August 23, 2011 at 11:44 am

Thanks & Regards

Reply

79 Pavithra September 8, 2011 at 4:32 am

How the conflicts in the IP address and systemname will be resolved.Coz I got to know that two systems can take same name which will lead to conflict.Please let me know how this is handled.

Reply

80 Rachel October 6, 2011 at 11:02 am

hello,
am using a dell laptop, i have installed redhat 6 and am trying to configure network settings. please guide me on how to go about it. i have made my machine a dual boot. tell me how i can make ntfs files viewable in redhat?. am new in using redhat

Reply

81 Nathan February 23, 2012 at 12:32 am

This is great! thanks.

Reply

82 monclers February 26, 2012 at 1:04 am

Hy. I have a wireless network and can not connect to the Internet. ask for help

Reply

83 kuldeep April 6, 2012 at 7:20 am

when we use command system-config-network then my server is not open network. what we do in this regard.

Reply

84 Rajesh May 19, 2012 at 11:40 am

Hello ! Very useful site. I have a linux rhel5 server with an application software being used by more than two persons at a time through lan. I wish to make this server as a web server also, so that other people can access my website on this server. At the same time, my users working with the application software/server through client SHOULD NOT be able to acces the internet. Please provide instructions.

Reply

85 Rajesh May 19, 2012 at 11:41 am

Hello ! Very useful site. I have a linux rhel5 server with an application software being used by more than two persons at a time through lan. I wish to make this server as a web server also, so that other people can access my website on this server. At the same time, my users working with the application software/server through client SHOULD NOT be able to acces the internet. Please provide instructions.

Reply

86 santosh chaubey June 15, 2012 at 2:42 pm

how can we configure DNS in rhel 6

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

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

Previous Faq:

Next Faq: