LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-10-2004, 02:09 AM   #1
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Rep: Reputation: 45
tcp port theory--help


Yesterday i have captured some frames using ethereal... I have noticed that my http requests have the port 32778 ... I wan to know why the client does not use the 80 port and use another one...
Thx
 
Old 12-10-2004, 08:41 AM   #2
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
Were you looking at the source or destination port? The destination port from a client will normally be port 80, but it doesn't have to be. If you've followed a link it could potentially send you to another port. If you are looking at the source port on your client, this will be a variable high value, normally starting from 1024 and working upwards, its quite possible for it to be using this as a source port.

Pete
 
Old 12-10-2004, 09:14 AM   #3
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Original Poster
Rep: Reputation: 45
I am talking about the source port. I cannot understand why it is not the same as the destination... Some application use the same port for client and the server but some other does not (ex. apache) Why?
 
Old 12-17-2004, 10:00 AM   #4
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
One of the functions of the TCP/UDP layer where ports are used, is to multiplex multiple connections from a single host onto the same destination/source ip addresses. Obviously it is possible to open more than one HTTP session from your PC to a web host. So for each session you have the same source/destination IP pair. So how does the IP stack know which packets go with which session? It does this by using different port numbers.

Now obviously you can't easily go changing the destination port as this identifies to the server which service you want. Hence the term "well known ports" - 23 = telnet, 80 = HTTP, 69 = tftp etc. So to make each session unique the client creates a source port unique to the session so that the source IP and port number taken together, collectively known as a 'socket', uniquely identifies the session.

Where you have a function that does not have multiple potential sessions to the same end-point you tend to have the source and destination ports the same. So for instance RIP uses a source and destination port of 520, because what it sends is an IP and MAC layer broadcast and the information will only ever be sent once from each host so why bother allowing for multiple sessions when there won't ever be multiple sessions?

Its really just a case of each protocol following different design principles to best perform their function without over complicating things.

If you want more in depth info on this, google for 'user datagram protocol rfc', you'll get more info on this than you could ever want!
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tcp port 783 hyd_lin Linux - Networking 6 11-27-2003 07:34 PM
How to know some more about an open TCP port? yuzuohong Linux - General 1 05-12-2003 09:42 PM
how is a tcp port opened? Kayaker Linux - Security 7 05-12-2003 12:47 AM
printer on a tcp/ip port brimbleshoes Linux - General 1 11-03-2002 07:15 AM
close port 6000/tcp 515/tcp SchwipSchwap Linux - Newbie 1 09-12-2002 08:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration