Network tools for server connections

From MozillaZine Knowledge Base
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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 tools

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:

  • Hping — a complex and versatile version of ping (cross-platform)
  • Putty — a complex and versatile version of telnet (cross-platform)

Looking up

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: 69.147.114.210 (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:

  • No server with that name exists.
  • The DNS is broken.
  • Something on your computer is interfering with the lookup.

Example:
In this example using ping, all you are interested in is the IP address (64.233.183.109):

ping smtp.gmail.com

Pinging gmail-smtp.l.google.com [64.233.183.109] with 32 bytes of data:

Other information follows, but you only need to see the IP address.

Contrast:

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.

Example:

ping smtp.gmail.com

Pinging gmail-smtp.l.google.com [64.233.183.109] with 32 bytes of data:

Reply from 64.233.183.109: bytes=32 time=339ms TTL=249
Reply from 64.233.183.109: bytes=32 time=168ms TTL=249
Reply from 64.233.183.109: bytes=32 time=177ms TTL=249
Reply from 64.233.183.109: bytes=32 time=243ms TTL=249

Ping statistics for 64.233.183.109:
    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:

All the contact attempts succeed.
The server can be contacted and it responds.
Only some of the contact attempts succeed.
Your network connection to the server has problems.
None of the contact attempts succeeds.
Either:
  • The network is broken.
  • The server is broken.
  • The network and the server are both OK, but the server admins have turned off ping support.

Connecting

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

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:

CAPA  See the server's capabilities, if the server supports this.
QUIT  Quit the connection.

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

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:

CAPABILITY  See the server's capabilities.
LOGOUT  Quit the connection (even if you did not log in).

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

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:

HELO your computer name  Greet the server the old way.
EHLO your computer name  Greet the server the new way.
QUIT  Quit the connection.

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, [81.76.193.218]
250-SIZE 20971520
250-8BITMIME
250-STARTTLS
250 ENHANCEDSTATUSCODES
QUIT
221 2.0.0 mx.google.com closing connection 72sm6872260ugb

NNTP servers

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:

HELP  See the server's capabilities.
QUIT  Quit the connection.

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

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.

GET  Get an entire web page.
HEAD  Get a web page's headers only. This is usually enough for troubleshooting.

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

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:

USER anonymous  Login, even without an account.
PASS somone@example.com  Use a phoney password.
HELP  See the server's capabilities.
QUIT  Quit the connection.

Example:&bsp; telnet ftp.mozilla.org 21

220 (vsFTPd 2.0.1)
USER anonymous
331 Please specify the password.
PASS someone@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

LDAP servers are used for address books. The default port is 389. You cannot use telnet to work with an LDAP server.

See also

External links

Wikipedia articles: