热度 15
2014-9-12 10:56
1214 次阅读|
1 个评论
以太网嵌入式设备发现功能 应用场合: 用于支持以太网的设备,没有显示器,无法得知设备地址的情况; 设备端功能: 向固定端口广播,比如7878端口; 使用UDP协议,广播包; 上电时,广播自己的配置信息,10次; 收到广播请求包,广播自己的配置信息,5次; 参考内容: LLDP:链路层发现协议 不是所有的交换机、路由器都支持这个协议; MIB:管理信息库 示例: Commview过滤设置为:port等于7878 测试4#板时,通过commview检测到广播包;设备的ip地址为10.0.0.13. 由于pc地址为192.168.1.27,不是一个网段,所以ping失败。 将pc地址设置为10.0.0.27后,ping成功。 实现了,在不知道设备IP地址的情况下,可以获取设备IP地址等信息。 国内某厂家的“搜索设备”功能的通讯包 Packet #1, Direction: Out, Time:09:24:37.895234, Size: 48 Ethernet II Destination MAC: FF:FF:FF:FF:FF:FF Source MAC: 6C:62:6D:E6:4A:68 Ethertype: 0x0800 (2048) - IP IP IP version: 0x04 (4) Header length: 0x05 (5) - 20 bytes Type of service: 0x00 (0) Precedence: 000 - Routine Delay: 0 - Normal delay Throughput: 0 - Normal throughput Reliability: 0 - Normal reliability Total length: 0x0022 (34) ID: 0x511D (20765) Flags Don't fragment bit: 0 - May fragment More fragments bit: 0 - Last fragment Fragment offset: 0x0000 (0) Time to live: 0x40 (64) Protocol: 0x11 (17) - UDP Checksum: 0x67EB (26603) - correct Source IP: 192.168.1.27 Destination IP: 255.255.255.255 IP Options: None UDP Source port: 4211 Destination port: 8800 Length: 0x000E (14) Checksum: 0x6727 (26407) - correct Raw Data: 0x0000 FF FF FF FF FF FF 6C 62-6D E6 4A 68 08 00 45 00 lbm鍶h..E. 0x0010 00 22 51 1D 00 00 40 11-67 EB C0 A8 01 1B FF FF ."Q...@.g肜?. 0x0020 FF FF 10 73 22 60 00 0E-67 27 A1 15 02 00 00 FF .s"`..g'?... 数据区分析:数据请求命令 A1 15 02 00 00 FF ============================================================================ Packet #2, Direction: In, Time:09:24:37.****88, Size: 65 Ethernet II Destination MAC: 6C:62:6D:E6:4A:68 Source MAC: 00:14:97:0C:00:D1 Ethertype: 0x0800 (2048) - IP IP IP version: 0x04 (4) Header length: 0x05 (5) - 20 bytes Type of service: 0x00 (0) Precedence: 000 - Routine Delay: 0 - Normal delay Throughput: 0 - Normal throughput Reliability: 0 - Normal reliability Total length: 0x0033 (51) ID: 0x0021 (33) Flags Don't fragment bit: 1 - Don't fragment More fragments bit: 0 - Last fragment Fragment offset: 0x0000 (0) Time to live: 0x80 (128) Protocol: 0x11 (17) - UDP Checksum: 0x7638 (30264) - correct Source IP: 192.168.1.245 Destination IP: 192.168.1.27 IP Options: None UDP Source port: 8800 Destination port: 4211 Length: 0x001F (31) Checksum: 0x448B (17547) - correct Raw Data: 0x0000 6C 62 6D E6 4A 68 00 14-97 0C 00 D1 08 00 45 00 lbm鍶h..?.?.E. 0x0010 00 33 00 21 40 00 80 11-76 38 C0 A8 01 F5 C0 A8 .3.!@.€.v8括.趵? 0x0020 01 1B 22 60 10 73 00 1F-44 8B A1 01 01 11 FF A1 .."`.s..D嫛...? 0x0030 05 04 C0 A8 01 F5 FF A1-04 06 00 14 97 0C 00 D1 ..括.**...?.? 0x0040 FF 数据区分析: A1 01 01 11 FF ip :A1 05 04 C0 A8 01 F5 FF mac:A1 04 06 00 14 97 0C 00 D1 FF