zoukankan      html  css  js  c++  java
  • 以太网协议

    以太网和IEEE802的封装
    最常使用的封装格式是RFC894定义的格式
    封装
    类型(上层数据类型):

    • IPv4:0x0800
    • ARP:0x0806
    • ARP:0x8035
    • PPPoE:0x8864
    • 802.1Q tag:0x8100
    • IPV6:0x86DD
    • MPLS Label:0x8847

    ARP
    arp
    ar_hrd:1,表示以太网
    ar_hln和ar_pln:对于以太网上IP地址的ARP请求或应答,他们的值分别为6和4
    op:

    • 1,表示ARP请求
    • 2,表示ARP应答
    • 3,表示RARP请求
    • 4,表示RARP应答

    举例

    0000  ff ff ff ff ff ff 00 0c f1 d4 d9 60 08 06 00 01
    0010  08 00 06 04 00 01 00 0c f1 d4 d9 60 c0 a8 01 0f 
    0020  00 00 00 00 00 00 c0 a8 01 02  
    

    ff ff ff ff ff ff是以太网目的地址,一个广播地址;
    00 0c f1 d4 d9 60是以太网源地址;
    0806帧类型,指的是后面的数据是属于ARP协议,到这里以太网帧头就结束了。
    00 01硬件类型,是以太网;
    08 00协议类型,是IP协议;
    硬件地址长度和协议地址长度分别是6和4;
    00 01是ARP请求包;
    00 0c f1 d4 d9 60是发送者MAC地址;
    c0 a8 01 0f是发送者IP地址;
    00 00 00 00 00 00是想要得到的目标MAC地址;
    c0 a8 01 02是目标IP

    MPLS Label
    mpls

    • 20-bit label (a number)
    • 3-bit experimental field (usually used to carry IP precedence value)
    • 1-bit bottom-of-stack indicator (indicates whether this is the last label before the IP header)
    • 8-bit TTL (equal to the TTL in IP header),used to prevent indefinite looping of packets.

    最大传输单元MTU
    如果在IP层要传输一个数据报比链路层的MTU还大,那么IP层就会对这个数据报进行分片
    mtu
    以太网帧长度
    最小长度为64字节(6+6+2+46+4)
    最大长度为1518字节(6+6+2+1500+4)

  • 相关阅读:
    cake缓存
    css 总结文章
    cakephp随笔
    41.2WebSocket Security网络套接字安全
    36.1 DelegatingSecurityContextRunnable委托安全上下文可运行
    Spring Data Integration
    40. Security Database Schema安全数据库模式
    36.2 DelegatingSecurityContextExecutor委托安全上下文执行器
    41. The Security Namespace
    41.3 Authentication Services认证服务
  • 原文地址:https://www.cnblogs.com/zhangxuechao/p/11709816.html
Copyright © 2011-2022 走看看