About Linux FAQ

Browse More FAQs:

Openbsd list open tcp or udp ports

Posted by Vivek on Tuesday November 7, 06 @6:20 am

Q. How do I find out openbsd open tcp or udp ports?

A. Use netstat command. It show network status in various network-related data structures. There are a number of output formats, depending on the options for the information presented. Another option is to use nmap from remote computer. However do not use nmap to scan remote host if you are not authorized person.

Task: Display tcp and UDP open port

Type netstat command as follows :

No need to login as root user.

$ netstat -nat
OR
$ netstat -at | grep LISTEN
Output:

$ netstat -at | grep LISTEN
tcp        0      0  *.291                  *.*                    LISTEN
tcp        0      0  localhost.submissi     *.*                    LISTEN
tcp        0      0  localhost.smtp         *.*                    LISTEN
tcp        0      0  *.time                 *.*                    LISTEN
tcp        0      0  *.daytime              *.*                    LISTEN
tcp        0      0  *.auth                 *.*                    LISTEN
tcp6       0      0  *.ssh                  *.*                    LISTEN
tcp6       0      0  localhost.submissi     *.*                    LISTEN
tcp6       0      0  localhost.smtp         *.*                    LISTEN
tcp6       0      0  *.time                 *.*                    LISTEN
tcp6       0      0  *.daytime              *.*                    LISTEN
tcp6       0      0  *.auth                 *.*                    LISTEN

Only display tcp IPv4:
$ netstat -f inet -atOutput:

Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp        0      0  openbsd.23087          resolver1.opendn.domai TIME_WAIT
tcp        0      0  openbsd.22            dsl-KK-dynamic-1.32789 ESTABLISHED
tcp        0    448  openbsd.22            dsl-KK-dynamic-1.32786 ESTABLISHED
tcp        0      0  *.22                  *.*                    LISTEN
tcp        0      0  localhost.submissi     *.*                    LISTEN
tcp        0      0  localhost.smtp         *.*                    LISTEN
tcp        0      0  *.time                 *.*                    LISTEN
tcp        0      0  *.daytime              *.*                    LISTEN
tcp        0      0  *.auth                 *.*                    LISTEN
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
udp        0      0  localhost.biff         *.*
udp        0      0  *.syslog               *.*

Show information about the network interface:
$ netstat -iOutput:

Name    Mtu   Network     Address              Ipkts Ierrs    Opkts Oerrs Colls
lo0     33192                                6     0        6     0     0
lo0     33192 loopback    localhost.nixcraf        6     0        6     0     0
lo0     33192 localhost.n localhost.nixcraf        6     0        6     0     0
lo0     33192 fe80::%lo0/ fe80::1%lo0              6     0        6     0     0
pcn0    1500        00:0c:29:7b:66:72      560     0      485     0   124
pcn0    1500  75.126.68.4 openbsd.nixcraft.      560     0      485     0   124
pcn0    1500  fe80::%pcn0 fe80::20c:29ff:fe      560     0      485     0   124
pflog0* 33192                                0     0        0     0     0
pfsync0 1460                                 0     0        0     0     0
enc0*   1536                                 0     0        0     0     0

Show information about the specified interface pcn0
$ netstat -I pcn0

See how to use nmap to find out remote system open port. Read man page of netstat for more information.

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Linux / UNIX FAQ:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

~ Last updated on: December 19, 2006

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.