Re: Ports and Protocols

From: Moe Trin (ibuprofin_at_painkiller.example.tld)
Date: 11/19/04

  • Next message: donnie: "Re: EFS encrypted harddisk"
    Date: Fri, 19 Nov 2004 16:52:49 -0600

    In article <419d264c$0$232$>, Craig A. Finseth wrote:

    >>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.

    I'm not really sure how to interpret those two statements. But then,
    I'm not using a branded UNIX. Certainly I can't run two processes on
    the same port/protocol - I agree with that. But

    [compton ~]$ /usr/sbin/lsof -i :21
    inetd 256 root 4u inet 0x0179b414 0t0 TCP *:ftp (LISTEN)
    nc 11638 root 3u inet 0x00948c0c 0t0 UDP *:21
    [compton ~]$

    That's quite obviously two separate processes - the first being the inetd
    super server, and the second being netcat. From another computer, I have
    no problem connecting to the FTP server, or to netcat (which is merely
    set to dump packets to a terminal). I recall doing something similar with
    both SunOS 4.1.3 and Solaris 2.5 with rshd on 513/tcp and syslogd on
    513/udp - done on several hosts, though I'm no longer running either O/S.

    For a windoze situation, I wonder if using a so-called personal firewall
    to port forward (<mumble>/tcp to another port, <mumble>/udp to a different
    port) maybe even on the same host would get around the apparent shortcoming.

    >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.

    Agreed. This is mentioned in passing in the IANA portnumber list.

    >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.

    Not to pick to many nits, but telnet doesn't specifically do the DNS
    lookups - it passes the lookup request to the kernel as a resolver call.

    >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

    Depends on the application code as I understand it. The server does give
    a UDP reply of up to 512 octets, but if the reply is longer, it gives
    the first 512 octets AND sets the 'truncated' flag (next to last bit
    in the third octet of the reply header). 'dig' can be set to ignore or
    followup to that flag. The deprecated 'nslookup' did not ignore the flag
    by default. 'host' reports the flag if set, but doesn't seem to have the
    capability to make a TCP query. 'dnsquery' seems to be able to be forced
    to use a TCP query, although UDP is default. The actual knob that gets
    twisted to select UDP _or_ TCP queries is available as a library call.

            Old guy

  • Next message: donnie: "Re: EFS encrypted harddisk"

    Relevant Pages

    • Re: Open port PIX 501
      ... :i can't open the port in my PIX. ... :I need open the port 1000 to point to the IP ... in practice only DNS servers doing zone transfers need tcp. ... of UDP, it would be a highly unusual client which did not stick ...
    • Re: UDP question
      ... Re: UDP question.eml ... >>> Most modern services utilise TCP, ... The only open port should be the port I use for Open VPN, ...
    • Re: Re[5]: Assymetric NIC performance problem
      ... I've got a FreeBSD file server running Samba, file upload speeds are okay, ... Client connecting to, TCP port 5001 ... Sorry, I didn't know that UDP bandwidth must be specified manually, ...
    • RE: DNS Records
      ... tcp>1023 53 Client queries with long replies ... On other client types, ... if you lock down all but port ... a client queries an initial server from an unreserved port number to UDP ...
    • Windows Update Scrammed My Server
      ... The Simple TCP/IP Services could not find the TCP Echo port. ... The Simple TCP/IP Services could not find the UDP Echo port. ...