您的位置:首页 > 其它

以太网帧结构以及ARP RARP协议

2018-03-18 15:53 239 查看
以太网结构



preamble有7个字节的10101010组成;SOF(Start-of-frame delimiter)1个字节的数据为10101011;Type指示Data部分携带的上层协议类型;FCS(Frame check sequence)包含了4个bytes的CRC,CRC的多项式为G(x)=x^32 +x^26 +x^23 +x^22 +x^16 +x^12 +x^11 +x^10
+x^8 +x^7 +x^5+x^4 +x^2 +x+1;包含源地址和目的地址,分别都为6个字节;而如果type中指示的格式在数据部分有最小长度限制,不足长度部分需要添加padding。地址的格式如下



ARP地址解析协议
地址解析协议是将协议地址转换物理地址的过程,如在TCP/IP结构类型网络中,其过程由IP层发起。使用同样的以太网帧结构,在type类型中填写ADDRESS_RESOLUTION类型。定义两种类型的消息来处理ARP协议,一个是request,一个是reply,request通常是广播类型,而reply为单一传播,当不知道目标协议地址对应的网络地址的时候,物理地址填写值为全0。为了不会频繁触发ARP过程,每个主机存在一个table表对应着协议地址和物理地址的映射。而当网络上的主机收到ARP请求时,如果目标地址和本机匹配则需要发送相应的reply,否则可以不回复任何消息。当然收到ARP的同时,可以将ARP中的协议地址和物理地址存于本机的table表中。RFC826中建议的消息格式如下,理解上
Ethernet packet data 中的 Hardware address space 和 protocol address space 更像是使用的协议和硬件类型。至于ARP request和ARP reply类型区分,在opcode域中进行区分。
Ethernet transmission layer (not necessarily accessible tothe user):
48.bit: Ethernet address of destination
48.bit: Ethernet address of sender
16.bit: Protocol type = ether_type$ADDRESS_RESOLUTION
Ethernet packet data:
16.bit: (ar$hrd) Hardware address space (e.g., Ethernet,Packet Radio Net.)
16.bit: (ar$pro) Protocol address space. For Ethernethardware, this is from the set of type fields ether_typ$<protocol>.
8.bit: (ar$hln) byte length of each hardware address
8.bit: (ar$pln) byte length of each protocol address
16.bit: (ar$op) opcode (ares_op$REQUEST | ares_op$REPLY)
nbytes: (ar$sha) Hardware address of sender of thispacket, n from the ar$hln field.
mbytes: (ar$spa) Protocol address of sender of this packet, m from the ar$pln field.
nbytes: (ar$tha) Hardware address of target of this packet (if known).
mbytes: (ar$tpa) Protocol address of target.
RARP反地址转换协议
不同于ARP协议发生在主机和主机之间,而RARP (
Reverse Address Resolution Protocol ) 一般发生在主机和网关RARP服务器之间。RARP的协议是主机知道物理地址,获取协议地址的过程。RARP的协议结构和ARP复用,差别在于opcode中的值不同,用于指示区分是 request reverse 和 reply reverse 类型。RARP协议过程中物理主机发送 RARP request ,当网关服务器收到请求后回复相应的协议地址,与ARP相同,请求是广播的方式,而reply则是单播模式。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: