ethtool : How to Know your LAN Card Status from LINUX

Couple weeks ago, there were problems reported came in my desk related to weird things about LAN connection happened in some place on branch office computers. The fact that one of the LINUX server unable to ping to others LINUX client connected in a LAN and so did from the clients. But the odd things was, the ping connection is successfully from the Windows. Windows displayed normally LAN connection status with default speed of 100Mbps.

So what is the problem with LINUX? First thing, I got checked out the interface with ethtool software from LINUX (standard package found on Redhat setup CDs). This tiny tool displayed the LAN interface more and more details. From the server terminal, I wrote the default command “ethtool eth0” (with assumption that the LAN card is linked to eth0 device file).
[root@server ~]# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 10Mb/s Duplex: Half
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes
Everything is normal, nothings to be wrong on the server. The switch and cables is OK, this is the report answer from last information in Link detected: yes. What about the clients? I also got checked 2 sample client with the same command here, and what the each display said?
[root@client1 ~]# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s Duplex: Full
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes
Yes, there are differences here. The server LAN adapter are working with default speed: 10Mbps (Half duplex), while the clients are in 100Mbps (Full duplex). From these, I tried to force the server to working in clients mode (100 Mbps – Full duplex) with command below:
[root@server ~]# ethtool –s eth0 speed 100 duplex full autoneg off
And voila! The server are working good and ping was successful also the interface status now are same as the client. So, what is the interesting point with the command above? Since I had to force the interface to the same mode as client and the server interface are fully negotiable (shake-hand), so I inserted the parameter autoneg with off value in the last command statement.

Another situation I had face when I tried to connecting the web server in a WAN on one of my experience project. The server LAN on-board interface are looking normal.
[root@webserver ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:01:6C:C2:66:3F
inet addr:10.1.7.50 Bcast:10.1.7.255 Mask:255.255.255.0
inet6 addr: fe80::201:6cff:fec2:663f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:265668 errors:0 dropped:0 overruns:0 frame:0
TX packets:945883 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16602948 (15.8 MiB) TX bytes:1238752271 (1.1 GiB)
Interrupt:11 Base address:0xd100
Without LAN-tester toolkit, I got checked the cables heading to switch. First, I run the command within the cables unplugged:
[root@webserver ~]# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: Unknown! (65536) Duplex: Unknown! (256)
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: no
Second, run the same command with cable plugged in the LAN adapter:
[root@webserver ~]# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s Duplex: Full
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: no
The Link detected: no status tell that there is something wrong with the cable heading to switch. Then I switch the new cable and once again run the same command:
[root@webserver ~]# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s Duplex: Full
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes
Bingo! The problem has solved without LAN-tester kit exist. The connection are now seems to be working well.

  Post a Comment

Meebo: The Finest Chat Gateway

For few days, I’ve been playing around with Meebo – a HTTP based chat application – with it ability to passing blocked protocol for some restricted network environment. It working great with major IM (Instant Messaging) services such as Yahoo Messenger (YM), AIM, Google Chat, MSN & other services which using jabber protocol. No doubt, this is the finest chat gateway ever since Meebo using HTTP port. Nothing can stop the link between connection to your IM friends.

It’s first interface on it site shows 4 major IM services login and also a global Meebo account validation. The login process are quite fast when I tried my YM account. For more, the main panel are similar to YM. My friend IDs and their online status also retrieved completely on it.

The chat transaction are so fun and easy. No wonder, I guess the developer are already using AJAX concept for its interactivity. Behind the advantages, there is a small number of lack when you use Meebo. You have to always focused on the Meebo monitor since its using the browser screen capability (I’ve been tested it on Internet Explorer 7 and Mozilla FireFox 2). You will never know when your friend are getting touch you, except its blink on the main panel in the browser display (even that the panel and the child chat window are able to change its state to pop-up or pop-in).

In other chances, I also tried the desktop version. It was developed with Visual Basic (?) by someone else who fanatics with Meebo. I thought that the desktop version are more identically with the original IM application, but it doesn’t. The concept are just simply put the web version into a web component compiler (TWebBrowser in Delphi or WebBrowser in Visual Basic). It is still no notification when your friend are try communicating to you. One thing for sure, there is an added value for the desktop version, it can minimized to system tray. In other words, you don’t have to wasting time to back again to the browser window and your current work application anymore. But, I was so confused since it’s installer required the .NET framework to operate well. Is there any relation between the requirement with its capability to minimized?

  Post a Comment

PHPMailer: Other Way to Send Email from PHP

What will you do if you have to create an auto email responder in a web application but it hosted on a web server with no local SMTP port opened? Try this tiny module called PHPMailer. With PHPMailer, there are no problem to make any interactive email responder over your web application but – in a condition - you need to provide access to any available SMTP server. Guess what? No big deal about the un-existing SMTP server since there are tons free of it spread over the internet. Just let the uncle Google searched it for you. This article are based on my very own experiences to build yet another Customer Relationship Management (CRM) module upon my web corporate.

First, download the packages from http://phpmailer.sourceforge.net/ and put 3 main files (class.phpmailer.php, phpmailer.lang-en.php & class.smtp.php) into a directory you have specified before (for example: /phpmailer). Next, create a single initialization email function just right below likes all the way you do in a built-in SMTP server web hosting (this is a modification of examples provided by PHPMailer):
require("lib/class.phpmailer.php");
require("lib/phpmailer.lang-en.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "xxx.yyy.zzz.aaa"; // SMTP server
$mail->From = "you@domain.com";
$mail->FromName = "The Webmaster";
$mail->IsHTML(true);
$mail->SetLanguage("en", "phpmailer/");
$mail->AddAddress($email);
$mail->Subject = $subject;
$mail->Body = $pesan;
$mail->WordWrap = 50;

if(!$mail->Send())
{
$info="Server email down. [" . $mail->ErrorInfo . "]";
}
else
{
$info="Respon telah dikirim ke alamat $email.";
}
For some reason, some times you will facing an error message likes "SMTP Error: The following recipients failed [myemail@mydomain]". This error usually occurs because relaying is not allowed on the SMTP server from the IP address of the web server. Go to the configuration of your SMTP server and turn relaying on for your IP address and try again.

In other situation, you might meet another error message likes "Language string failed to load". This is a weird condition for me since there are seem no mistakes over my own PHP source. A short command string below is the answer:
$mail->SetLanguage("en", "./phpmailer/");
Where phpmailer is the subdirectory containing the language file.

Sounds good enough? No? Well, the
$mail->IsHTML(true);
command, enable you to send an HTML email format. Just create the HTML syntax from common HTML editor. I usually using Macromedia Dreamweaver to make a full HTML syntax. Copy all the HTML source into the $email variable and mixed it with another resources such database or images to make some improvements. Sounds good enough now?

  Post a Comment

Last Minutes on Pekanbaru

Once again, I was on my journey to Pekanbaru by my own self due to my existing ongoing project on last Saturday. There were several points have to be done on it. I have to completed some missing documents after got flooded last month, installing the main server & also checking the network status. The next target date will be on 2nd week of this month, so I have to working on it as fast as I can.

By the way, the server are come with Dell brand name, inside the box are stay 3 GHz Intel processor, 1 GB of RAM & 160 GB hard drive. I've installing it with Linux Fedora Core 5 & finished for less than 30 min. The server are done configured with Apache web server & MySQL 5 to accommodate the needs.

To backing up the data, i also set the automatic data recovery which run at 01.00 pm every single day & optionally to powering off at 05.00 pm with cron daemon assist. Hope that the hardware are qualified to fulfill the operational for several years.

Labels:

  Post a Comment