checking remote UDP ports

checking remote UDP ports

Post by pluvi » Sat, 28 Jan 1995 18:42:50

I want to check to see if a remote host is listening on a certain UDP
port... how can i determine this?
The only thing I can think of is to open a connection to that port
and to send it something, and listen for a ICMP PORT UNREACH
message... this requires the program to run as root which is not
desirable.. is there a simpler solution????


checking remote UDP ports

Post by James Robins » Sun, 29 Jan 1995 05:47:45

[Q about how to check to see if a remote machine has a specific UDP port

You can open up a UDP socket, bind() your address to it, and then connect()
to the remote machine / port. Send a packet. If the kernel gets an ICMP
port unreachable message, then when you send the NEXT packet out
that socket, it will result in an error (ECONNREFUSED).

The connecting to the port gives the kernel the necissary info to
figure out which process / socket sent the offending packet.

Thanks to Richard Stevens for this wonderful info.


:FreeBSD|XFree86 :The best things in life are Free::     steaming iridescent
:  Frank Zappa   :      Music is the best         ::naughahyde python screaming
:  HTTP Server   : http://hermes.* ::        steam roller!


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

    I want to set my linux box up such that it will not even admit
that it exists (Stealth, if you will) on ports that are not open for
connections.  Port 79 (Finger) for instance, I ran  port scanner on my box
and it responded that the machine exists, and the port is closed.
Is there a to get it to not respond (ignore) incoming connections

Also, it is running as a webserver / router / firewall.
I would also like to bind certain services to net devices like
FTP to eth1, so I can access them on my VPN, but not from the
outside eth0.  Is that possible?

If anyone has any ideas I would be most appreciative,
maybe direct me to the appropriate HOWTO?


2. Seeing Win95 long filenames from Linux...?

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

4. Stupid Internet servers question

5. Port checking for a remote host


7. Checking if a remote port is is open.

8. System doesn't mount 2nd cdrom drive

9. how can I check that remote server is listening a certain port..

10. Ports 137/udp and 138/udp are in use but no process can be found

11. Is there a unix command to check if a port is active on a remote IP??

12. UDP/TCP ports -> protocol port

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