Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > Computer Security > Ports and Protocols

Reply
Thread Tools

Ports and Protocols

 
 
Lam Duk
Guest
Posts: n/a
 
      11-17-2004
I have a pretty basic question about how ports are used. I know that different
protocols use ports, most commonly TCP and UDP. What I want to know is if the
same port can be used for different protocols at the same time. For example, if
one application uses 1300/TCP, can another application on the same machine using
the same TCP/IP interface use 1300/UDP? Or must it use a different port even
though it is using a different protocol? In the case of sequentially assigned
dynamic ports, will the next unused port be assigned, regardless of protocol?
--
Lam Duk
Genius is the ability to see the obvious.


 
Reply With Quote
 
 
 
 
KG6VQE
Guest
Posts: n/a
 
      11-18-2004
Lam,
Assuming this isn't a hoax posting, the best example is a machine used as a
Web Server. Normal WEB Traffic (HTTP) posts to port 80. So for a given IP
address, the TCP Interface for port 80 goes to the Application serving the
HTTP server. One way for a single machine to host mutiple sites, is to
allow the interface to use different Ports. so for instance, the hosting
site of www.server1.com is using port 80, www.server2.com is using port 180,
www.server3.com is using port 280. All of these servers can be hosted on
one machine, differentiating by the port numbers.
You use the terms Protocol and Ports together. A protocol is simply an
agreed standard, such as FTP, HTTP, TELNET, DNS, etc. The protocol is
simply an prior agreed to standard for exchanging information. The only
difference is that each of the published "STANDARD" protocols are assigned
default port numbers. Most server application hae the ability to change the
"listening" port number. So you can run an FTP Server on 221 instead of the
default Port 21.
The real question is, if two server applications used the same port, how
would they be able to determine the difference in data. Technically, the
handshaking sequence would be different, but you would have to have an
intelligent handler look at the incoming data, and determine whether is was
destined for each server. Sounds quite complicated.
I use a firewall (Watchguard SOHO) that lets me redirect Port Numbers to
differnet Service Hosts. The Service Host is a machine that is listening
for activity on a given port. The Firewall has about 20 default ports, and
retains the possibility to "roll your own port". Comes in very handy.
Hope this answers your question.
--


----------------------------------------------------
This mailbox protected from junk email by MailFrontier Desktop
from MailFrontier, Inc. http://info.mailfrontier.com

"Lam Duk" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a pretty basic question about how ports are used. I know that
>different
> protocols use ports, most commonly TCP and UDP. What I want to know is if
> the
> same port can be used for different protocols at the same time. For
> example, if
> one application uses 1300/TCP, can another application on the same machine
> using
> the same TCP/IP interface use 1300/UDP? Or must it use a different port
> even
> though it is using a different protocol? In the case of sequentially
> assigned
> dynamic ports, will the next unused port be assigned, regardless of
> protocol?
> --
> Lam Duk
> Genius is the ability to see the obvious.
>
>



 
Reply With Quote
 
 
 
 
Lam Duk
Guest
Posts: n/a
 
      11-18-2004
>Assuming this isn't a hoax posting, the best example is a machine used as a
>Web Server.


No, it is not a hoax posting, and I don't know why you would think it is. It is
a genuine question, which you didn't really answer. Let me lay out a
hypothetical scenario. Let's assume I have a DNS server which uses the normal
port 53 and UDP protocol. Let us also assume I have a HTTP server, which uses
the TCP protocol. I know I can set the server to respond on any port I want, not
just the normal port 80. My question is, is it possible to set the HTTP server
in this hypothetical setup to port 53/TCP, sharing the port 53 assignment with
the DNS server, which uses a different protocol? My instincts tell me no, that
only one service can serve a given port at the same time, regardless of
protocol, but I've never seen that written down anywhere. I don't have any real
life requirement for such a setup. I just want to fill in the blanks in my
education.
--
Lam Duk
Genius is the ability to see the obvious.


 
Reply With Quote
 
Celtic Leroy
Guest
Posts: n/a
 
      11-18-2004
