Operating System - Linux
1748215 Members
3412 Online
108759 Solutions
New Discussion юеВ

Port no is not shown but service name is shown

 
SOLVED
Go to solution
senthil_kumar_1
Super Advisor

Port no is not shown but service name is shown

Hi

In one of my Redhat linux running in IBM iseries AS400 partition. i am able to see the service name:

Ex:

-bash-3.00# netstat -a | grep smtp
tcp 0 0 *:smtp *:* LISTEN

tcp 0 0 *:pop3 *:* LISTEN

tcp 0 0 *:imap *:* LISTEN

All above services is running in default ports (25, 110, 143).

I checked this thru using telnet command from windows client.

Ex: telnet ip_address 25

It is opening.

But my issue is i am not able to view the port using netstat command in linux.

Ex:

# netstat -a | grep 25
or
# netstat -tulpn | grep 25.

But other Redhat linux server i am able to see the opened ports using this command.

Why this is not working.

Hint : This Redhat linux server is installed in IBM iseries AS400 partition.




8 REPLIES 8
Sivakumar MJ._1
Respected Contributor
Solution

Re: Port no is not shown but service name is shown

mohamed.bouraoui
Frequent Advisor

Re: Port no is not shown but service name is shown

Hi friend,
you can use nmap ip_address; it's very usefull
Viktor Balogh
Honored Contributor

Re: Port no is not shown but service name is shown

> # netstat -a | grep 25
> or
> # netstat -tulpn | grep 25.

that's because if you want to see the post numbers instead of the service names you must use the '-n' option of netstat.
****
Unix operates with beer.
Ivan Ferreira
Honored Contributor

Re: Port no is not shown but service name is shown

In linux you use the same command, with -n to avoid translation. So if you do:

netstat -an | grep :25

Then you will find if the 25 port is open. If you don't get any output, the the port is closed.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Ganesan R
Honored Contributor

Re: Port no is not shown but service name is shown

Hi Senthil,

Try with this command also.

#netstat -an |grep *.25
Best wishes,

Ganesh.
Viktor Balogh
Honored Contributor

Re: Port no is not shown but service name is shown

ok,

# netstat -an |grep *.25

will not work because the output of netstat doesn't contain any ":" on HP-UX, (on LINUX it DOES)

# netstat -an |grep *.25

will give you results, but if eg. a service listens on a specific interface you won't see it.

so i think the ultimate solution is:

# netstat -an | awk '$4 ~ ".25$"'

this will give you the lines from the netstat output that has something to do with port 25 on the local side
****
Unix operates with beer.
Viktor Balogh
Honored Contributor

Re: Port no is not shown but service name is shown

"
# netstat -an | grep :25

will not work because the output of netstat doesn't contain any ":" on HP-UX, (on LINUX it DOES)
"
****
Unix operates with beer.
Sajjad Sahir
Honored Contributor

Re: Port no is not shown but service name is shown


Dear Senthil

simply u can use netstat -ian command

sajjad