TCPDUMP

0413 第十三次课:日常运维-系统监控

久未见 提交于 2019-12-06 06:11:13
日常运维(上) 系统监控 使用w查看系统负载 vmstat命令 top命令 sar命令 nload命令 监控io性能 free命令 ps命令 查看网络状态 linux下抓包 扩展 tcp三次握手四次挥手 tshark几个用法 一、w、vmstat、top、sar命令 w命令查看系统负载 w命令可以查看系统的运行情况 详细解释: 信息 说明 21:51:33 表示当前时间 up 209 days 表示系统运行时间为209天 1 users 表示当前登录用户个数,可以通过下面 USER行 查看当前的用户 TTY 登录的方式 pts/0 表示网络登录 如果为tty1-6 则是终端登录 LOGIN@ 表示用户登录时间 IDLE 表示用户空闲时间 FROM 用户登录的ip JCPU 该终端相关进程任务所耗费的时间 PCPU 表示WHAT或任务执行后耗费的CPU时间 WHAT 表示当前执行的任务 最常用的信息 load average:后面3个数字分别代表过去1,5,10分钟内CPU的负载情况。这个数值表示cpu的使用情况,一般来说只要不超过cpu的核数就是正常的 查看cpu的核数 cat /proc/cpuinfo 其中processor表示cpu的核数。从0开始计算,0就是表示核数为1。 或者使用lscpu命令查看 vmstat命令 vmstat命令可以查看进程、内存、I

How to send big chunk of data in one UDP packet?

半城伤御伤魂 提交于 2019-12-06 05:30:14
trying to send UDP packets using Netcat nc -u 127.0.0.1 1234 And using tcpdump to see actual packets tcpdump -i any -vv -n udp dst port 1234 In theory the UDP packet size can be about 64K, however when I'm sending a message with size bigger than 2048 the Netcat splits the data and sends in 2 separate UDP packets. For example if I send the following long string

tcpdump

冷暖自知 提交于 2019-12-06 02:33:18
熟悉抓包工具 tcpdump tcpdump 利用表达式作为过滤报文的条件,如果一个报文满足表达式的条 件,则这个报文将会被捕获。如果没有给出任何条件,则网络上所有的信息包将 会 被截获。 表达式中需要注意的关键字: 1 、关于类型的关键字,主要包括 host 、net 、port 。例如 host 202.38.75.11 , 指明 202.38.75.11 是一台主机,net 202.38.0.0 指明 202.38.0.0 是一个网络地址, port 23 指明端口号是 23 。 2 、确定传输方向的关键字,主要包括 src 、dst 、dst or src 、dst and src ,这些 关键字指明了传输的方向。例如 src 202.38.75.11 指明 ip 包中源地址是 202.38.75.11 ,dst net 202.38.0.0 指明目的网络地址是 202.38.0.0 。 这些关键字可以组合起来构成强大的组合条件来满足人们的需要,例如 tcpdump host 202.38.75.11 and port 80 本实验要求 熟悉 tcpdump 的使用,用 man tcpdump 查看帮助 观察 FTP 的两种数据传送模式: 本实验在 Linux 环境下实现, 使用 tcpdump 观察 FTP 的两种数据传输模式 (主动模式和被动模式)的区别

capture network traffic on two different ports simultaneously

穿精又带淫゛_ 提交于 2019-12-06 00:24:05
I wish to capture tcpdump traffic on two different ports simultaneouly . I tried this .. $ tcpdump port 21 ; tcpdump port 22 Althoug it worked but problem is first it will wait for traffic on port 21 and when interrupted then it will wait for port 22. Also another problem is it will not capture the traffic on port 22 untill traffic on port 21 will be captured. I want an order free solution means in whatever order packet arrives if they are for port 21 or 22 they should be captured . Please help me on this !!! EDIT : Sorry I did not specified it before the actual command I am trying to run is

tcpdump抓包和wireshark解包

情到浓时终转凉″ 提交于 2019-12-05 19:48:08
tcpdump抓包 使用命令:   tcpdump -i lo -s 0 -w /data/data/info.txt   -i lo 表示我指定lo这个接口   -s 0 : 抓取数据包时默认抓取长度为68字节。加上-s 0 后可以抓到完整的数据包   -w /data/data/info.txt 指定存储的路径文件 wireshark解包   打开指定文件   过滤显示:     ip.addr==127.0.0.1     tcp.port == 8888     ...... 来源: https://www.cnblogs.com/jiangyu0331/p/11942640.html

How intrusive is tcpdump?