"Lam Duk" <(E-Mail Removed)> wrote:

>... It is a genuine question, which you didn't really answer.


Don't you just hate it when people give long drawn out answers, then
don't even answer you?!?!?!

The answer is No! You cannot have 2 different programs using the same
port number with different protocols. Once a program begins using, or
"listening", on a port, that port is considered "in use" and you'll
get an error if you try to connect with another program.

Effectively, TCP and UDP are very different and would never normally
be used within the same application. UDP is connectionless and TCP is
an acknowledged connection protocol. The port number is how sockets
keeps all the connections separated by program.

Hope this helps.
 
Reply With Quote
 
Lam Duk
Guest
Posts: n/a
 
      11-18-2004
>The answer is No! You cannot have 2 different programs using the same
>port number with different protocols. Once a program begins using, or
>"listening", on a port, that port is considered "in use" and you'll
>get an error if you try to connect with another program.


Thank you. Yes, that confirms my best guess.
--
Lam Duk
Genius is the ability to see the obvious.


 
Reply With Quote
 
Moe Trin
Guest
Posts: n/a
 
      11-18-2004
In article <(E-Mail Removed)>, Lam Duk wrote:

>Let's assume I have a DNS server which uses the normal port 53 and UDP
>protocol.


Minor problem - DNS uses both UDP (normally) and TCP (for longer replies).

>Let us also assume I have a HTTP server, which uses the TCP protocol. I
>know I can set the server to respond on any port I want, not just the
>normal port 80.


Correct

>My question is, is it possible to set the HTTP server in this hypothetical
>setup to port 53/TCP, sharing the port 53 assignment with the DNS server,
>which uses a different protocol?


In this singular case - no, only because DNS uses both protocols. See the
RFCs (1034 and 1035). On the OTHER hand, had you chosen a different port
number, the answer is probably yes. UNIX has been doing so for years.

>My instincts tell me no, that only one service can serve a given port at
>the same time, regardless of protocol, but I've never seen that written
>down anywhere. I don't have any real life requirement for such a setup. I
>just want to fill in the blanks in my education.


Assuming the network stack was written correctly, there would be no
problem. Protocol is the tenth octet in the IP header (see RFC0791), and
the 'cargo' of an IP packet may be one of 130 different defined protocols
(http://www.iana.org/assignments/protocol-numbers) in addition to the very
common TCP or UDP or ICMP, etc. Port numbers are defined in TCP and UDP
headers (see RFC0768 and 0793) in the first four octets (two source, two
destination). Other protocols do not have port numbers (example ICMP from
RFC0792), or use a completely different concept (IGMP from RFC2236).

Old guy

 
Reply With Quote
 
Moe Trin
Guest
Posts: n/a
 
      11-18-2004
In article <(E-Mail Removed)>, Celtic Leroy wrote:

>Don't you just hate it when people give long drawn out answers, then
>don't even answer you?!?!?!


Almost as much as when someone gives out a bogus answer.

>The answer is No! You cannot have 2 different programs using the same
>port number with different protocols. Once a program begins using, or
>"listening", on a port, that port is considered "in use" and you'll
>get an error if you try to connect with another program.


This might be true of some versions of windoze - and if so, it's another
example of incompetent programming, but UNIX has been able to separate
protocol/ports very easily, because 'protocol' is an IP header variable,
and port numbers are only defined in TCP or UDP headers. This is why ICMP
doesn't have port numbers. See any decent networking textbook (like
W. Richard Stevens "TCP/IP Illustrated Volume 1" ISBN 0-201-63346-9) or
the RFCs themselves.

0768 User Datagram Protocol. J. Postel. Aug-28-1980. (Format: TXT=5896
bytes) (Also STD0006) (Status: STANDARD)

0791 Internet Protocol. J. Postel. Sep-01-1981. (Format: TXT=97779
bytes) (Obsoletes RFC0760) (Updated by RFC1349) (Also STD0005)
(Status: STANDARD)

