Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-23-2005
Technorati Master
 
Join Date: Mar 2005
Location: classification algos
Posts: 3,188
Thanks: 19
Thanked 28 Times in 25 Posts
determining open ports

hi all

1) how to determine available ports in a box (solaris)

do i have to go for a netstat on all the ports?

2) how to block a particular port for a particular type of connection.

Any help would be greatly appreciated

Thanks
Sponsored Links
    #2  
Old 06-25-2005
zazzybob's Avatar
Registered Geek
 
Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,186
Thanks: 3
Thanked 23 Times in 22 Posts
As far as checking ports and their usage, netstat and lsof (which you may need to d/l, compile and install if not present) are the commands for you.

netstat -an | grep "\.389.*LISTEN"

Will show you if LDAP is Listening, for example.

You can refine the grep to extract the exact results you want.

Cheers
ZB
Sponsored Links
    #3  
Old 06-27-2005
Technorati Master
 
Join Date: Mar 2005
Location: classification algos
Posts: 3,188
Thanks: 19
Thanked 28 Times in 25 Posts
thanks for the reply

i believe lsof command uses the following file
/dev/kmem

on the stranger part

i tried on server1 - it was working fine and i could all the information that i needed
and when i tried it on server2 - it was showing permission denied

i checked the permissions for the file on either of the servers and it was the same

could you please explain why its show different behaviour.

I do need one more clarification.
Ports indicating LISTEN status are the ones picked by the process and opened to accept connections right?

There is no list of acceptable ports which could hereby be opened and connected.

I think i am making myself clear. Kindly revert if i had to explain my question in detail.

Thanks
    #4  
Old 07-15-2005
Registered User
 
Join Date: Aug 2001
Location: Cape Town,South Africa
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
edit your /etc/services file you will see all ports and which ones you can close
Sponsored Links
    #5  
Old 07-15-2005
Technorati Master
 
Join Date: Mar 2005
Location: classification algos
Posts: 3,188
Thanks: 19
Thanked 28 Times in 25 Posts
thanks for the reply

i believe we can have only the list of ports registered in /etc/services

i dont think we can get a list of ports that are blocked or prevented from connecting from any of the requests

can u please clarify on this.
Sponsored Links
    #6  
Old 07-15-2005
Registered User
 
Join Date: May 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
As always I am a bit lost here.
Port starts from 0 (or 1 I don't remember) all the way up to 32555 (or sth similar). A port allocated by an active process (either serve or client) can be found by netstat. Everything else is not being used and so "available" for a process to allocate.

/etc/services is a differenet thing which may have implication for inetd or xinetd only. A port does not have to be "registered" in this file to be used by a process which has nothing to do with inetd.

There are more than one approaches to block a port. Conventional approach is via tcpwrapper. Now, people are more likely using (soft- or hardware based) firewall such as iptables in Linux.

I hope it answered all of your questions.
Sponsored Links
    #7  
Old 07-16-2005
Registered User
 
Join Date: Jul 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by matrixmadhan
hi all
1) how to determine available ports in a box (solaris)
Another option is nmap. You can use that to check open ports on other machines on your network as well.

]$ nmap -p 1-$MAX_PORTS

Quote:
Originally Posted by matrixmadhan
2) how to block a particular port for a particular type of connection.
Any help would be greatly appreciated
Thanks
Use netfilter's iptables utility
Sponsored Links
Closed Thread

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Open/close of ports balamv IP Networking 1 05-06-2011 12:54 PM
open ports and services lhareigh890 UNIX for Dummies Questions & Answers 1 12-13-2010 10:02 PM
Help determining what's blocking ports brandonros IP Networking 11 01-11-2009 06:58 PM
open ports solaris 8 csgonan Solaris 1 12-03-2008 11:24 AM
How To Open Ports in RedHat ? Sirius Linux 7 09-06-2003 08:48 AM



All times are GMT -4. The time now is 01:34 AM.