Tcpdump:抓取vlan的TAG信息

简介:

1、tcpdump的参数信息

  -n     不转换主机地址到主机名,这样用于避免DNS解析

  -i      指定网络接口

  -e    增加以太网帧头部信息输出

  -v    输出更详细的信息


2、抓取vlan的信息

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# tcpdump -ni em2 -v -e  | grep vlan 
tcpdump: WARNING: em2: no IPv4 address assigned
tcpdump: listening on em2, link- type  EN10MB (Ethernet), capture size 65535 bytes
17:32:16.532355 00:e0:4c:84:5c:a3 > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.26 tell 172.16.1.99, length 46
17:32:16.568647 06:4b:36:00:00:46 > 01:00:5e:00:00:12, ethertype 802.1Q (0x8100), length 64: vlan 173, p 0, ethertype IPv4, (tos 0xc0, ttl 255,  id  24184, offset 0, flags [none], proto VRRP (112), length 40)
17:32:16.666799 18:66:da:eb:00:10 > Broadcast, ethertype 802.1Q (0x8100), length 96: vlan 172, p 0, ethertype IPv4, (tos 0x0, ttl 128,  id  23044, offset 0, flags [none], proto UDP (17), length 78)
17:32:16.840217 00:0c:29:c5:ea:d5 > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.28 tell 172.16.1.152, length 46
17:32:16.855502 00:0c:29:c5:ea:d5 > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.27 tell 172.16.1.152, length 46
17:32:16.863344 00:0c:29:78:b9:5a > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.27 tell 172.16.1.151, length 46
17:32:16.863778 00:0c:29:78:b9:5a > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.28 tell 172.16.1.151, length 46
17:32:16.894936 06:0b:1e:00:00:7f > 01:00:5e:00:00:12, ethertype 802.1Q (0x8100), length 64: vlan 173, p 0, ethertype IPv4, (tos 0xc0, ttl 255,  id  11523, offset 0, flags [none], proto VRRP (112), length 40)
17:32:16.895184 06:7a:e4:00:00:29 > 01:00:5e:00:00:12, ethertype 802.1Q (0x8100), length 64: vlan 173, p 0, ethertype IPv4, (tos 0xc0, ttl 255,  id  47219, offset 0, flags [none], proto VRRP (112), length 40)
17:32:17.287184 06:a6:8e:00:00:10 > 33:33:00:01:00:02, ethertype 802.1Q (0x8100), length 161: vlan 173, p 0, ethertype IPv6, (hlim 1, next-header UDP (17) payload length: 103) fe80::89e9:16fa:9921:a2de.dhcpv6-client > ff02::1:2.dhcpv6-server: [udp  sum  ok] dhcp6 solicit (xid=343686 (elapsed- time  703) (client-ID hwaddr /time  type  time  556803887 06a68e000010) (IA_NA IAID:302422322 T1:0 T2:0) (Client-FQDN) (vendor-class) (option-request DNS-search-list DNS-server vendor-specific-info Client-FQDN))
17:32:17.300035 00:0c:29:c5:ea:d5 > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.26 tell 172.16.1.152, length 46
17:32:17.392404 00:e0:4c:84:5c:a3 > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.27 tell 172.16.1.99, length 46
17:32:17.430664 18:66:da:eb:00:10 > Broadcast, ethertype 802.1Q (0x8100), length 96: vlan 172, p 0, ethertype IPv4, (tos 0x0, ttl 128,  id  24752, offset 0, flags [none], proto UDP (17), length 78)
17:32:17.568896 06:4b:36:00:00:46 > 01:00:5e:00:00:12, ethertype 802.1Q (0x8100), length 64: vlan 173, p 0, ethertype IPv4, (tos 0xc0, ttl 255,  id  24185, offset 0, flags [none], proto VRRP (112), length 40)
17:32:17.799903 00:0c:29:c5:ea:d5 > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.28 tell 172.16.1.152, length 46
17:32:17.799936 00:0c:29:c5:ea:d5 > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.27 tell 172.16.1.152, length 46
17:32:17.864017 00:0c:29:78:b9:5a > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.27 tell 172.16.1.151, length 46
17:32:17.864393 00:0c:29:78:b9:5a > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.28 tell 172.16.1.151, length 46
17:32:17.896318 06:7a:e4:00:00:29 > 01:00:5e:00:00:12, ethertype 802.1Q (0x8100), length 64: vlan 173, p 0, ethertype IPv4, (tos 0xc0, ttl 255,  id  47220, offset 0, flags [none], proto VRRP (112), length 40)
17:32:17.896327 06:0b:1e:00:00:7f > 01:00:5e:00:00:12, ethertype 802.1Q (0x8100), length 64: vlan 173, p 0, ethertype IPv4, (tos 0xc0, ttl 255,  id  11524, offset 0, flags [none], proto VRRP (112), length 40)
17:32:18.154418 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 176, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  80b0.2c:31:24:34:1c:80.8009, length 42
17:32:18.154818 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 177, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  80b1.2c:31:24:34:1c:80.8009, length 42
17:32:18.155353 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 178, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  80b2.2c:31:24:34:1c:80.8009, length 42
17:32:18.164715 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 180, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  80b4.2c:31:24:34:1c:80.8009, length 42
17:32:18.165125 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 179, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  80b3.2c:31:24:34:1c:80.8009, length 42
17:32:18.195014 18:66:da:eb:00:10 > Broadcast, ethertype 802.1Q (0x8100), length 96: vlan 172, p 0, ethertype IPv4, (tos 0x0, ttl 128,  id  26667, offset 0, flags [none], proto UDP (17), length 78)
17:32:18.392359 00:e0:4c:84:5c:a3 > Broadcast, ethertype 802.1Q (0x8100), length 64: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.27 tell 172.16.1.99, length 46
17:32:18.411455 84:d9:31:82:74:8e > Broadcast, ethertype 802.1Q (0x8100), length 68: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.217 tell 172.16.1.254, length 50
17:32:18.411660 84:d9:31:82:74:8e > Broadcast, ethertype 802.1Q (0x8100), length 68: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.23 tell 172.16.1.254, length 50
17:32:18.411872 84:d9:31:82:74:8e > Broadcast, ethertype 802.1Q (0x8100), length 68: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.210 tell 172.16.1.254, length 50
17:32:18.412088 84:d9:31:82:74:8e > Broadcast, ethertype 802.1Q (0x8100), length 68: vlan 172, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request  who -has 172.16.1.181 tell 172.16.1.254, length 50
17:32:18.473644 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 192, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  80c0.2c:31:24:34:1c:80.8009, length 42
17:32:18.474051 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 253, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  80fd.2c:31:24:34:1c:80.8009, length 42
17:32:18.474575 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 254, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  80fe.2c:31:24:34:1c:80.8009, length 42
17:32:18.475530 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 1000, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  83e8.2c:31:24:34:1c:80.8009, length 42
17:32:18.476037 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 173, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  80ad.2c:31:24:34:1c:80.8009, length 42
17:32:18.483481 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 174, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  80ae.2c:31:24:34:1c:80.8009, length 42
17:32:18.485569 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 172, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  80ac.2c:31:24:34:1c:80.8009, length 42
17:32:18.486260 2c:31:24:34:1c:89 > 01:00:0c:cc:cc: cd , ethertype 802.1Q (0x8100), length 68: vlan 175, p 0, LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid PVST (0x010b): STP 802.1d, Config, Flags [none], bridge- id  80af.2c:31:24:34:1c:80.8009, length 42
17:32:18.569139 06:4b:36:00:00:46 > 01:00:5e:00:00:12, ethertype 802.1Q (0x8100), length 64: vlan 173, p 0, ethertype IPv4, (tos 0xc0, ttl 255,  id  24186, offset 0, flags [none], proto VRRP (112), length 40)
17:32:18.691450 54:c4:15:51:8e:de > 01:00:5e:7f:ff:fa, ethertype 802.1Q (0x8100), length 184: vlan 254, p 0, ethertype IPv4, (tos 0x0, ttl 4,  id  0, offset 0, flags [DF], proto UDP (17), length 166)

  说明:此命令适用于调试Linux网络时候,查看vlan相关的tag信息,存档,备忘。










