There is a few things going on here.  Everyone that has replied that I have
seen so far, has missed a major thing.  Source Port, and Destination Port
swap for the return packet.

Scenario #1, You want to browse a webpage.

Your PC: 10.192.168.1
Web Server: 10.0.0.2

Your PC sends out a packet, this packet will look partially similiar to this
layout:

  Source Address (Where it came from)         : 10.192.168.1
  Source TCP Port (Random number > 1023)      : 31000
  Destination Address (Where it is going)     : 10.0.0.2
  Destination Port (Well-known service port)  : 80

When this packet comes to the webserver, it looks.. "My IP Address? Yes.
Port number? tcp/80.  Do I know what that port is?  Yes, pass it to Apache."
Apache then looks, "Source 10.192.168.1, new session.  Source port 31000."
It adds : 10.192.168.1,31000 to a table of active connections, and preps a
packet with the information requested.  It will look like this:

  Source Address (Where it came from)         : 10.0.0.2
  Source TCP Port (Random number > 1023)      : 80
  Destination Address (Where it is going)     : 10.192.168.1
  Destination Port (Well-known service port)  : 31000

The packet is then sent through the network to your PC.  Your PC looks at
the packet, "For my IP? Yes. What port? tcp/31000.  Do I know what that port
is? Yes, I just sent a request in Netscape window #2 on that port to the
source address of this packet."  Pass it to Netscape, which opens the file.

This process continues, allow with TCP ACK packets, since this is a tcp
session, until that file is loaded.  This is also done in several threads at
once, to load your webpage faster.

If this still confuses you, draw a picture on a big piece of paper.. two
computers.. several arrows going left and right, and write it out visually.

Just try to remember that for the scenario listed, your PC always uses
tcp/31000 (only in this scenario, it is a random number between
1024-65536).. the webserver always uses tcp/80.  Whether these numbers are
"Source" or "Destination", depends on the direction of the arrow.


1 More attempt.. if the first didn't work.
Think of it like an airplane flight, round trip.  You have a source airport,
and a destination airport.  On the way home, they are swapped.

Vancouver to Toronto:
To Toronto, your ticket (packet) is like this:
Source Airport (where I'm leaving) : YVR (just like an IP, it is unique)
Source gate : Domestic, A30
Destination Airport (Where I'm going) : YYZ
Destination gate : Domestic, I43

On the way home, for the sake of this example, your flight happens to use
the same gates (since they do in a tcp session).  This is a round trip
ticket, so I'm not leaving from Vancouver, I'm going to Vancouver.

Source Airport (where I'm leaving) : YYZ (just like an IP, it is unique)
Source gate : Domestic, I43
Destination Airport (Where I'm going) : YVR
Destination gate : Domestic, A30

Just an analogy to see if it helps.. some people get it, some don't.  That's
the way I thought of it at first, and now it's just second nature.

 Regards,
  Trevor Corness, CCNA MCSE MCP+I
  Network Systems Engineer, DataCom
  BMS Communications Ltd.
  http://www.bmscom.com

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
RAUNIYAR RAJEEV
Sent: Friday, September 29, 2000 1:05 PM
To: [EMAIL PROTECTED]
Subject: Could someone help me !

Hi all,

now i DO have a question. i'm reading up about ports used by TCP/UDP
protocols but im having trouble visualizing where the source port and
destination ports fit in. im thinking that the destination port (suppose
on a www, http segment) of 80, would be on the server from which we will
download the data right? and we would specify a port (called source
port) to which we want the data to come into our machine right?
but then how would the www server distinguish between many sessions if
their port is always port 80??

another example... suppose a college closes a "napster" port... can't you
just log onto the napster server using a different port from your
college? hmm.. i really confused.

could you somehow help me visualize where these ports are in the
network. and who sets them and how destination servers and clients differ
etc..

thanks,

BEGIN:VCARD
VERSION:2.1
N:Corness;Trevor
FN:Trevor Corness
ORG:BMS Communications;DataCom
TITLE:Network Systems Engineer
TEL;PAGER;VOICE:604-631-7867
ADR;WORK:;;2880 Production Way;Burnaby;BC;V5A4T6;Canada
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:2880 Production Way=0D=0ABurnaby, BC V5A4T6=0D=0ACanada
URL:
URL:http://www.bmscom.com
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20000921T155409Z
END:VCARD

Reply via email to