linux 下VLAN数据包格式
来源:互联网 发布:老男孩linux视频 编辑:程序博客网 时间:2024/05/22 03:50
PC:10.10.107.168 AP:10.10.107.231(eth0.100)
1:添加VLAN,使用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 100
~ #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 68 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 0064
0x0010: 08060001 08000604 0001 0003 7f11 2000
0x0020: 0a0a 6be7 0000 0000 0000 0a0a 6ba8
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 2000 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 2000 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 6ba8
00:06:14.196524ARP, 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 2000 e839 35389e4a 0806 0001
0x0010: 0800 0604 0002 e839 3538 9e4a 0a0a 6ba8
0x0020: 0003 7f11 2000 0a0a 6be7 0000 0000 0000
0x0030: 0000 0000 0000 0000 0000 0000
有上面,可以知道,在我们添加VLAN ID=100时,我们通过ping 10.10.107.168来ping PC就会有上面的信息。村抓得包,我们可以知道,AP àPC 是已经加了VLAN TAG的。
注意上面的数据在试eth0上面抓到的。
而在eth0.100上面的数据如下:只有request。没有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 68 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 2000 0a0a 6be7
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 2000 0a0a 6be7
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 2000 0a0a 6be7
0x0020: 0000 0000 0000 0a0a 6ba8
2:更新部分
vlan协议数据帧格式:
vconfig命令的使用说明:
linux下vconfig命令实现说明:
vconfig命令设置engree操作:
和上面的图类似
分别通过vconfig 设置不同的priority和vlan_qos,其中priority已经在vconfig的使用中说明了,是skb_buf的数据字段。在我自己的ethernet驱动程序中此值是0;
- linux 下VLAN数据包格式
- linux 下VLAN数据包格式及vconfig命令测试
- linux 下VLAN数据包格式及vconfig命令测试
- linux下抓数据包
- Linux下VLAN创建举例
- linux下网卡配vlan
- Linux下如何配置Vlan
- linux网络编程之:UDP数据包格式
- linux下的super-vlan配置
- Linux下VLAN功能的实现
- Linux下VLAN功能的实现
- Linux下VLAN功能的实现
- Linux下VLAN功能的实现
- Linux下VLAN功能的实现
- Linux下VLAN功能的实现
- Linux下VLAN功能的实现
- Linux下配置vlan网卡教程
- Linux下VLAN功能的实现
- 一个前端与后端分离的架构实例
- Adapter中使用notifyDataSetChanged 与notifyDataSetInvalidated无效
- ffmpeg 通过通过组播发送本地TS流文件
- CentOS安装JAVA
- CFont字体类
- linux 下VLAN数据包格式
- PPPoE技术白皮书
- 使用CocoaPods管理iOS的第三方类库
- android 网络加载图片,对图片资源进行优化,并且实现内存双缓存 + 磁盘缓存
- 电脑经常黑屏死机是什么原因?
- 快速成功赚钱的三十二条法则
- poj 3020 Antenna Placement(最小路径覆盖 + 匈牙利算法)
- 初级程序猿,系统重装之后软件安装心得分享(一JAVA,安卓开发环境安装篇)
- [Android开发] 打包时提示Proguard returned with error code 1