喜夏-厌秋 提交于 2019-12-05 16:55:05
I look around to find a documentation on tcpdump internals, but I did not found nothing yet. So my question is how intrusive is tcpdump on a computer. How to evaluate the amount of resources (memory or cpu) dedicated for the analysis of the traffic? As far as I read, tcpdump consume it's kinda variable depending what you're asking. To see how many resources your tcpdump process consumes just watch system monitor like top Top Manual . tcpdump output can be considerable if the network traffic your expression defines is high bandwidth; particularly if you are capturing more than the default 68

我们来说一说TCP神奇的40ms

被刻印的时光 ゝ 提交于 2019-12-05 13:15:28
本文由云+社区发表 TCP是一个复杂的协议,每个机制在带来优势的同时也会引入其他的问题。 Nagel算法和delay ack机制是减少发送端和接收端包量的两个机制, 可以有效减少网络包量,避免拥塞。但是,在特定场景下, Nagel算法要求网络中只有一个未确认的包, 而delay ack机制需要等待更多的数据包, 再发送ACK回包, 导致发送和接收端等待对方发送数据, 造成死锁, 只有当delay ack超时后才能解开死锁,进而导致应用侧对外的延时高。 其他文字已经介绍了相关的机制, 已经有一些文章介绍这种时延的场景。本文结合具体的tcpdump包,分析触发delay ack的场景,相关的内核参数, 以及规避的方案。 背景 给redis加了一个proxy层, 压测的时候发现, 对写入命令,数据长度大于2k后, 性能下降非常明显, 只有直连redis-server的1/10. 而get请求影响并不是那么明显。 分析 观察系统的负载和网络包量情况, 都比较低, 网络包量也比较小, proxy内部的耗时也比较短。 无赖只能祭出tcpdump神奇, 果然有妖邪。 22号tcp请求包, 42ms后服务端才返回了ack。 初步怀疑是网络层的延时导致了耗时增加。Google和km上找资料, 大概的解释是这样: 由于客户端打开了Nagel算法, 服务端未关闭延迟ack, 会导致延迟ack超时后

【抓包工具】tcpdump

我只是一个虾纸丫 提交于 2019-12-05 07:17:09
tcpdump - dump traffic on a network 根据使用者的定义对网络上的数据包进行截获的包分析工具。 tcpdump可以将网络中传送的数据包的“头”完全截获下来提供分析。它支持针对网络层、协议、主机、网络或端口的过滤,并提供and、or、not等逻辑语句来帮助你去掉无用的信息。 tcpdump是一个用于截取网络分组,并输出分组内容的工具,简单说就是数据包抓包工具。 tcpdump凭借强大的功能和灵活的截取策略,使其成为Linux系统下用于网络分析和问题排查的首选工具。 tcpdump提供了源代码,公开了接口,因此具备很强的可扩展性,对于网络维护和入侵者都是非常有用的工具。tcpdump存在于基本的Linux系统中,由于它需要将网络界面设置为混杂模式,普通用户不能正常执行,但具备root权限的用户可以直接执行它来获取网络上的信息。因此系统中存在网络分析工具主要不是对本机安全的威胁,而是对网络上的其他计算机的安全存在威胁。 1. 默认启动tcpdump [root@oldboy ~]# tcpdump tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture

How do I pump traffic using tcpreplay at 100 MBps, 500 MBps and 1Gbps speeds?

最后都变了- 提交于 2019-12-05 06:33:57
问题 I used the -R and -K option but it doesnt seem to be working as I captured the pumped traffic using tcpdump and the number of packets that I see there dont seem to match the number of packets that I expect in the time frame. 回答1: First of all make sure you are using the latest version, available here. You will want to use the -K and --mbps (or -M) options, for example: # tcpreplay -i eth7 -K --mbps 1000 smallFlows.pcap File Cache is enabled Actual: 14261 packets (9216531 bytes) sent in 0

tcp中的连接和终止

血红的双手。 提交于 2019-12-05 06:31:20
TCP传输控制协议 + tcp提供什么服务 连接建立和终止 每一行的显示方式:源>目的:标志 - 需要理解标志有哪些?意义是什么 - 连接和终止连接的具体过程是什么 连接建立的超时 使用命令查看超时间隔 date ;telnet 192.129.0.121 discard;date 第一次超时时间 第一次超时时间在6秒左右 第二次超时时间在24秒 当我们第一次输入命令telnet时,启动一个定时器每隔6s时间,启动500ms倒计时的定时器,当时间到达0时,定时器超时。在24秒之后重新启动新的定时器。 最大报文段长度mss tcp半关闭 tcp是双工的端到端的传输层服务,也就是说可以两端同时传输消息给对方 tcp的半关闭是指关闭了一端,另一端还可以发送数据 tcp状态变迁图 来源: https://my.oschina.net/iioschina/blog/3132563