LabVIEW基于Netstat列出活动的网络连接1

简介: LabVIEW基于Netstat列出活动的网络连接

LabVIEW基于Netstat列出活动的网络连接

该VI使用命令行“netstat”查询网络堆栈中的活动网络连接。除了连接状态之外,还会返回活动的本地和外部 IP 地址和端口号。

连接状态:Netstat 返回每个网络连接的状态,如下表所示。

State

Description

LISTEN

accepting connections

ESTABLISHED

connection up and passing data

image.png

程序截图如下所示。

更多的介绍,参见如下介绍,原文: http://linux-ip.net/html/tools-netstat.html

G.4. netstat

The netstat utility summarizes avariety of characteristics of the networking stack. With netstat you can learn a numberof important things. If no other type of data is requested it will report onthe state of all active sockets. You can however request the routingtable, masquerading table, network interface statistics, and networkstack statistics [60].

G.4.1. Displaying socket status with netstat

One of the most common uses ofthe netstat utilityis to determine the state of sockets on a machine. There are many questionsthat netstat cananswer with the right set of options. Here's a list of some of the thingsdifferent things we can learn.


·       whichservices are listening on which sockets


·       whatprocess (and controlling PID) is listening on a given socket


·       whetherdata is waiting to be read on a socket


·       whatconnections are currently established to which sockets


Byinvoking netstat withoutany options, you are asking for a list of all currently open connections to andfrom the networking stack on the local machine. This means IP networkconnections, unix domain sockets, IPX sockets and Appletalk sockets amongothers. Naturally, we'll skip over the non-IP sockets since this is about IPnetworking with linux.


Assumethe --inet switchin all cases below unless we are examining a particular higher layer protocol(e.g., TCP with the --tcp switch or UDP with --udp switch.


Aconvenient feature of netstat isits ability to differentiate between two different sorts of name lookup.Normally the -n specifies no name lookup, butthis is ambiguous when there are hostnames, port names, and user names.Fortunately, netstat offersthe following options to differentiate the different forms of lookup andsuppress only the [un-]desired lookup.


·       --numeric-hosts


·       --numeric-ports


·       --numeric-users


Theoption -n (my favorite), suppress all hostname, port name andusername lookup, and is a synonym for --numeric. I'll reiterate that hostnames andDNS in particular can be confusing, or worse, misleading when trying todiagnose or debug a networking related issue, so it is wise to suppresshostname lookups in these sorts of situations.


In Example G.11,“Displaying IP socket status with netstat” we will look at netstat's numeric output and thenwe'll invoke the same command but suppress the host lookups. Though the outputis almost the same, a particular situation might call for one or the otherinvocation.


Example G.11. DisplayingIP socket status with netstat

[root@morgan]# netstat --inet -n
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0    192 192.168.98.82:22        192.168.99.35:40991     ESTABLISHED
tcp        0      0 192.168.98.82:42929     192.168.100.17:993      ESTABLISHED
tcp       96      0 127.0.0.1:40863         127.0.0.1:6010          ESTABLISHED
tcp        0      0 127.0.0.1:6010          127.0.0.1:40863         ESTABLISHED
tcp        0      0 127.0.0.1:38502         127.0.0.1:6010          ESTABLISHED
tcp        0      0 127.0.0.1:6010          127.0.0.1:38502         ESTABLISHED
tcp        0      0 192.168.98.82:53733     209.10.26.51:80         SYN_SENT
tcp        0      0 192.168.98.82:44468     192.168.100.17:993      ESTABLISHED
tcp        0      0 192.168.98.82:44320     192.168.100.17:139      TIME_WAIT
[root@morgan]# netstat --inet --numeric-hosts
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 192.168.98.82:ssh       192.168.99.35:40991     ESTABLISHED
tcp        0      0 192.168.98.82:42929     192.168.100.17:imaps    ESTABLISHED
tcp        0      0 127.0.0.1:40863         127.0.0.:x11-ssh-offset ESTABLISHED
tcp        0      0 127.0.0.:x11-ssh-offset 127.0.0.1:40863         ESTABLISHED
tcp        0      0 127.0.0.1:38502         127.0.0.:x11-ssh-offset ESTABLISHED
tcp        0      0 127.0.0.:x11-ssh-offset 127.0.0.1:38502         ESTABLISHED


tcp        0      0 192.168.98.82:53733     209.10.26.51:http       SYN_SENT
tcp        0      0 192.168.98.82:44468     192.168.100.17:imaps    ESTABLISHED
tcp        0      0 192.168.98.82:44320     192.168.100:netbios-ssn TIME_WAIT

LabVIEW基于Netstat列出活动的网络连接2:https://developer.aliyun.com/article/1505743

相关文章
|
25天前
|
运维 监控 网络协议
|
5月前
|
监控 网络协议 Ubuntu
netstat,Linux 下的网络状态监控工具
Netstat 是 Linux 系统中的强大网络分析工具,用于查看网络配置和活动,如端口监听、网络连接和路由信息。通过基本命令 `netstat [options]` 可实现多种操作,例如 `-a` 显示所有端口,`-l` 显示监听端口,`-s` 展示协议统计信息。结合 `-p` 选项可查看占用端口的进程,而监控网络连接状态则可用 `-nt` 加 `grep ESTABLISHED` 查看已建立的连接。要深入了解和使用更多功能,可查阅 `man netstat`。
171 0
|
4月前
|
运维 算法 Java
开发与运维命令问题之ss命令和netstat命令区别如何解决
开发与运维命令问题之ss命令和netstat命令区别如何解决
39 4
|
6月前
|
网络协议
LabVIEW中如何在网络上使用远程VI服务器
LabVIEW中如何在网络上使用远程VI服务器
75 2
|
6月前
|
网络协议 测试技术
LabVIEW开发TCP网络通讯程序2
LabVIEW开发TCP网络通讯程序2
37 2
|
6月前
|
XML JSON 网络协议
LabVIEW开发TCP网络通讯程序3
LabVIEW开发TCP网络通讯程序3
42 1
|
6月前
|
网络协议
LabVIEW开发TCP网络通讯程序1
LabVIEW开发TCP网络通讯程序1
62 1
|
6月前
|
移动开发 网络协议 Unix
LabVIEW基于Netstat列出活动的网络连接2
LabVIEW基于Netstat列出活动的网络连接
38 1
|
6月前
|
机器学习/深度学习 传感器 芯片
LabVIEW利用人工神经网络辅助进行结冰检测
LabVIEW利用人工神经网络辅助进行结冰检测
41 0
|
6月前
|
监控 网络安全
LabVIEW开发干扰对无线网络基础设施进行隐蔽影响测试
LabVIEW开发干扰对无线网络基础设施进行隐蔽影响测试
49 0