Thursday, July 24, 2008

Reader Question: Network Adapter

The question:

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

great!

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


or

#---
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:

/etc/sysconfig/network-scripts/ifcfg-eth0:

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:

/etc/sysconfig/network-scripts/ifcfg-eth0:

NM_CONTROLLED=no


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

/etc/sysconfig/network-scripts/ifcfg-eth0:

NM_CONTROLLED=yes


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!

Friday, July 18, 2008

A note on Java and OpenJDK

This is curious, I have both Javas, Sun and OpenJDK, installed and for both I have the Firefox plugin (I forgot to remove Sun's after installing OpenJDK). The side-effect was a seemingly high CPU use some times in Firefox. I suspect that it was due to the fact that I have too many extensions that could be fighting over conflicting resources (like 2 extensions that control the behaviour of tabs, I don't know, just bad guess work). Anyway, the point is: it wasn't. Since I removed one of the plugins (Sun's) it all got normal.

So, if you have both plugins (or you forgot that you have both installed, like me) and are experiencing some high CPU use with Firefox, try removing one of them :-)

Have a nice day!