How do I find/get free TCP/UDP ports

How do I find/get free TCP/UDP ports

Post by Fredrik Hagstran » Thu, 18 Oct 2001 18:54:03



Does anyone know if there is a good way to find or to get assigned free
TCP/UDP ports in Linux?

/Fredrik

-----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
 Check out our new Unlimited Server. No Download or Time Limits!
-----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----

 
 
 

How do I find/get free TCP/UDP ports

Post by David Efflan » Fri, 19 Oct 2001 10:36:06



Quote:

> Does anyone know if there is a good way to find or to get assigned free
> TCP/UDP ports in Linux?

First check /etc/services and inetd.conf or xinetd to see what standard
ports might be used.  You need to be root to connect to ports < 1024.

Then either check 'netstat -at', or if a script or program, just try
opening successive ports until you get one that does not return an error
(you get a bind error if a port is in use).  Instead of dieing, you just
need to keep looping through ports until successful.

--
David Efflandt - All spam is ignored - http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/

 
 
 

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. problems configuring serial ports, any help?

3. Finding process associated with TCP/UDP port...

4. ftape, mt and tar

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

6. 2.4 stable when?

7. UDP/TCP ports -> protocol port

8. Libtool error compiling sumi.

9. finding # of free outgoing TCP port in Sol 8

10. Hacked? TCP port 12345 and UDP port 2364

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

12. MASQ: Getting frequent TCP/UDP checksum errors

13. FireWall-1 & High UDP/TCP ports