1.linux环境
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| tcpdump -i eth0 -w tcp.pcap -s 100 -c 10 -n 'host 1.1.1.1 and port 80 and tcp and vlan 10'
tcpdump -i eth0 icmp tcpdump -i eth0 host 1.1.1.1 tcpdump -i eth0 host 1.1.1.1 and port 80
tcpdump -i eth0 -w tcp.pcap tcpdump -i eth0 -w tcp.pcap host 1.1.1.1 tcpdump -i eth0 -w tcp.pcap host 1.1.1.1 and port 80
|
2.vpp协议栈
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| pcap trace rx tx max [num] intfc [interface] file [filename] max-bytes-per-pkt [number] filter [protocol] buffer-size [size]
pcap trace rx tx drop max 10000 intfc TenGigabitEthernet1 file capture.pcap max-bytes-per-pkt 1000 filter tcp
pcap trace rx max 10000 pcap trace tx max 10000 pcap trace rx tx max 10000 pcap trace rx tx drop max 10000
pcap trace status pcap trace off
pcap dispatch trace on max [num] file [filename]
pcap dispatch trace on max 10000 file capture.pcap pcap dispatch trace status pcap dispatch trace off
|
3.镜像抓包
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| system-view mirroring-group 1 source GigabitEthernet 1/0/1 {direction} mirroring-group 1 destination GigabitEthernet 1/0/2 display mirroring-group all 抓包,在目的端口连接的设备上 undo mirroring-group 1
mirroring-group 1 local mirroring-group 1 mirroring-port GigabitEthernet 1/0/18 both mirroring-group 1 monitor-port GigabitEthernet 1/0/20 抓包,在目的端口连接的设备上 undo mirroring-group 1
|
4.windos环境
打开wireshark

选择网口,开始抓包

过滤报文

1 2 3 4 5 6 7 8 9
| icmp/tcp/udp/sctp/gtpu ip.src/ip.dst/ip.addr/ipv6.src/ipv6.dst/ipv6.addr ()/&&/||/!/==
icmp || tcp ip.addr == 1.1.1.1 ip.src == 1.1.1.1 && ip.dst == 2.2.2.2
|
4.1 抓包过滤器
捕获过滤器的菜单栏路径为Capture –> Capture Filters。用于在抓取数据包前设置。
- 类型Type(host、net、port)
- 方向Dir(src、dst)
- 协议Proto(ether、ip、tcp、udp、http、icmp、ftp等)
- 逻辑运算符(&& 与、|| 或、!非)
协议过滤: 直接在抓包过滤框中直接输入协议名即可。
IP过滤: src host 192.168.1.104
端口过滤: src port 80
逻辑运算符: && 与、|| 或、!非
4.2 显示过滤器
显示过滤器是用于在抓取数据包后设置过滤条件进行过滤数据包。
比较操作符: 有== 等于、!= 不等于、> 大于、< 小于、>= 大于等于、<=小于等于。
协议过滤: 直接在Filter框中直接输入协议名即可。注意:协议名称需要输入小写。
ip过滤: ip.src ==192.168.1.104
端口过滤: tcp.srcport == 80
Http模式过滤: http.request.method==“GET”, 只显示HTTP GET方法的。
逻辑运算符: and/or/not