Thursday, October 20, 2011

Permanently Set Network Interface Speed, Duplex or Auto Negotiate Settings on Linux


On RedHat (based) Linux:

Edit /etc/sysconfig/network-scripts/ifcfg-eth0 file for eth0 interface.
On my Fedora15, the file looks like the following:
/etc/sysconfig/network-scripts/ifcfg-Auto_wlan

So, open the corresponding file according to your need, then append the following line:
ETHTOOL_OPTS="speed 100 duplex full autoneg off"

Save the file, and restart network interface by executing the following command:
# /etc/init.d/network restart

The previous example is for setting the NIC to 100Mbps, full duplex and no auto negotiation.


If you want 1000Mbs use the following configuration:
ETHTOOL_OPTS="speed 1000 duplex full autoneg off"
or
ETHTOOL_OPTS="speed 1000 duplex full autoneg on"



For Ubuntu and perhaps Debian and other Debian based Linux, edit /etc/network/interfaces, and add pre-up statment, so it will look like something like the following:

auto eth0
iface eth0 inet static
pre-up /usr/sbin/ethtool -s eth0 speed 1000 duplex full

Refer to this link for more information.

For Ubuntu:
Edit /etc/network/interfaces and add the following line:
pre-up /usr/sbin/ethtool -s $IFACE autoneg off 100 duplex full

Tuesday, October 18, 2011

IBM System x3650 M3 Disk Configuration

I just finished working with IBM System x3650 M3. In the beginning, I had trouble with both Ubuntu Server 10.04.3 LTS and Centos 6 not detecting internal harddisks. Doing a little bit search, some informed that the problem is due to the driver, but that is not the case, since Ubuntu Server 10.04.3 LTS already have it.
Then I tried with Centos 6 and faced the same problem, no harddisk detected. Fortunately, I found some info in a forum mention about one need to configure the harddisk in the BIOS first. Aha. This is actually where the issue exist.

In order to configure the harddisks in the BIOS, just boot up the server and wait until a screen mention about Megaraid WebBIOS Configuration, press Ctrl-H.
Then, configure the harddisks as Array RAID. After that, just use Configuration Wizard to set them as as many Disk Group as needed. At this point, Centos 6 could detect the harddisk.

Find official guide from IBM, Installation and User's Guide - IBM ServeRAID-M Software (WebBIOS, MegaRAID Storage Manager, and MegaCLI), here.

Thursday, October 6, 2011

Highcharts Month Year X Axis Format

Highcharts is really awesome. If you need to neat looking charts, this is the answer.

I faced a bit problem with setting the X Axis date format to stick with Month-Year format. That is because Highcharts automatically adjust the best possible date range. To maintain the date range to monthly (Month-Year format), is by using tick interval configuration.
To get monthly date range, set the tick interval to approximately one month, so the value is: 31* 24 * 3600 * 1000.

If Highcharts' Licensing does not fit you, then take a look at jqPlot. Not as fancy as Highcharts, but in my opinion it's the best for totally free js charting solution.




Django ORM Duplicate Group By Condition

I noticed that when using group by with Django ORM, the group by conditions are duplicated. Then I found more information about it in here. Fortunately there is a patch, and the diff file.

The patch should be applied to compiler.py module. On my Ubuntu 10.04 system it is located:
/usr/local/lib/python2.6/dist-packages/Django-1.3.1-py2.6.egg/django/db/models/sql/compiler.py