Thursday, July 24, 2008

Reader Question: Network Adapter

The question:

Anonymous has left a new comment on my post "My Fedora 9 road map":


what have been changed in your /etc/sysconfig/network-scripts/ifcfg-eth0? My fedora 9 sometimes can't detect my eth0 network card, I would like to know what config have to be changed about device eth0.

Ok Anonymous, here is the deal. You have basically two main approaches for networking: by hand our by NetworkManager. I will explain both but in case you do not have any reason not use NetworkManager I recommend it (it has some drawbacks nevertheless).

For the following instructions I assume that you are logged as root.

1. Per hand:

I assume that you do not like the GUI configuration program (which is fairly decent, as root: system-config-network) so the first step is to discover what NIC (Network Interface Controller) do you have:

1.1. Which NIC I do have:

lspci # looking for Ethernet


lspci | grep -y ethernet

I assume that you have the driver for it (as you said it does not work sometimes). But I does not hurt searching for any "tricks" regarding your specific NIC (googling it gives you the answer).

1.2. Looking if my NIC is "online":

Sometimes the problem is not on the NIC but on "loosing" the IP. So check it out:

ifconfig -a

Pay attention to the output, it must list as may "real" adapters as NICs you have (loopbacks, alias, and vmware/vbox adapters are virtual).

At this point I may answer your question: do you have more than 1 NIC? If yes then your problem is probably on knowing how to name eth0 and eth1 and so on. That is a very simple problem. Take note of the MAC address of each of your NICs, choosing the number of each one and add to /etc/sysconfig/network-scripts/ifcfg-eth0 the following line:


HWADDR=<the same string from ifconfig>

Repeat it for the other NICs that you may have.

1.3. Configure the rest of the parameters:

The rest is like to be configured (you said that it eventually works) but add one more line:



That prevents the NetworkManager from trying to override your configurations.

1.4. Deactivating the NetworkManager:

chkconfig --level 2345 NetworkManager off

1.4.1. There is another nice TUI program that I like for such configurations:

ntsysv --level 2345

1.5. Restart and check-out if it boots ok.

That is what I have to say to you based on your comment. If it does not work I could try to help you (but leave a comment with your email, I will not publish it so no spam :-)).

2. With NetworkManager:

The NetworkManager is a great tool if you have a standard machine or a notebook, because it really makes everything easy, specially with wireless and so on. In my notebook I use it but in my desktop at home no (it has more than 1 NIC and the NetworkManager is not that great with that, at least that is what my experience tells).

2.1. Enabling NetworkManager:

The very first step is to add the following line to your ifcfg-eth0



Then you need to enable the service at boot time:

chkconfig --level 2345 NetworkManager on

That is pretty much it. Just boot up and check it out.

3. Pros and Cons from NetworkManager:

The most annoying aspect of it is that it is an on demand "almost-pre-login" service and it prevents other network dependant services to work properly at boot (ntp can not adjust the clock at boot if you use NetworkManager). That for me is not ok. But again it is not its fault. The service is designed for that and to be frankly it is better so (it will be very annoying to asked at boot time to figure it out how to connect to the hotspot of your hotel, specially if it requires to logon in a home-page and put your login data). That said it relieves the pain of configuring your network every time you are relocated (if have to travel regularly you know what I mean).

That is why I prefer to suffer some lack of service in my notebook but keep things tight under my control in my desktop (I do not carry it with me, never). But it is always up to you.

Again, if you have any question you can send me a comment with your email (I will not publish your comment with your email) and I will try to help you.

Have fun!

1 comment:

Anonymous said...

Thanks, Mr. Gustavo Kuhn Andriotti
I am very glad that you gave me the answers in such full details. I like your blog and have learned more from the road maps you wrote in your every upgrade of linux.
I will ask some thing that I don't know in my Fedora life. And I would like to have more chances to learn from your experiences about Fedora.