GENERAL NOTES
PORT USAGE
sudo netstat -taupen
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      104        7242436     28194/mysqld    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      0          7674        749/apache2     
lsof -i :80
COMMAND   PID     USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
apache2  4077 www-data    3u  IPv4    7674      0t0  TCP *:http (LISTEN)
apache2  5566 www-data    3u  IPv4    7674      0t0  TCP *:http (LISTEN)
lsof -t -i :80 | xargs ps -fp
UID        PID  PPID  C STIME TTY      STAT   TIME CMD
root       749     1  0 Aug28 ?        Ss     5:56 /usr/sbin/apache2 -k start
www-data  4077   749  0 Oct30 ?        S      0:04 /usr/sbin/apache2 -k start
www-data  5566   749  0 Oct30 ?        S      0:04 /usr/sbin/apache2 -k start
telnet hostname 25Easiest way to check if host is listening to port - in this example port 25 (smtp)
nc -z ip-address 80-1000Do a quick port scan with netcat (aka nc) to a single port or a port range. Netcat usually doesn't come pre-intalled - install with sudo yum install nc or sudo apt-get install nc
# nc -z 192.168.12.16 80-1000
Connection to 192.168.12.16 80 port [tcp/http] succeeded!
Connection to 192.168.12.16 111 port [tcp/sunrpc] succeeded!

WELL-KNOWN PORTS (most common)
7 (TCP & UDP)Echo Protocol
20 (TCP)FTP data. AVOID! Prefer FTP over SSH (FTPS / port 22)
21 (TCP)FTP control (command). AVOID! Prefer FTP over SSH (FTPS / port 22)
22 (TCP & UDP)Secure Shell (SSH) - used for secure logins, file transfers (scp, ftps) and port forwarding
23 (TCP & UDP)Telnet protocol - unencrypted text communications. AVOID! Prefer SSH (port 22)
25 (TCP)Simple Mail Transfer Protocol (SMTP) - used for e-mail routing between mail servers
53 (TCP & UDP)Domain Name Server (DNS)
80 (TCP)Hypertext Transfer Protocol (HTTP)
123 (UDP)Network Time Protocol (NTP) - used for time synchronization
110 (TCP)Post Office Protocol v3 (POP3)
137 (TCP & UDP)NetBIOS NetBIOS Name Service
138 (TCP & UDP)NetBIOS NetBIOS Datagram Service
139 (TCP & UDP)NetBIOS NetBIOS Session Service
143 (TCP)Internet Message Access Protocol (IMAP) - management of email messages
161 (UDP)Simple Network Management Protocol (SNMP)
179 (TCP & UDP)Border Gateway Protocol (BGP)
389 (TCP & UDP)Lightweight Directory Access Protocol (LDAP). AVOID! Prefer LDAPS
443 (TCP)Hypertext Transfer Protocol over TLS/SSL (HTTPS)
636 (TCP & UDP)Lightweight Directory Access Protocol over TLS/SSL (LDAPS)
1433 (TCP)MSSQL (Microsoft SQL Server database management system) Server
1526 (TCP)Oracle database common alternative for listener
3306 (TCP & UDP)MySQL database system
5432 (TCP & UDP)PostgreSQL Database
5666 (TCP)NRPE (Nagios)
5667 (TCP)NSCA (Nagios)
6881-6900 (TCP (&UDP))BitTorrent part of full range of ports used most often