UDP/TCP ports -> protocol port

UDP/TCP ports -> protocol port

Post by a.. » Wed, 08 Jun 1994 03:09:23



Hello,

How can one map the ports in Source/Dest field in an UDP/TCP
packet header to protocol port, telnet, ftp, etc...?

Thanks.

Anh

 
 
 

UDP/TCP ports -> protocol port

Post by Carl Harr » Wed, 08 Jun 1994 22:31:10


: How can one map the ports in Source/Dest field in an UDP/TCP
: packet header to protocol port, telnet, ftp, etc...?

If I understand your question correctly, you want to map the service name
(usually listed in /etc/services), to a port number.  The function call which
does this is getservbyname().  A typical call to get the port number for
ftp looks like:

        #include <netdb.h>

        struct servent *service_info;
        service_info = getservbyname("ftp","tcp");

See the man page or W. Richard Stevens _Unix Network Programming_ for more
details.

--
Carl Harris             "If you give an infinite number of monkeys desktop
EXECUTIVE Scapegoat      publishing software, they will eventually produce an

http://csugrad.cs.vt.edu/aboutus/ceharris.html

 
 
 

UDP/TCP ports -> protocol port

Post by a.. » Thu, 09 Jun 1994 03:08:21




> : How can one map the ports in Source/Dest field in an UDP/TCP
> : packet header to protocol port, telnet, ftp, etc...?

> If I understand your question correctly, you want to map the service name
> (usually listed in /etc/services), to a port number.  The function call which
> does this is getservbyname().  A typical call to get the port number for
> ftp looks like:

>    #include <netdb.h>

>         struct servent *service_info;
>    service_info = getservbyname("ftp","tcp");

> See the man page or W. Richard Stevens _Unix Network Programming_ for more
> details.

> --
> Carl Harris                "If you give an infinite number of monkeys desktop
> EXECUTIVE Scapegoat      publishing software, they will eventually produce an

> http://csugrad.cs.vt.edu/aboutus/ceharris.html

Well, I get my packets from a packetfilter. I want to see what kind of protocol
the packet belongs too. I did a test output and got a wide range of port numbers
and well, I am not sure if they are they actual protocol numbers, like TCP 23 - TELNET,
TCP 20 - FTP-DATA... and so on, even though some testings seem to indicate the case.

Thanks for the answer...

Anh

 
 
 

UDP/TCP ports -> protocol port

Post by Pete Flugst » Fri, 10 Jun 1994 00:52:36



Quote:>How can one map the ports in Source/Dest field in an UDP/TCP
>packet header to protocol port, telnet, ftp, etc...?

On SunOS 4.X.X (and probabaly any BSD derived OS), you can look in
/etc/services.  This file has mappings from common service names
(telnet, ftp, nntp, etc), to port/protocol numbers.  I'm fairly
sure other OS's have similar files, but I'm not sure what they
would be.  You might try man getservent, or man -k service, they
will usually point you to the file you want.

Pete

 
 
 

1. ipchains/TCP/UDP, Why should I open UDP ports so that my TCP ports can work?

Hi,

I have set up firewall to accept some ports.
/sbin/ipchains -F input
/sbin/ipchains -P input ACCEPT
/sbin/ipchains -A input -p TCP -s 0/0 --dport ssh -j ACCEPT
/sbin/ipchains -A input -p UDP -s 0/0 --dport ssh -j ACCEPT
....

Then I want to lock down all other ports.
/sbin/ipchains -A input -p TCP -s ! 192.168.0.0/24 -j DENY

#??? what's wrong with this UDP ???
/sbin/ipchains -A input -p UDP -s ! 192.168.0.0/24 -j DENY

If I comment out the UDP line, I can ssh into firewall from outside.
If I don't comment out that line, I can no longer ssh into firewall from
outside.

Why should I open UDP ports so that my TCP ports can work?

Thanks for any help.

Ed Wu

2. anyone with java running under 4.7?

3. Hacked? TCP port 12345 and UDP port 2364

4. How to upgrade linux kernal

5. Ignore all incoming udp/ip and udp/ip on all ports, except open ports?

6. Enterprise/binary garbage web page

7. TCP, UDP protocols vs. Unix domain protocols

8. sed with and not that....

9. How do I change protocol (udp->tcp) for the interface?

10. locusmap protocol (port 127, 125 udp)

11. AUDIT: client 8 rejected from IP <ip> port <port> ????

12. Huge UDP traffic from port 1058 to port 3000, what is it?

13. What are these UDP packets from port 3130 to port 7?