[svlug] Ethereal! -was- Re: Connection refused by host

Mark S Bilk mark at cosmicpenguin.com
Fri Sep 3 03:30:56 PDT 2004


In-Reply-To: <BAY15-F25vXee4fDGCl0000a118 at hotmail.com>
Organization: http://www.cosmicpenguin.com/911

On Thu, Sep 02, 2004 at 10:30:11PM -0600, skip evans wrote:
>Any suggestions what to look for next?
>
>I want off hotmail.... BADDDDD!!!!

The first thing to do when you have any kind of network 
problem like this is to run ethereal, the wonderful 
packet/stream capture/analyzer program.  (Someone told me
about it at an SVLUG installfest -- many thanks!)

Here's the command I use to run it (you have to be root):

  ethereal -i eth0 -k -S -t a -f 'not arp'

-i eth0 -- selects the network card; use -i ppp0 if you're 
  on a modem

-k -- starts capturing immediately (or omit it and start 
  manually)

-S -- updates the display in real time

-t a -- stamps the packet list entries with clock time 

-f 'not arp' -- filters out the Address Resolution Protocol 
packets that my cable-internet provider constantly bombards 
my machine with.  If you don't get them, then you don't need 
this filter specification, although it won't hurt anything.

So then contact your mail server or whatever, and when it's done
and has thrown the error, stop ethereal from capturing packets.
Then look in the packet listing window, find one of packets 
from the interaction with the server, click on it, go to the
Tools menu, and select "Follow TCP Stream".

You'll get a window showing the complete two-way conversation
in ASCII, with the two directions distinguished by red and blue
coloration!

With any luck the reason for the error will be mentioned by the
remote server, or you'll be able to see something that isn't 
right just before the error occurs.  I don't know anything about
imap; you might have to look at some individual packets instead
of a tcp stream, but ethereal will display the data in those 
packets in human-readable form -- to dig down into it just click 
on the packet tree structure shown in the window underneath the 
packet list.  

The information you need may also be tucked away in a log file 
somewhere, but ethereal is so easy and so much fun to use, and 
so educational (it can analyze and display all the fields in 
virtually any kind of packet), that I always try it first.

You can also use ethereal to help capture information from a 
remote server, with the help of another program, netcat.  Netcat 
establishes a tcp/ip connection with whatever remote ip-address
and port number that you specify, and sends it everything you
put into netcat's standard input.  Everything the remote sends
back comes out of netcat's standard output.

I used to use wget to capture mp3 webradio streams to a file, 
but some mp3 servers would quit sending after the first few 
packets.  Wget is not designed for this function, and apparently
doesn't always do the right handshaking, or maybe it's the one
that sometimes quits.

So I used the xmms sound player to listen to one of these streams, 
and recorded the initial conversation using ethereal, as above.
Then wrote a bash script to run netcat, connect it to a specified
remote port, and send it the right information to make the mp3 server 
there happy (only part of what xmms sent was needed).  Then the script 
takes the output from netcat and stores it in a specified file.  It 
uses a tiny C program to snip off the ASCII header at the beginning 
of the mp3 stream; this is probably unnecessary -- the header might 
just make a little click -- but the script prints the header to the
screen, so if the connection doesn't go through you can read the 
diagnostic information in it and find out why.

Ethereal and netcat -- your eyes and hands on the network!

  Mark

>Hey all,
>
>I'm trying to get my mail server set up on a FreeBSD
>4.9 install using imap-uw. This one was recommended
>because it supports the Squirrel mail html interface, as
>well as servicing mail clients.
>
>I followed the instructions on this page:
>http://www.puresimplicity.net/~hemi/freebsd/sendmail.html
>
>Seemed pretty straightfoward. I updated the tree first,
>then built cclient and imap-uw with:
>
>make -DWITH_SSL_AND_PLAINTEXT install
>
>Then I put the following lines in /etc/inetd.conf:
>
>imaps   stream  tcp     nowait  root    /usr/local/libexec/imapd        
>imapd
>pop3s   stream  tcp     nowait  root    /usr/local/libexec/ipop3d       
>ipop3d
>
>I then sent inetd a -HUP which I assume causes
>it to reread the config file.
>
>I then tried to connect to the server from my
>workstation after setting up an account pointing
>at the server.
>
>I got an error mesage saying it could not connect to
>the server, and it cited the correct IP address, so I
>think it is looking at the right thing.
>
>I also made sure that the ports were open in
>/etc/services.
>
>Any suggestions what to look for next?
>
>I want off hotmail.... BADDDDD!!!!
>
>Skip
>
>_________________________________________________________________
>Get ready for school! Find articles, homework help and more in the Back to 
>School Guide! http://special.msn.com/network/04backtoschool.armx
>




More information about the svlug mailing list