本文转自 冰冻vs西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/2062159,如需转载请自行联系原作者
目录
相关文章
|
Shell 容器
使用tcpdump抓取容器中的数据包
学习记录下,容器的网络数据包抓取
|
SQL 关系型数据库 MySQL
利用tcpdump抓取mysql sql语句
这个脚本是我之前在网上无意间找个一个利用tcpdump 抓包工具获取mysql流量,并通过过滤把sql 语句输入。 脚本不是很长,但是效果很好。 #!/bin/bash #this script used montor mysql network traffic.
1495 0
|
SQL 关系型数据库 Linux
[20140212]linux下使用tcpdump抓取sql语句
[20140212]linu下使用tcpdump抓取sql语句.txt 我们生产系统问题多多,经常要跟踪用户执行的sql语句,当出现问题时要跟踪比较麻烦,我需要一个快捷的方式"看到"用户执行的sql语 句,想到了tcpdump抓包软件。
1511 0
|
网络协议
tcpdump抓取TCP标识位
tcpdump抓取TCP标识位 按每8位组算,TCP的标志位位于第13个8位组中,如下,第一行一共32位是0 - 3个8位组,第二行是4-7八位组,第三行是8-11八位组,data offset +reserved的前四个是第12个8位组,reserved中的后2位+6个标志位是第13个八位组。
968 0
|
SQL 关系型数据库 MySQL
用Tcpdump抓取MySQL执行的SQL
编写脚本文件dumpsql.sh,内容如下: !/bin/bashtcpdump -i eth0 -s 0 -l -w out.
745 0
|
1月前
|
运维 网络协议 安全
【Shell 命令集合 网络通讯 】Linux 网络抓包工具 tcpdump命令 使用指南
【Shell 命令集合 网络通讯 】Linux 网络抓包工具 tcpdump命令 使用指南
44 0
|
3月前
|
网络协议 Linux
Linux命令(120)之tcpdump
Linux命令(120)之tcpdump
37 0
|
5月前
|
Linux
linux下用tcpdump抓包
linux下用tcpdump抓包