1819870 Members
2357 Online
109607 Solutions
New Discussion юеВ

how to free the port

 
rahul90
Occasional Advisor

how to free the port

Hi

I am using rp8420 server with 11.11 version.My client wants to run some application in port 6010.He is not able to run that application on that port.We check the port by giving commands as netstat -an | grep 6010
tcp 0 0 10.4.13.218.16010 10.4.13.218.51895 TIME_WAIT
tcp 0 0 10.4.13.218.51895 10.4.13.218.16010 TIME_WAIT
tcp 0 0 10.4.13.218.16010 10.4.13.218.51965 TIME_WAIT

I am getting o/p like this.

Can u plz tell me how to free up the port.
7 REPLIES 7
Steven Schweda
Honored Contributor

Re: how to free the port

If you're looking for use of port 6010, you
might get less misleading output from a
command like:

netstat -an | grep '.6010 '

For example:

td176> netstat -an | grep '.23 '
tcp 0 2 15.170.178.176.23 209.98.249.184.11373 ESTABLISHED
tcp 0 0 *.23 *.* LISTEN


I don't see port 6010 in your "netstat -an"
output.

It might help if you explained what the
application is, and exactly what "not able to
run" means. I'd guess that a busy port 6010
is not your problem.
Matti_Kurkela
Honored Contributor

Re: how to free the port

If you have the "lsof" command installed, you can use "lsof -i tcp:6010" to find out exactly which process is using the port.

Are you using SSH?

The port number 6010 is generally used for the 10th X11 display. If you use SSH with X11 forwarding, this is the first display number that SSH uses for X11 forwarding by default. This maps to DISPLAY value ":10.0".

If this port is not free when a connection with X11 forwarding is requested, SSH automatically uses port 6011 or above.

If you need the port 6010 for other purposes, edit the sshd_config file (usually in /opt/ssh/etc) to change the X11DisplayOffset value from 10 to 11, restart sshd, disconnect all existing SSH connections with X11 forwarding enabled, and the port should become free.
MK
Dennis Handly
Acclaimed Contributor

Re: how to free the port

>Steven: you might get less misleading output from a command like:
netstat -an | grep '.6010 '

Since "." is special to grep, shouldn't that be:
netstat -an | fgrep '.6010 '
or:
netstat -an | grep '\.6010 '

(Can anyone spare 2 points? ;-)
Ralph Grothe
Honored Contributor

Re: how to free the port

Yes, the dot that separates the port from the IP address (note, Linux's netstat uses a colon as port separator) should be quoted because a single dot in grep "regex" represents any character.
Thus rajeshraj actually hasn't grepped for port 6010 as intended to but port 16010 (didn't he?).
I prefer awk or perl, but because of more widespread availability of awk stick rather with it, like e.g.

# netstat -an -f inet|awk '$4~/\.5666$/'
tcp 0 0 *.5666 *.* LISTEN
tcp 0 0 10.25.9.136.5666 10.25.8.8.64525 TIME_WAIT

(above it's the port of NRPE for my Nagios monitoring)

I would think that a TIME_WAIT socket state is nothing to worry about as this is the final stage before the socket is actually closed,
and it is only reached after the remote end has acknowledged the close request as well.
Most of the times one has rather to fight with sockets lingering in FIN_WAIT_2 stage where the remote end yet hasn't acknowledged the closing (maybe because some firewall severed the connection after a certain time of inactivity)
I would assume that the TIME_WAIT sockets will simply disappear after a while.
I'm sure that by some ndd param you can enforce a shutdown after a certain timeout but one normally shouldn't activate this because of the peril of possible data loss.
Madness, thy name is system administration
Steven Schweda
Honored Contributor

Re: how to free the port

> Since "." is special to grep, shouldn't that be:
> netstat -an | fgrep '.6010 '
> or:
> netstat -an | grep '\.6010 '

Probably the latter. I doubt that grep cares
whether the dot is quoted using "" or ''.

At least I got the space right. Sigh.

Sundar_7
Honored Contributor

Re: how to free the port

From your post, it doesn't look like there is any service listening on that port 6010.

I know some applications are very picky about the entry in /etc/services, even though the port is not actively used.

grep 6010 /etc/services

Do you see anything ?
Learn What to do ,How to do and more importantly When to do ?
HGN
Honored Contributor

Re: how to free the port

Hi

If you think this issue is resolved please assign points and close this thread.

Looks like you have not assigned points at all (0 out of 26) assigning points is a nice way to appreciate the people who are spending their valuable time helping you.

Rgds

HGN