On 8 Dec 2003 23:36:44 -0800,
(E-Mail Removed) (Awie) wrote:
>Llanzlan Klazmon The 15th <(E-Mail Removed)> wrote in message news:<Xns944C9B6816E11LlanzlanLlurdiaxorbn@203.97. 37.6>...
>> (E-Mail Removed) (Awie) wrote in news:9d964c5f.0312080206.5b799ae2
>> @posting.google.com:
>>
>> > All,
>> >
>> > I am sorry to ask a very basic question. But I am rather confuse about
>> > TCP/IP Port and need to make sure. Hope you would explain me.
>> >
>> > Let say I want to access a WEB server
>> >
>> > 1. Will my computer use un-privilege port (above 1024) to destination
>> > server or use port 80?
>> > 2. What port will be received by my computer? Is it port 80 or
>> > un-privilege?
>> > 3. How is about SMTP port? Is it like HTTP or using port 25 for both
>> > direction?
>> >
>> > Many thanks for your kind help.
>> >
>> > Best Regards,
>> >
>> > Awie
>>
>> The TCP packet sent from the client to set up the connection contains
>> Source & Dest IP plus Source and Dest ports. The client specifies a
>> destination port for which an application is listening on the server
>> (e.g. http = port 80). The client OS assigns a source port to uniquely
>> identity the connection.
>>
>> e.g SYN packet for an hhtp connection
>>
>> S IP = 192.168.1.10, S Port = 1025, D IP = 192.168.1.5, D Port = 80
>>
>> the S IP is the client and the D IP is the server. For this to work, the
>> server must have an application (e.g Appache) listening on port 80.
>>
>> If the server accepts, it replies using the S & D IP & Port swapped over.
>> The reply will be a SYN AK:
>>
>> S IP = 192.168.1.5, S Port = 80, D IP = 192.168.1.10, D Port = 1025
>>
>> and so on.
>>
>>
>> If the same client wanted to open two concurrent http connections to the
>> server. The client OS will assign a different source port to identify the
>> second connection as being different to the first one. e.g SYN packet:
>>
>> S IP = 192.168.1.10, S Port = 1026, D IP = 192.168.1.5, D Port = 80
>>
>> There are some exceptions where the source port is pre-specified. But the
>> above is the general way things work. smtp is the same as above. ftp is a
>> bit different as it has seperate ports for control and data. For active
>> ftp the data connection is openned the reverse way around (from server to
>> client).
>>
>> L.
>
>Many thanks for your explain. But I am still vague to understand it.
A tcp socket consists of an ip address and a port.
A tcp connection between two sockets consists of an ip address and
port at the remote end, plus an ip address and a port at the local
end.
A web server will normally listen on port 80, one of the so called
well know ports. That means that it's ready to make a connection on
that port.
Your browser will try to connect to the web server's ip address on
port 80. In doing so, it has to tell the remote end what it's own ip
address and port number are. The local port (browser end) will be
assigned from a pool of free ports. That port will stay in use for
the duration of the tcp connection.
It's similar for any other tcp connection. One end will be listening
on a specified port, usually a well know one. The other end will try
to connect to that remote port, but it's own port number is not
important. The listening end needs to be on a port that the other end
knows to connect to. The listening end gets told what the other end's
port number and ip address are when the connection is made.
The end that's passively listening for a connection is generally
called a server. The end that's actively trying to connect to the
server is generally called the client. The client's port number is
usually assigned from a pool by the operating system.
You asked about two smtp servers making a connection. It's probably
better to think of an smtp server as having two functions, both of
which it can perform at the same time. When it's listening on port
25, then it's a server. When it's trying to connect to another smtp
server, then it's really a client. When it's a client it will try to
connect on the server's port 25, but it's own port will be an assigned
one.
Dan
>
>I want to mark the packet then doing QoS. Below the packet that I want to mark:
>
>1. HTTP packet from server to client.
>2. Incoming SMTP (server to server communication)
>3. Outgoing SMTP (server to server communication)
>
>From my plan above I assume that:
>
>a). All packets from HTTP server use port 80 (HTTP) to high port (> 1024) of client.
>b). All incoming SMTP packets use High port to SMTP port (25) of my email server.
>c). All Outgoing SMTP packets use High port to port 25 of destination server.
>
>Please correct me if wrong.
>
>Thx & Rgds,
>
>Awie