Networking Forums

Networking Forums > Computer Networking > Linux Networking > TCP/IP Ports

Reply
 
 
Awie
Guest
Posts: n/a

 
      12-08-2003, 09:06 AM
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
 
Reply With Quote
 
 
 
 
Neil Horman
Guest
Posts: n/a

 
      12-08-2003, 12:22 PM
Awie wrote:
> 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?

You will send a connection request to port 80 on the remote (server)
machine)
> 2. What port will be received by my computer? Is it port 80 or
> un-privilege?

The server will establish a new socket with you in response to the
connect request in (1) on a port above 1024 (remembering that the web
server application can only request unprivlidged ports as well)

> 3. How is about SMTP port? Is it like HTTP or using port 25 for both
> direction?

All TCP connections from user space applications are the same. You send
a connection request to a well-known port (sometimes a privlidged one if
the app has been configured that way) and the actuall connection is
established on an unprivlidged port.

>
> Many thanks for your kind help.
>
> Best Regards,
>
> Awie



--
/************************************************** *
*Neil Horman
*Software Engineer
*Red Hat, Inc., http://people.redhat.com/nhorman
*gpg keyid: 1024D / 0x92A74FA1
*http://www.keyserver.net
************************************************** */

 
Reply With Quote
 
David Efflandt
Guest
Posts: n/a

 
      12-08-2003, 12:59 PM
On 8 Dec 2003 02:06:31 -0800, Awie <(E-Mail Removed)> wrote:
> 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?


Typically any high source port, and destination (server) port 80 (unless
URL contains different port).

> 2. What port will be received by my computer? Is it port 80 or
> un-privilege?


Your client port will be the high port you made the http request from.

> 3. How is about SMTP port? Is it like HTTP or using port 25 for both
> direction?


Destination port for smtp is port 25. Source port could be any, which
would be used to receive responses from the smtp server.

Note that http is one request (ending with blank line) and one reply.
But smtp connects and then has ongoing communication until closed
according to related RFCs.

--
David Efflandt - All spam ignored http://www.de-srv.com/
 
Reply With Quote
 
Alan Connor
Guest
Posts: n/a

 
      12-08-2003, 11:28 PM
On Mon, 08 Dec 2003 08:22:33 -0500, Neil Horman <(E-Mail Removed)> wrote:
>


<snip>

> --
> /************************************************** *
> *Neil Horman
> *Software Engineer
> *Red Hat, Inc., http://people.redhat.com/nhorman
> *gpg keyid: 1024D / 0x92A74FA1
> *http://www.keyserver.net
> ************************************************** */
>


Great post!

But that sig of yours is WAY out of line and amounts to nothing but spam.

The Netiquette limit is 4 lines, specifically to prevent people from using

the Usenet to promote businesses.

If I see it again, I will report you to abuse at yours and my ISP and killfile
your for 30 days, as well as reporting this to Redhat. You are making
them look bad.

PLEASE clean up your act!

You are NOT above the rules that the rest of us follow.

AC

 
Reply With Quote
 
Llanzlan Klazmon The 15th
Guest
Posts: n/a

 
      12-09-2003, 01:17 AM
(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.





 
Reply With Quote
 
Awie
Guest
Posts: n/a

 
      12-09-2003, 06:36 AM
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.

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
 
Reply With Quote
 
Dan
Guest
Posts: n/a

 
      12-09-2003, 01:44 PM
On Tue, 09 Dec 2003 00:28:54 GMT, Alan Connor <(E-Mail Removed)> wrote:


You are joking, aren't you?
>
>But that sig of yours is WAY out of line and amounts to nothing but spam.


>
>The Netiquette limit is 4 lines, specifically to prevent people from using
>
>the Usenet to promote businesses.
>
>If I see it again, I will report you to abuse at yours and my ISP and killfile
>your for 30 days, as well as reporting this to Redhat. You are making
>them look bad.
>
>PLEASE clean up your act!
>
>You are NOT above the rules that the rest of us follow.
>
>AC


 
Reply With Quote
 
Dan
Guest
Posts: n/a

 
      12-09-2003, 02:27 PM
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


 
Reply With Quote
 
Neil Horman
Guest
Posts: n/a

 
      12-09-2003, 02:45 PM
Alan Connor wrote:
> On Mon, 08 Dec 2003 08:22:33 -0500, Neil Horman <(E-Mail Removed)> wrote:
>
>
> <snip>
>
>>--
>>/************************************************** *
>> *Neil Horman
>> *Software Engineer
>> *Red Hat, Inc., http://people.redhat.com/nhorman
>> *gpg keyid: 1024D / 0x92A74FA1
>> *http://www.keyserver.net
>> ************************************************** */
>>

>
>
> Great post!
>
> But that sig of yours is WAY out of line and amounts to nothing but spam.
>
> The Netiquette limit is 4 lines, specifically to prevent people from using
>
> the Usenet to promote businesses.
>
> If I see it again, I will report you to abuse at yours and my ISP and killfile
> your for 30 days, as well as reporting this to Redhat. You are making
> them look bad.
>
> PLEASE clean up your act!
>
> You are NOT above the rules that the rest of us follow.
>
> AC
>

There. Now do something useful with your time.

--
Neil Horman
Red Hat, Inc., http://people.redhat.com/nhorman
gpg keyid: 1024D / 0x92A74FA1, http://www.keyserver.net

 
Reply With Quote
 
Douglas O'Neal
Guest
Posts: n/a

 
      12-09-2003, 06:44 PM
Alan Connor wrote:
<snip>
>
> But that sig of yours is WAY out of line and amounts to nothing but spam.
>
> The Netiquette limit is 4 lines, specifically to prevent people from using
>
> the Usenet to promote businesses.
>

<snip>

The Netiquette *guideline* is 4 lines, specifically because people now
may have to pay per minute for connection charges and historically
because usenet over 2400 baud modems made long sigs expensive.

If you're going to flame somebody for something trivial, at least get
your facts straight. Check out RFC 1855 for something official.

--
Dr. Douglas O'Neal
Manager, Bioinformatics Center
Delaware Biotechnology Institute
(302) 831-3456

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ports help please deauville rider Home Networking 6 08-25-2005 10:09 PM
MN-500 ports ? crumbut Broadband Hardware 3 07-17-2004 01:00 AM
ports bali Broadband Hardware 1 07-15-2004 07:30 AM
Reg. VPN Ports Joy Windows Networking 3 01-07-2004 08:02 PM
USB port adapter -> Multi USB ports existing ? Extending number of USB ports possible ? Thomas Jerkins Windows Networking 1 12-24-2003 01:15 PM



1 2 3 4 5 6 7 8 9 10 11