Linux VLAN packet format and vconfig command test __linux

Source: Internet
Author: User

It mainly analyzes the packet format of VLAN. At the same time, the application of vconfig command is explained.


pc:10.10.107.168 ap:10.10.107.231 (eth0.100)

1: Add VLAN, use Vconfig.

~# Vconfig

BusyBoxv1.10.3 (2012-09-23 02:13:20 CST) multi-call binary

Usage:vconfig COMMAND [OPTIONS] ...

Create Andremove Virtual Ethernet Devices

Options:

add [Interface-name] [vlan_id]

REM [Vlan-name]

Set_flag [Interface-name] [flag-num] [0 | 1]

Set_egress_map [Vlan-name] [skb_priority] [Vlan_qos]

Set_ingress_map [vlan-name][skb_priority] [Vlan_qos]

Set_name_type [Name-type]

 

tcpdump-i br0-s 0-w dump.pcap

./tcpdump-i ETH0-XXVV

Route-n

~ #vconfig Add eth0

~ #ifconfig -A

Br0 Link encap:ethernet hwaddr 00:03:7f:11:20:00

inet addr:192.168.1.2 bcast:192.168.1.255 mask:255.255.255.0

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:8 errors:0 dropped:0overruns:0 frame:0

TX packets:0 errors:0 dropped:0overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:410 (410.0 B) TX bytes:0 (0.0 B)

Eth0 Link encap:ethernet hwaddr 00:03:7f:11:20:00

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:16 errors:0 dropped:0 overruns:0frame:0

TX packets:0 errors:0 dropped:0overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:1108 (1.0 KiB) TX bytes:0 (0.0 B)

eth0.100 Link encap:ethernet hwaddr 00:03:7f:11:20:00

Broadcast Multicast mtu:1500 metric:1

RX packets:0 errors:0 dropped:0overruns:0 frame:0

TX packets:0 errors:0 dropped:0overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0  (0.0 B) TX bytes:0 (0.0 B)

Lo Link encap:local Loopback

inet addr:127.0.0.1 mask:255.0.0.0

Up loopback RUNNING mtu:16436 metric:1

RX packets:0 errors:0 dropped:0overruns:0 frame:0

TX packets:0 errors:0 dropped:0overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0  (0.0 B) TX bytes:0 (0.0 B)

Teql0 Link Encap:unspec hwaddr00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00

Noarp mtu:1500 Metric:1

RX packets:0 errors:0 dropped:0overruns:0 frame:0

TX packets:0 errors:0 dropped:0overruns:0 carrier:0

collisions:0 txqueuelen:100

RX bytes:0  (0.0 B) TX bytes:0 (0.0 B)

Ifconfig eth0.100 10.10.107.231

~#./tcpdump-i eth0-xxvv

Tcpdump:WARNING:can ' t create RX ring on packet socket 3:99-protocol not available

Tcpdump:WARNING:eth0:no IPV4 Address assigned

Tcpdump:listening on eth0, Link-type EN10MB (Ethernet), capture size bytes

00:06:13.184401ARP, Ethernet (len 6), IPv4 (len 4),Request who-has 10.10.107.168 tell10.10.107.231, Length 28

0X0000:FFFF ffff ffff 0003 7f112000 8100

0x0010:08060001 08000604 0001 0003 7f11 2000

0x0020:0a0a 6be7 0000 0000 0000 0A0A

00:06:13.184592ARP, Ethernet (len 6), IPv4 (len 4),Reply10.10.107.168 is-at-e8:39:35:38:9e:4a (oui Unknown), length 46

0x0000:0003 7f11 2000e839 3538 9e4a0806 0001

0x0010:0800 0604 0002 e839 3538 9e4a 0a0a 6ba8

0x0020:0003 7f11 0a0a 6be7 0000 0000 0000

0x0030:0000 0000 0000 0000 0000 0000

00:06:13.958903ip (Tos 0x0, TTL 128, id 57182, offset 0, flags [None], Proto ICMP (1), length60)

10.10.107.168 > 10.10.107.231:ICMP echorequest, id 1024, seq 13840, length 40

0x0000:0003 7f11 e839 3538 9e4a 0800 4500

0x0010:003c df5e 0000 8001 6fbf 0a0a 6ba8 0a0a

0x0020:6be7 0800 134c 0400 3610 6162 6364 6566

0x0030:6768 696a 6b6c 6d6e 6f70 7172 7374 7576

0x0040:7761 6263

00:06:14.196038arp, Ethernet (len 6), IPv4 (len 4), Requestwho-has10.10.107.168 tell 10.10.107.231, length 28

0X0000:FFFF ffff FFFF 0003 7f1120008100 0064

0x0010:0806 0001 0800 0604 0001 0003 7f11 2000

0x0020:0a0a 6be7 0000 0000 0000 0A0A

00:06:14.196524arp, Ethernet (len 6), IPv4 (len 4),Reply10.10.107.168, Is-at e8:39:35:38:9e:4a (Oui Unknown), Len Gth 46

0x0000:0003 7f11 e839 35389e4a 0806 0001

0x0010:0800 0604 0002 e839 3538 9e4a 0a0a 6ba8

0x0020:0003 7f11 0a0a 6be7 0000 0000 0000

0x0030:0000 0000 0000 0000 0000 0000

With the above, you can know that when we add the VLAN id=100, we ping 10.10 107.168来 the PC with the above information. Village Grab bag, we can know, APÀPC is already added VLAN tag.

Notice the above data caught on the test eth0.

The data on the eth0.100 are as follows: only request. No replay.

~ #./tcpdump-i ETH0.100-XXVV

Deviceeth0.100 entered promiscuous mode

Tcpdump:WARNING:can ' t create RX ring on packet socket 3:99-protocol not available

Tcpdump:listening on eth0.100, Link-type EN10MB (Ethernet), capture size bytes

00:03:35.064079arp, Ethernet (len 6), IPv4 (len 4),Request who-has10.10.107.168 tell 10.10.107.231, length 28

0X0000:FFFF FFFF FFFF 0003 7f11 2000 0806 0001

0x0010:0800 0604 0001 0003 7f11 0a0a

0x0020:0000 0000 0000 0a0a 6BA8

00:03:36.064043arp, Ethernet (len 6), IPv4 (len 4),Request who-has10.10.107.168 tell 10.10.107.231, length 28

0X0000:FFFF FFFF FFFF 0003 7f11 2000 0806 0001

0x0010:0800 0604 0001 0003 7f11 0a0a

0x0020:0000 0000 0000 0a0a 6BA8

00:03:37.068137arp, Ethernet (len 6), IPv4 (len 4),Request who-has10.10.107.168 tell 10.10.107.231, length 28

0X0000:FFFF FFFF FFFF 0003 7f11 2000 0806 0001

0x0010:0800 0604 0001 0003 7f11 0a0a

0x0020:0000 0000 0000 0a0a 6BA8

2: Newer Ones

VLAN protocol Data Frame format:


Instructions for using the Vconfig command:


Linux under the Vconfig command implementation instructions:




The vconfig command sets the Engree operation:



Similar to the image above


Different priority and Vlan_qos are set through Vconfig, where priority has been described in Vconfig's use and is the SKB_BUF data field. This value is 0 in my own Ethernet driver.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.