태그 보관물: vlan

vlan

tcpdump를 통한 패킷 캡처 (Linux)에 VLAN 태그가 표시되지 않음 8021q 8021q

태그가 지정된 VLAN을 eth0에 추가하고 있습니다.

#ip link add link eth0 name eth0.20 type vlan id 20

결과는 다음과 같습니다.

#ip link
2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
 link/ether 9c:c7:a6:95:65:1c brd ff:ff:ff:ff:ff:ff
....
12: eth0.20@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
 link/ether 9c:c7:a6:95:65:1c brd ff:ff:ff:ff:ff:ff

#ip -d link show eth0.20
70: eth0.20@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
    link/ether 9c:c7:a6:95:65:1c brd ff:ff:ff:ff:ff:ff
    vlan id 20 <REORDER_HDR>

#cat /proc/net/vlan/config
VLAN Dev name    | VLAN ID
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
eth0.234       | 234  | eth0
eth0.20        | 20  | eth0

이제 dhclient를 시작합니다 :

#dhclient -d -v -1 eth0.20

tcpdump에서 볼 수있는 것은 태그가없는 DHCP 검색 프레임입니다.

#tcpdump -i eth0 -XX
0x0000:  ffff ffff ffff 9cc7 a695 651c 0800 4500
                                       ^^^^

태그가없는 이유는 무엇입니까?

802.1q 모듈이 사용 된 것 같습니다 :

#lsmod | grep 8021q
8021q                  28324  0
garp                   14311  1 8021q

(OS : SLES11SP2 커널 3.0.13-0.27- 기본값)

BTW 다른 트래픽에도 태그가 지정되지 않았습니다 (적어도 tcpdump에 표시되지 않음) …


10 월 16 일 업데이트

 # tcpdump -Uw - | tcpdump -i eth0 -en -r - &
[1] 7310
 # tcpdump: WARNING: eth0: no IPv4 address assigned
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes

 # dhclient -d -v -1 eth0.20
Internet Systems Consortium DHCP Client 4.2.3-P2
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0.20/9c:c7:a6:95:65:1c
Sending on   LPF/eth0.20/9c:c7:a6:95:65:1c
Sending on   Socket/fallback
DHCPDISCOVER on eth0.20 to 255.255.255.255 port 67 interval 3
reading from file -, link-type EN10MB (Ethernet)
18:49:14.437882 9c:c7:a6:95:65:1c > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 347: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 9c:c7:a6:95:65:1c, length 305
                                                                       ^^^^^^

따라서 여전히 여기에 태그가 표시되지 않습니다.

그러나 실제로 dhclient를 실행할 때 / proc / net / dev의 eth0.20에 대한 전송 카운터가 증가합니다 …



답변

tcpdump -i eth0VLAN 가속으로 인해 i686 / x86_64 아키텍처의 출력에서 VLAN 태그를 볼 수 없습니다 . VLAN 계층은 커널에 의해 필터링되므로 항상 태그가없는 것처럼 보입니다. 버그 498981을 참조하십시오 -tcpdump가 802.1q VLAN 태그를 처리 할 수 ​​없습니다

귀하의 경우에 따라 다음을 통해 VLAN 태그를 얻을 수 있습니다.

tcpdump -i eth0 -Uw - | tcpdump -en -r - vlan 20

다음과 같은 결과가 나타납니다.

<timestamp> <mac-addr-of-eth0> > Broadcast, ethertype 802.1Q (0x8100), length 346: vlan 20, p 0, ethertype IPv4, 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP


답변