Use Netstat to view network status, port status _linux under Linux

Source: Internet
Author: User

In Linux generally use Netstat to view system port usage steps.

The netstat command is a very useful tool for monitoring the TCP/IP network, which shows the routing table, the actual network connection, and each network interface device's

The function of the netstat command is to display network connections, routing tables, and network interface information, allowing users to know what network connections are currently in operation.

The general format for this command is:

netstat [options]

The options in the command have the following meanings:

-a displays all sockets, including those that are listening.

-C is displayed again every 1 seconds until the user interrupts it.

-I displays information for all network interfaces in the form of "ifconfig-e".

-N Displays the network connection situation with the network IP address instead of the name.

-R Displays the core routing table in the same format as "Route-e".

-T displays the TCP protocol connection.

-U Displays the connection condition of the UDP protocol.

-V Displays the work in progress.

1. Netstat-an | grep LISTEN

0.0.0.0 is the service of each IP, which IP is the binding of the IP service.

2. Netstat-tln

Used to view the port usage of Linux

3./etc/init.d/vsftp Start

is used to start the FTP port ~!

4. Netstat

View the service ports that are already connected (established)

5. Netstat-a

View all service ports (listen,established)

6. Sudo netstat-ap

View all service ports and display the corresponding service program name

7. Nmap Scan type >< scan parameters

For example:

Nmap localhost

Nmap-p 1024-65535 localhost

Nmap-pt 192.168.1.127-245

When we look at a network connection using NETSTAT-APN, we find a lot of things like the following:

Proto recv-q Send-q Local address Foreign address State Pid/program Name

TCP 0 218.104.81.152:7710 211.100.39.250:29488 established 6111/1

Shows that this server is open to Port 7710, so which program does this port belong to? We can use the Lsof-i: 7710 command to query:

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

SSHD 1990 Root 3u IPv4 4836 TCP *:7710 (LISTEN) 54com.cn

So we know that port 7710 belongs to the SSHD program.

The above is a small set to introduce Linux with Netstat to view the status of the network, port status, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.