Network tools for server connections
From MozillaZine Knowledge Base
This article describes some network tools for troubleshooting problems with server connections. These tools can sometimes help you to investigate problems that occur before your Mozilla application establishes a connection to the server, and also some server configuration problems.
The techniques in this article are simple techniques that anyone can use. This article does not cover advanced uses of the tools.
Your Mozilla application establishes a connection in two stages that correspond to status messages like "Looking up..." and "Connecting...". After the connection is established, the status message is like: "Connected..." For advanced ways to investigate problems that occur after your Mozilla application establishes a connection, see: Session logging for mail/news
The only tools you need for the procedures in this article are ping and telnet. You might already have these tools on your computer. Standard versions of these tools are only available from a system command line.
You can use alternative tools, including tools that you download from the Internet. Some tools that you can download from the Internet have simple user interfaces. Others are complex and versatile, but you can still use them for the simple procedures in this article.
Examples of network tools that you can download:
Your Mozilla application looks up a server to find its IP address. For example, a server name like www.yahoo.com might have an IP address like: 22.214.171.124 (All the servers in this article are real at the time of writing.)
You can use network tools to look up an IP address for yourself. Typical tools for this are nslookup, tracert and ping. These tools may provide additional information, but for the looking up stage you are only interested in the server's IP address.
Looking up requires a DNS (domain name system). This is usually provided by your ISP as part of your Internet connection. So if you discover DNS problems, report them to your ISP.
In rare cases, a hosts file on your computer can interfere with looking up. The hosts file is provided by your operating system, and you can edit it to ensure that nothing in it interferes with the server you are investigating.
An error message like "Unknown host" can mean any of:
ping smtp.gmail.com Pinging gmail-smtp.l.google.com [126.96.36.199] with 32 bytes of data:
Other information follows, but you only need to see the IP address.
ping foobar.gmail.com Unknown host foobar.gmail.com
Replies to ping
The ping tool goes one step further than looking up the server's IP address. It also attempts to contact the server, but without actually connecting to it on a port. Usually, ping is configured to make several contact attempts and time the responses. This gives you an idea of how reliable the network is between your computer and the server.
ping smtp.gmail.com Pinging gmail-smtp.l.google.com [188.8.131.52] with 32 bytes of data: Reply from 184.108.40.206: bytes=32 time=339ms TTL=249 Reply from 220.127.116.11: bytes=32 time=168ms TTL=249 Reply from 18.104.22.168: bytes=32 time=177ms TTL=249 Reply from 22.214.171.124: bytes=32 time=243ms TTL=249 Ping statistics for 126.96.36.199: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 168ms, Maximum = 339ms, Average = 232ms
The results are not always useful:
Your Mozilla application connects to the IP address that it found in the looking up stage, on the port number specified in its settings.
You can use network tools to connect to the server yourself. The usual tool for this is telnet. A telnet client can connect to any server on any port. You can type commands to the server, and see the server's responses.
Note: Most telnet clients do not support secure (SSL) connections. A connection to a server that requires SSL will time out—for example, after 60 seconds.
If you have an account on the server, then you might be able to log in and do other things. However, secure authentication requires additional tools that are not usually provided by basic telnet clients.
For the purposes of checking the server and the port, you only need to see the appropriate greeting and then quit. For additional information, see the external links below.
Although you only need to see the greeting, the following examples also show you simple commands that you can type to verify the basic operation of common types of server. After you type a command, press the Return or Enter key.
POP3 servers are used to get mail. The default port is 110.
When you connect to a POP3 server, it immediately greets you. You can type the commands:
Example: telnet pop.esatclear.ie 110
+OK Hello there. CAPA +OK Here's what I can do: STLS TOP USER LOGIN-DELAY 10 PIPELINING UIDL IMPLEMENTATION Courier Mail Server . QUIT +OK Better luck next time.
IMAP servers are used to work with mail. The default port is 143.
When you connect to an IMAP server, it immediately greets you. You can type the commands:
You must prefix each command with an identifier: 1 and 2 in the example.
Example: telnet imap.fastmail.fm 143
* OK IMAP4 ready 1 CAPABILITY * CAPABILITY IMAP4 IMAP4rev1 ACL QUOTA LITERAL+ MAILBOX-REFERRALS NAMESPACE UIDP LUS ID NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY SORT THREAD=ORDERED SUBJECT THREAD=REFERENCES ANNOTATEMORE IDLE AUTH=OTP SASL-IR 1 OK completed 2 LOGOUT * BYE 2 OK completed
SMTP servers are used to send mail. The default port is 25, but 587 is also common.
When you connect to an SMTP server, it immediately greets you. You can type the commands:
Example: telnet smtp.gmail.com 587
220 mx.google.com ESMTP 72sm6872260ugb HELO localhost 250 mx.google.com at your service EHLO localhost 250-mx.google.com at your service, [188.8.131.52] 250-SIZE 20971520 250-8BITMIME 250-STARTTLS 250 ENHANCEDSTATUSCODES QUIT 221 2.0.0 mx.google.com closing connection 72sm6872260ugb
NNTP servers are used for Usenet news. The default port is 119.
When you connect to an NNTP server, it immediately greets you. You can type the commands:
Example: telnet news.mozilla.org 119
200 news.mozilla.org HELP 100 help (GC 3.1.22) article [<messageid>|number] authinfo type value body [<messageid>|number] date group newsgroup head [<messageid>|number] help last list listgroup newsgroup mode reader newgroups yyyymmdd hhmmss [GMT] newnews newsgroups yyyymmdd hhmmss [GMT] next post stat xhdr field range xover range xpat field range pattern quit . QUIT 205 goodbye
HTTP servers are used for web pages, RSS feeds, calendars, etc. The default port is 80.
When you connect to an HTTP server, it silently waits for your command. A command usually requires more than one line. Finish the command with an empty line, and then the server responds.
Follow these commands with headers to specify the name of the host server and to close the connection.
Example: telnet www.mozillazine.org 80
HEAD / HTTP/1.1 Host: www.mozillazine.org Connection: close HTTP/1.1 200 OK Date: Tue, 23 Jan 2007 21:02:42 GMT Content-Type: text/html; charset=ISO-8859-1 Connection: close Server: Apache/2.0.55 (Gentoo) PHP/4.4.0-pl1-gentoo X-Powered-By: PHP/4.4.0-pl1-gentoo X-Cache: MISS from mz5.mz.osuosl.org X-Cache-Lookup: MISS from mz5.mz.osuosl.org:80 Via: 1.0 webcacheB04 (NetCache NetApp/5.5R3D3)
FTP servers are used for file uploads and downloads. The default port is 21.
When you connect to an FTP server, it immediately greets you. You can type the commands:
Example:&bsp; telnet ftp.mozilla.org 21
220 (vsFTPd 2.0.1) USER anonymous 331 Please specify the password. PASS email@example.com 230 Login successful. HELP 214-The following commands are recognized. ABOR ACCT ALLO APPE CDUP CWD DELE EPRT EPSV FEAT HELP LIST MDTM MKD MODE NLST NOOP OPTS PASS PASV PORT PWD QUIT REIN REST RETR RMD RNFR RNTO SITE SIZE SMNT STAT STOR STOU STRU SYST TYPE USER XCUP XCWD XMKD XPWD XRMD 214 Help OK. QUIT 221 Goodbye.
LDAP servers are used for address books. The default port is 389. You cannot use telnet to work with an LDAP server.