LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 12-13-2006, 11:35 AM   #1
Xorgroth
LQ Newbie
 
Registered: May 2006
Location: Idaho
Distribution: Debian, Arch, Kali
Posts: 28

Rep: Reputation: 15
SunOS 5.8


I'm in pure command line here, SunOS 5.8, was wondering if there was a command to kick connections of a specific port #. We could reboot and have it done or reboot the PCs connecting, but thought there was a way to kick connections of a port #.
 
Old 12-13-2006, 11:47 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You could use lsof to determine what process is using the port and try killing that process.

However if its a FIN_WAIT status of some sort there may be no process and it may not go away until a reboot.

I did find a script using ndd that would get rid of FIN_WAIT_2 on HP-UX. Not sure if you can use it on SunOS 5.8. Only Sun I have here 5.6 and it doesn't show the tcp_discon as available.

The script if you want to play with it AT YOUR OWN RISK:
Code:
#
# Taken from Jim Dunn's script.
#
# Doug Burton - 1/23/2004
# http://home.tampabay.rr.com/batcave/
#
# jlightne 02-Jul-2004 - Found on HP ITRC-Modified for bluebird port 1502 issue
#############################################################

# jlightne Modified center line to look only for port 1502 on bluebird's IP:
stuff=$(/usr/bin/printf "%.2x%.2x%.2x%.2x%.4x%.2x%.2x%.2x%.2x%.4x\n" \
 $(/usr/bin/netstat -an | /usr/bin/grep 64.102.0.149.1502 | \
 /usr/bin/awk '{print $4,$5}' | /usr/bin/sed 's/\./ /g'))

# jlightne This line was center line above as I found it -  This would kill ALL
# FIN_WAIT_2 items which might be risky:
# $(/usr/bin/netstat -an -f inet | /usr/bin/grep FIN_WAIT_2 | \

for x in $stuff
  do
  echo $x
    /usr/bin/ndd -set /dev/tcp tcp_discon_by_addr $x
done
 
Old 12-13-2006, 12:21 PM   #3
Xorgroth
LQ Newbie
 
Registered: May 2006
Location: Idaho
Distribution: Debian, Arch, Kali
Posts: 28

Original Poster
Rep: Reputation: 15
Yeah, we've killed the process its SQL, most sites I've been to say change the port # but that would screw over the clients that are connected.
 
Old 12-13-2006, 12:38 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
I'm confused. If clients are connected on the port how would you free it?

If clients are connected via separate ports then changing port number wouldn't affect them but might affect new connections that expected you to be listening on the original port.

If you run "ndd /dev/tcp \? |grep tcp_discon" do you see anything?
On HP-UX I see:
tcp_discon (write only)
tcp_discon_by_addr (write only)

which is what allows above script to work. By the way in the above I hardcoded port 1502 - you'd want to modify it for the one you wanted if you decided to try it.

The script is AT YOUR OWN RISK but the command in this post doesn't write anything - just checks to see what capabilities you have for /dev/tcp.
 
Old 12-13-2006, 12:46 PM   #5
Xorgroth
LQ Newbie
 
Registered: May 2006
Location: Idaho
Distribution: Debian, Arch, Kali
Posts: 28

Original Poster
Rep: Reputation: 15
Well, we rebooted but tcp_discon isn't available on 5.8 so the ndd comes up with nothing.

Yeah, I think a couple were on separate ports, but after killing SQL they are still connected.
 
Old 12-27-2006, 02:24 PM   #6
mdhmi
Member
 
Registered: Dec 2005
Location: Detroit, Michigan
Distribution: Ubuntu
Posts: 86

Rep: Reputation: 15
Install lsof from SunFreeware.com. That'll help you determine what's running and which process are controlling it.
 
Old 12-27-2006, 03:26 PM   #7
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Question was how to stop the connections rather than determine what they are. However I heartilly recommend lsof for all Unix/Linux OSes. It has many uses including the one you mention.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Solaris and SunOS czezz Solaris / OpenSolaris 1 11-15-2004 04:28 AM
printing in sunos yanger Linux - Software 0 07-21-2004 10:17 AM
Crypt on SunOS liguorir Solaris / OpenSolaris 1 05-11-2004 02:46 AM
SunOS C Compiler liguorir Linux - Software 1 05-10-2004 03:40 PM
SunOS 5.8, Samba 2.2.4 and winbindd?? BrianBr General 1 07-19-2002 06:32 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 07:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration