netstat computer can be used to view the current open ports in order to determine what started the current computer services.
It's commonly used options fields are as follows:
-t: lists TCP protocol port
-u: list UPD protocol port
-n: Do not use the domain name and service name, and the IP address and port number
-l: lists only state in listening network services
-a: List all network connections
-r: lists the routing list, function and command the same route
Common combination: -tuln, -an, -rn
Check network connection in a certain state, such as: netstat -an | grep ESTABLISHED
The number of rows in a view network status (see how many computers are connected to the current server), such as: netstat -an | grep ESTABLISHED | wc -l
netstat -rn and route -n command function, the results consistent. View current gateway address of the computer by this command.
For example usage scenarios:
The MySQL server installed in Vmware virtual machine, and now you want to view MySQL service is available, use MySQL directly address well-known port 3306, use the command
Netstat -an | grep 3306;
Results are as follows:
Indicating that the port is currently in a usable state.
Let another host connection mysql server, use the command again, the effect is as follows:
It can display connected to the host IP address and port number of the server.