1756604 Members
3571 Online
108848 Solutions
New Discussion юеВ

Port usage

 
Jeffrey S. Sims
Trusted Contributor

Port usage

I am running PoPTop vpn server on my redhat 7.0 server, and I keep getting a "creatHostSocket address already in use" error. This means that some other program is using that port. When I type netstat -a it only lists that one program for the port. Is there a way to see what ports various programs are using? Any help would be appreciated. By the way, i believe the port is 1723
4 REPLIES 4
Shane Hjorth
Occasional Advisor

Re: Port usage

Jeffery,

Unfortunately I don't have my linux system in front of me to test this, but the following script should tell you which processes are listening on a port.

#!/bin/sh

for pid in `ps -ef|grep -v UID|awk '{ print $2 }'| sort -rn`; do
/usr/sbin/lsof -p $pid|grep LISTEN
done

Hope this helps

Shane Hjorth.
Mike Brown_3
Frequent Advisor

Re: Port usage

Assuming I have you right here, another method to track port usage is the use of third party port scanners. You need to exercise a degree of caution on how you use these though since their main objective is to detect security breaches - you wouldn't want to upset those legitimately on your network.
If this sounds like what you need, check out Nessus or Courtney to see if they are suitable.
There's no substitute for experience
Jeffrey S. Sims
Trusted Contributor

Re: Port usage

Shane,

The following is the output from your script. There doesn't seem to be anything other than pptpd using 1723, but maybe this will help.

pptpd 582 root 4u IPv4 743 TCP *:1723 (LISTEN)
sshd 537 root 3u IPv4 687 TCP *:ssh (LISTEN)
xinetd 522 root 3u IPv4 671 TCP *:telnet (LISTEN)
xinetd 522 root 4u IPv4 672 TCP *:ftp (LISTEN)
identd 490 root 3u IPv4 637 TCP *:auth (LISTEN)
identd 489 root 3u IPv4 637 TCP *:auth (LISTEN)
identd 487 root 3u IPv4 637 TCP *:auth (LISTEN)
identd 485 root 3u IPv4 637 TCP *:auth (LISTEN)
identd 483 root 3u IPv4 637 TCP *:auth (LISTEN)

And as far as using a port scanner, to my knowledge they only show what ports are open, I already know 1723 is open, I just want to know what programs are trying to use it.

Thanks and hope this helps to find a solution.
Terry Rodery
Occasional Advisor

Re: Port usage

Hey,

Try this:

fuser 1723/tcp
to see what program is using that port using tcp and,

fuser 1723/udp
to see what program is using that port using udp.