Finding port number !!


 
Thread Tools Search this Thread
Operating Systems Solaris Finding port number !!
# 8  
Old 10-03-2008
There is no "difference", there is a "relationship". netstat consults /etc/services and uses the label it finds there if you don't explicitly ask it to show raw port numbers always (with the -n option, in my version of netstat).
# 9  
Old 10-03-2008
basically, you can define what you want your port number to be called as defined in /etc/services. when you run netstat -a you will see this output with what is defined in /etc/services. if you run netstat -n you will not consult the /etc/services and just display port numbers.

Output with my apache server undefined in /etc/services:
Code:
#netstat -a
... 

TCP: IPv4
   Local Address        Remote Address    Swind Send-Q Rwind Recv-Q    State
-------------------- -------------------- ----- ------ ----- ------ -----------
      *.*                  *.*                0      0 49152      0 IDLE
      *.3306               *.*                0      0 49152      0 LISTEN
      *.80                 *.*                0      0 49152      0 LISTEN  

...

Look at the *.80 . this is my apache web server. now i will define it in /etc/services and make sure its tab delimited.
Code:
#vi /etc/services
...
bootpc          68/udp                          # BOOTP/DHCP client
apache          80/tcp          apache          # Apache webserver <--- here
kerberos        88/udp          kdc             # Kerberos V5 KDC
kerberos        88/tcp          kdc             # Kerberos V5 KDC
...

new output of netstat -a
Code:
# netstat -a
...

TCP: IPv4
   Local Address        Remote Address    Swind Send-Q Rwind Recv-Q    State
-------------------- -------------------- ----- ------ ----- ------ -----------
      *.*                  *.*                0      0 49152      0 IDLE
      *.3306               *.*                0      0 49152      0 LISTEN
      *.apache             *.*                0      0 49152      0 LISTEN
      *.*                  *.*                0      0 49152      0 IDLE
....

notice how *.80 has now turned into *.apache!

again, netstat -n will NOT consult /etc/services in its naming output.
# 10  
Old 10-03-2008
hahah era beat me to it Smilie
# 11  
Old 10-06-2008
try this one: PCP - Show open ports and PIDs on Solaris

best regards
mutifo
This User Gave Thanks to mutifo For This Post:
# 12  
Old 10-08-2008
all the ports which need specifc to which protocol was mentioned in the /etc/services

if you need to add new ports to yur server you need to have the entry on this file..

#grep telnet /etc/services
telnet 23/tcp

this gave you that telnet connectio was comming thrugh port 23


netstat -a|grep telnet

gave all the telnet connection established and the ports listening to telnet connectionto the server

which means the telnet was working through the port 23 and which uses tcp



netstat -an

will gave yo all the connection to your server... Smilie
This User Gave Thanks to GIC1986 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to find port number wwn of particular port on dual port HBA,?

please find the below o/p for your reference bash-3.00# fcinfo hba-port HBA Port WWN: 21000024ff295a34 OS Device Name: /dev/cfg/c2 Manufacturer: QLogic Corp. Model: 375-3356-02 Firmware Version: 05.03.02 FCode/BIOS Version: BIOS: 2.02; fcode: 2.01;... (3 Replies)
Discussion started by: sb200
3 Replies

2. SCO

Problem finding what is using a serial port

How can I determine what process is currently using a serial port? A good bit of google searching hasn't turned up anything useful, but it seems like there has to be a way to do this without too much difficulty. When I first started looking into this problem, I assumed that when a port was in... (2 Replies)
Discussion started by: jdsnatl
2 Replies

3. AIX

Finding service based on port number

is it possible to find out which Service is running on the basis of port no which is open/listening? Regards Manoj (2 Replies)
Discussion started by: manoj.solaris
2 Replies

4. Shell Programming and Scripting

Need help in finding and replacing port numbers.

Hi All, I am trying to write a shell script which firstly will search some files and then increase the port numbers mentioned in them by a certain no. let me clear it with an example- suppose there r few files a,b,c,d.... file a's content- <serverEntries xmi:id="ServerEntry_1"... (3 Replies)
Discussion started by: ankushsingh10
3 Replies

5. UNIX for Dummies Questions & Answers

port number

hi all i want to connect a system, how can i know the port number of a system. (2 Replies)
Discussion started by: tukuna82
2 Replies

6. UNIX for Dummies Questions & Answers

Need to know port number

Hi expert, I wanted to know in which port my apache is running in solaris box thanks Shaan (1 Reply)
Discussion started by: shaan_dmp
1 Replies

7. Shell Programming and Scripting

port number as an argument

What is the script that takes a port number as parameter and displays status, whether it is available or is already used by other process pls help (1 Reply)
Discussion started by: saikiran
1 Replies

8. IP Networking

finding port numbers

hither! whatz the command to find which process is using a specific port number? for example, port 8082? (3 Replies)
Discussion started by: darkcastle
3 Replies

9. UNIX for Advanced & Expert Users

finding a process running on a port

how do I find the process that is running on a port in HP-Unix? Murali (8 Replies)
Discussion started by: manduva
8 Replies

10. Cybersecurity

get number of a port

Hello every one. I work in a LAN with many application server. Each one use a different port. What command permit to obtain the number of these port. thanks (2 Replies)
Discussion started by: hoang
2 Replies
Login or Register to Ask a Question