位置: 编程技术 - 正文
推荐整理分享Linux下常用网络命令总结(linux常用网络工具),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:linux常用网络配置命令有哪些?,linux常用网络探测命令,linux常用网络端口的范围是多少,linux常用网络端口的范围是多少,linux常用网络工具,linux常用网络命令详解,linux常用网络命令,linux常用网络端口的范围是多少,内容如对您有帮助,希望把文章链接给更多的朋友!
你可以使用以下任何一个命令:nstat 命令 : 网络统计工具
键入以下命令:
复制代码代码如下:# nstat
输出样例:
#kernel IpInReceives 0.0 IpInDelivers 0.0 IpOutRequests 0.0 IcmpOutErrors 0.0 IcmpOutTimeExcds 0.0 IcmpMsgOutType3 0.0 TcpActiveOpens 0.0 TcpEstabResets 0.0 TcpInSegs 0.0 TcpOutSegs 0.0 TcpRetransSegs 0.0 TcpOutRsts 0.0 UdpInDatagrams 0.0 UdpNoPorts 0.0 UdpOutDatagrams 0.0 Ip6OutNoRoutes 0.0 TcpExtTW 0.0 TcpExtDelayedACKs 0.0 TcpExtDelayedACKLocked 1 0.0 TcpExtDelayedACKLost 0.0 TcpExtTCPHPHits 0.0 TcpExtTCPPureAcks 0.0 TcpExtTCPHPAcks 0.0 TcpExtTCPSackRecovery 1 0.0 TcpExtTCPLossUndo 0.0 TcpExtTCPSackFailures 4 0.0 TcpExtTCPFastRetrans 1 0.0 TcpExtTCPSlowStartRetrans 3 0.0 TcpExtTCPTimeouts 0.0 TcpExtTCPDSACKOldSent 0.0 TcpExtTCPDSACKRecv 5 0.0 TcpExtTCPAbortOnData 0.0 TcpExtTCPAbortOnClose 0.0 TcpExtTCPSackShiftFallback 9 0.0 IpExtInOctets 0.0 IpExtOutOctets 0.0
ss 命令 : 查询套接字工具
要查看统计汇总, 输入:
复制代码代码如下:# ss -s
输出样例:
Total: (kernel ) TCP: (estab , closed 7, orphaned 0, synrecv 0, timewait 6/0), ports Transport Total IP IPv6 * - - RAW 1 1 0 UDP 9 3 TCP 6 INET 9 FRAG 0 0 0
netstat 命令 : 不错的显示套接字信息的旧工具
查看所有网络端口以及汇总信息表,输入:
复制代码代码如下:# netstat -i
输出样例:
Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg eth0 0 0 0 0 0 0 0 BMRU lo 0 0 0 0 0 0 0 LRU ppp0 0 0 0 0 0 0 0 MOPRU
查看每个协议的汇总统计信息,输入:
复制代码代码如下:# netstat -s
输出样例:
Ip: total packets received 0 forwarded 0 incoming packets discarded incoming packets delivered requests sent out dropped because of missing route reassemblies required packets reassembled ok Icmp: ICMP messages received 0 input ICMP message failed. ICMP input histogram: timeout in transit: 8 echo replies: 9 ICMP messages sent 0 ICMP messages failed ICMP output histogram: destination unreachable: echo request: IcmpMsg: InType0: 9 InType: 8 OutType3: OutType8: Tcp: active connections openings passive connection openings failed connection attempts connection resets received 7 connections established segments received segments send out segments retransmited 6 bad segments received. resets sent Udp: packets received packets to unknown port received. 0 packet receive errors packets sent UdpLite: TcpExt: invalid SYN cookies received 8 resets received for embryonic SYN_RECV sockets packets pruned from receive queue because of socket buffer overrun TCP sockets finished time wait in fast timer packets rejects in established connections because of timestamp delayed acks sent 6 delayed acks further delayed because of locked socket Quick ack mode was activated times 1 packets directly queued to recvmsg prequeue. 1 bytes directly received in process context from prequeue packet headers predicted acknowledgments not containing data payload received predicted acknowledgments times recovered from packet loss by selective acknowledgements congestion windows recovered without slow start by DSACK congestion windows recovered without slow start after partial ack TCP data loss events TCPLostRetransmit: 1 timeouts after reno fast retransmit timeouts after SACK recovery timeouts in loss state fast retransmits 5 forward retransmits retransmits in slow start other TCP timeouts SACK retransmits failed packets collapsed in receive queue due to low socket buffer DSACKs sent for old packets DSACKs sent for out of order packets DSACKs received 9 DSACKs for out of order packets received connections reset due to unexpected data connections reset due to early user close connections aborted due to timeout TCPDSACKIgnoredOld: 3 TCPDSACKIgnoredNoUndo: TCPSpuriousRTOs: 4 TCPSackShifted: TCPSackMerged: TCPSackShiftFallback: IpExt: InMcastPkts: OutMcastPkts: InBcastPkts: 1 InOctets: OutOctets: InMcastOctets: OutMcastOctets: InBcastOctets:
ip / ifconfig 命令 : 配置或者显示网络端口信息
键入以下命令:
复制代码代码如下:# ifconfig
或者
复制代码代码如下:# /sbin/ifconfig
或者
复制代码代码如下: # ifconfig eth0
eth0 Link encap:Ethernet HWaddr b8:ac:6f:::e5 inet addr:..1.5 Bcast:..1. Mask:...0 inet6 addr: fe::baac:6fff:fe:e5/ Scope:Link UP BROADCAST RUNNING MULTICAST MTU: Metric:1 RX packets: errors:0 dropped:0 overruns:0 frame:0 TX packets: errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen: RX bytes: (1.1 GiB) TX bytes: (.5 MiB) Interrupt: lo Link encap:Local Loopback inet addr:.0.0.1 Mask:.0.0.0 inet6 addr: ::1/ Scope:Host UP LOOPBACK RUNNING MTU: Metric:1 RX packets: errors:0 dropped:0 overruns:0 frame:0 TX packets: errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes: (1.3 MiB) TX bytes: (1.3 MiB) ppp0 Link encap:Point-to-Point Protocol inet addr:.1.. P-t-P:.0.. Mask:... UP POINTOPOINT RUNNING NOARP MULTICAST MTU: Metric:1 RX packets: errors:0 dropped:0 overruns:0 frame:0 TX packets: errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes: (2.2 MiB) TX bytes: (.5 KiB)
显示网络端口统计信息,输入:
复制代码代码如下:# ip -s link
输出样例:
1: lo: mtu qdisc noqueue state UNKNOWN link/loopback ::::: brd ::::: RX: bytes packets errors dropped overrun mcast 0 0 0 0 TX: bytes packets errors dropped carrier collsns 0 0 0 0 2: eth0: mtu qdisc mq state UP qlen link/ether b8:ac:6f:::e5 brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 0 0 0 TX: bytes packets errors dropped carrier collsns 0 0 0 0 3: wlan0: mtu qdisc noop state DOWN qlen link/ether ::6a:ca:9b: brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 0 0 0 0 0 0 TX: bytes packets errors dropped carrier collsns 0 0 0 0 0 0 4: pan0: mtu qdisc noop state DOWN link/ether 4a:c7:5f:0e:8e:d8 brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 0 0 0 0 0 0 TX: bytes packets errors dropped carrier collsns 0 0 0 0 0 0 8: ppp0: mtu qdisc pfifo_fast state UNKNOWN qlen 3 link/ppp RX: bytes packets errors dropped overrun mcast 0 0 0 0 TX: bytes packets errors dropped carrier collsns 0 0 0 0
sar 命令: 显示网络统计信息
输入以下命令 (你需要 通过sysstat包安装并启用sar):
复制代码代码如下:sar -n DEV
Linux 2.6.-.2.1.el6.x_ (www.cyberciti.biz) Tuesday March _x__ (2 CPU) :: CDT IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. .... .. .... .. . :: CDT eth1 . . . . 0. 0. 0. :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s Average: lo 0. 0. 0. 0. 0. 0. 0. Average: eth0 . . . . 0. 0. 0. Average: eth1 . . . . 0. 0. 0.
或者输入以下命令:
复制代码代码如下: # sar -n DEV 1 3
输出样例:
Linux 2.6.-.2.1.el6.x_ (www.cyberciti.biz) Tuesday March _x__ (2 CPU) :: CDT IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. :: CDT IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. :: CDT IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s :: CDT lo 0. 0. 0. 0. 0. 0. 0. :: CDT eth0 . . . . 0. 0. 0. :: CDT eth1 . . . . 0. 0. 0. Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s Average: lo 0. 0. 0. 0. 0. 0. 0. Average: eth0 . . . . 0. 0. 0. Average: eth1 . . . . 0. 0. 0.
在Linux系统中使用iptraf进行网络监控 iptraf是一个基于ncurses开发的IP局域网监控工具,它可以生成各种网络统计数据,包括TCP信息、UDP统计、ICMP和OSPF信息、以太网负载信息、节点统计、IP校
Linux中复制目录报错cp:omitting directory的解决办法 Linux系统中复制目录到另一个目录下面,用cp命令时会出现报错1、在/home/目录下,创建一个新目录,例如:、拷贝目录到/tmp/目录中,使用cp命令3、
在Linux系统中使用Gitblit工具创建Git仓库的方法 嗨!朋友,今天我们将学习如何在你的Linux服务器或者PC上安装Gitblit工具。首先,我们看看什么是Git,它的功能以及安装Gitblit的步骤。Git是分布式版本
标签: linux常用网络工具
本文链接地址:https://www.jiuchutong.com/biancheng/364054.html 转载请保留说明!上一篇:在Linux系统上实现IP转发的方法(在linux系统中)
友情链接: 武汉网站建设