0792 Internet Control Message Protocol. J. Postel. Sep-01-1981.
(Format: TXT=30404 bytes) (Obsoletes RFC0777) (Updated by RFC0950)
(Also STD0005) (Status: STANDARD)

0793 Transmission Control Protocol. J. Postel. Sep-01-1981. (Format:
TXT=172710 bytes) (Updated by RFC316 (Also STD0007) (Status:
STANDARD)

See also the list of ports http://www.iana.org/assignments/port-numbers
and pay particular attention to ports 512 to 514 (one example)

exec 512/tcp # BSD rexecd(
biff 512/udp comsat
login 513/tcp # BSD rlogind(
who 513/udp whod # BSD rwhod(
shell 514/tcp cmd # BSD rshd(
syslog 514/udp # BSD syslogd(

Those ports aren't used that much outside of isolated networks, because
they have almost no security, but they've been around since the 1980s.

>Effectively, TCP and UDP are very different and would never normally
>be used within the same application. UDP is connectionless and TCP is
>an acknowledged connection protocol.


Maybe you ought to read RFC1035 section 4.2 - here, I'll even show the
second paragraph:

The Internet supports name server access using TCP [RFC-793] on server
port 53 (decimal) as well as datagram access using UDP [RFC-768] on UDP
port 53 (decimal).

So, DNS uses both protocols, but the same port AT THE SAME TIME. UDP is
used for replies that are 512 octets or less - TCP is 513 octets or more
and zone transfers.

1034 Domain names - concepts and facilities. P.V. Mockapetris.
Nov-01-1987. (Format: TXT=129180 bytes) (Obsoletes RFC0973, RFC0882,
RFC0883) (Updated by RFC1101, RFC1183, RFC1348, RFC1876, RFC1982,
RFC2065, RFC2181, RFC2308, RFC2535) (Also STD0013) (Status: STANDARD)

1035 Domain names - implementation and specification. P.V.
Mockapetris. Nov-01-1987. (Format: TXT=125626 bytes) (Obsoletes
RFC0973, RFC0882, RFC0883) (Updated by RFC1101, RFC1183, RFC1348,
RFC1876, RFC1982, RFC1995, RFC1996, RFC2065, RFC2136, RFC2181,
RFC2137, RFC2308, RFC2535, RFC2845, RFC3425, RFC365 (Also STD0013)
(Status: STANDARD)

>The port number is how sockets keeps all the connections separated by
>program.


Sounds like incompetent programming to me. Anyone who has read the
networking standards (RFCs) knows that different protocols can exist on
the same port number at the same time.

Old guy
 
Reply With Quote
 
Celtic Leroy
Guest
Posts: n/a
 
      11-18-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (Moe Trin) wrote:

>In article <(E-Mail Removed)>, Celtic Leroy wrote:
>
>>Don't you just hate it when people give long drawn out answers, then
>>don't even answer you?!?!?!

>
>Almost as much as when someone gives out a bogus answer.


Or one that does not consider the environment in use. In this case
WINDOWS!!!! No one is disputing your prowess or knowledge, but when
it is inappropriate to the specific question, it becomes a nuisance.
I didn't bother to include the special considerations of Highpoint
connections using Unisys 2200 mainframes either.

>
>>The answer is No! You cannot have 2 different programs using the same
>>port number with different protocols. Once a program begins using, or
>>"listening", on a port, that port is considered "in use" and you'll
>>get an error if you try to connect with another program.

>
>This might be true of some versions of windoze - and if so, it's another


The OP is using Windoze (check the headers of his post)...so the
answer was given in kind. I don't dispute that MS has done some
pretty bad (incompetent) programming. I also know that Windows will
not...I repeat WILL NOT allow 2 different processes to use the same
port number, regardless of whether they use different protocols or
not.

>example of incompetent programming, but UNIX has been able to separate


<snip useless info about other OS's>

>>Effectively, TCP and UDP are very different and would never normally
>>be used within the same application. UDP is connectionless and TCP is
>>an acknowledged connection protocol.

>
>Maybe you ought to read RFC1035 section 4.2


I've read it, as well as most other RFC's

>So, DNS uses both protocols, but the same port AT THE SAME TIME. UDP is
>used for replies that are 512 octets or less - TCP is 513 octets or more
>and zone transfers.


Yes, and you will find how many DNS servers running on Windows???

 
Reply With Quote
 
Craig A. Finseth
Guest
Posts: n/a
 
      11-18-2004
>>>The answer is No! You cannot have 2 different programs using the same
>>>port number with different protocols. Once a program begins using, or
>>>"listening", on a port, that port is considered "in use" and you'll
>>>get an error if you try to connect with another program.


A TCP or UDP connection is defined by the 4-tuple (source IP, source
port, destination IP, destination port).

At any given instant of time, only a single program can be listening
on a given (destination IP, destination port) combination. However,
once it receives a connection, the same program, a new instance of the
same program, or a completely different program can listen for the
next connection request on the pair.

Even with a completly different program listening for the new
connection, many existing programs can be using the same (destination
IP, destination port) pair, so long as either the source IP or the
source port differ.

This model is out of TCP itself and has nothing to do with the
underlying operating system, although the underlying implementation
may impose limits.

To the best of my knowledge, both Windows and Unix offer full support
for this model.

...
>>This might be true of some versions of windoze - and if so, it's another

>
>The OP is using Windoze (check the headers of his post)...so the
>answer was given in kind. I don't dispute that MS has done some
>pretty bad (incompetent) programming. I also know that Windows will
>not...I repeat WILL NOT allow 2 different processes to use the same
>port number, regardless of whether they use different protocols or
>not.


If you mean "listen on the same (IP, port) number pair," correct.
Neither will Unix.

Note that the (IP, port) pairs are separate for TCP and UDP stacks.
So, I can readily have one application listening on port P for TCP and
a different applicatoin listening on port P for UDP. Works just fine.

Note that when setting up a socket, you not only define the IP and
port, but also the address family and protocol family (e.g., IPv4
vs. IPv6 and TCP, UDP, or ICMP). So it is easy for the networking
code to keep separate tables of listeners and >appear to< re-use
ports.

It is the _convention_ that, where both TCP and UDP versions of a
given protocol are meaningful (e.g. DNS), to support both on the same
numeric port value. But that is a convention and not a requirement.

..
>>>Effectively, TCP and UDP are very different and would never normally
>>>be used within the same application. UDP is connectionless and TCP is
>>>an acknowledged connection protocol.


These are the essential differences, but it is quite common for a
single application to use both. Each to its strength. For example,
Telnet normally uses UDP for DNS lookups and TCP for its connection.

...
>>So, DNS uses both protocols, but the same port AT THE SAME TIME. UDP is
>>used for replies that are 512 octets or less - TCP is 513 octets or more
>>and zone transfers.


Close, but not quite. If I do a DNS request on UDP, the server must
respond using UDP: it can't decide to respond using TCP, regardless of
the response size. As a client, if I think the response might be
large (e.g., the UDP response was "too big to fit"), I might try a TCP
request.

For overhead reasons, many DNS servers do not reply to TCP requests.

Craig
 
Reply With Quote
 
Lam Duk
Guest
Posts: n/a
 
      11-18-2004
Considering the confusion and debate that has resulted, I guess my question
wasn't so simple-minded, after all.
--
Lam Duk
Genius is the ability to see the obvious.


 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Type of actual ports is not compatible with type of ports of entity. mreister VHDL 1 05-25-2010 11:30 AM
Recommendations Please for a PCI card w/ two USB 2 Ports and FireWaire Ports Mike Digital Photography 27 02-26-2006 12:54 AM
How to use protocols.msn.FileSend and protocols.msnFileReceive yamadora1999 Python 2 05-25-2005 12:56 AM
How to use protocols.msn.FileSend and protocols.msnFileReceive yamadora1999 Python 1 05-24-2005 07:12 AM
Juniper and Cisco Routing: Policy and Protocols for Multivendor Networks by Walter J. Goralski Ivan Ostreš Cisco 3 03-10-2005 06:03 AM



Advertisments