tag 标签: IPv4

相关帖子
相关博文
  • 热度 3
    2024-8-6 10:12
    242 次阅读|
    0 个评论
    ICMPv4协议—互联网控制报文协议
    引言 在车载以太网测试中,因为IP协议本身提供的是不可靠传输,所以如果网络出现丢包、网络错误等问题就需要及时向管理者报告错误和状态信息,此时就需要借助ICMP协议来实现这一功能。 什么是ICMPv4协议 ICMP协议全称是Internet Control Message Protocol,即互联网控制报文协议。其中,ICMPv4和ICMPv6分别指用于IPv4和IPv6的ICMP版本。目前在车载以太网里常用到的IP协议是IPv4,所以本文着重介绍ICMPv4,ICMPv6不涉及。 ICMPv4协议是TCP/IP协议簇的一个子协议,封装在IPv4报文中,主要用于在IPv4主机、路由器之间传递控制消息,用于报告网络通不通、主机是否可达、路由是否可用等网络本身的消息。这些控制消息虽然并不传输用户数据,但是对于收集各种网络信息、诊断和排除各种网络故障以及用户数据的传递起着重要的作用。 ICMPv4报文格式 ICMPv4报文封装在IPv4数据报里,所以一个ICMPv4报文会包括IPv4头部、ICMPv4头部和ICMPv4 Payload。当IPv4头部的Protocol值为1时,表示为一个ICMPv4报文。 ICMPv4报头格式如下图: ICMP报头格式 类型(Type):ICMPv4报文的类型,如目标不可达报文(Type=3)。 代码(Code):ICMPv4报文类型(Type)下细化的子类型,如对于目标不可达报文(Type=3),code=1表示主机不可达,code=2表示协议不可达。 校验和(Checksum):ICMPv4报文的校验和,校验方法与IP数据报首部校验和算法相同。 报文分类 ICMPv4分为两类报文,1类是查询报文(通过对对端主机发送请求和接收对端主机发送响应的方式去传输消息,可以用来报告网络连通性等消息),1类是差错报文(报告IP数据报在传输过程中出现的错误)。 常见的ICMPv4报文类型如下: 响应请求 平时使用较多的Ping命令就是通过对端主机发送回显请求(Type=8)和接收对端主机发送的回显回答(Type=0)去判断主机之间是否通信连通。 实际测试数据如下: 目标不可达 当路由器无法根据路由表转发IP数据报到指定的目标地址时,会向发送端主机返回一个目标不可达的差错报文,并报告不可达的原因。常见的目标不可达差错报文类型有网络不可达(Code=0)、主机不可达(Code=1)、协议不可达(Code=2)、端口不可达(Code=3)等。 实际测试数据如下: 时间戳 时间戳请求报文(Type=13)和时间戳应答报文(Type=14)用于测试两台主机之间数据报来回一次的传输时间。传输时,主机填充原始时间戳,接收方收到请求后填充接收时间戳后以Type=14的报文格式返回,发送方计算这个时间差。 实际测试数据如下: 参数错误报文 一旦路由器或主机发现错误的数据报首部和错误的数据报选项参数时,便丢弃该数据报,并向源主机发送参数问题(Parameter Problem)报文(Type=12)。代码Code=0表示数据报首部中的某个字段的值有错或不明确,这时ICMP报文首部的指针指向数据报中有问题的字节。 实际测试数据如下: 下表是完整的ICMP报文分类: 表1 ICMP类型 应用 ICMPv4最常见的用法是对网络进行测试和故障诊断,常用的程序是Ping 和tracert。 Ping 使用ping命令确定本地主机是否能与另一台主机成功交换数据包,再根据返回的信息,就可以推断TCP/IP参数是否设置正确,以及运行是否正常、网络是否通畅等。 tracert tracert 命令主要用来显示数据包到达目的主机所经过的路径。通过执行一个tracert到对方主机的命令,返回数据包到达目的主机所经历的路径详细信息,并显示每个路径所消耗的时间。 总结 ICMP协议是TCP/IP协议簇中不可或缺的一部分。通过理解和应用ICMP协议,可以更好地帮助管理员去收集各种网络信息、诊断和排除各种网络故障。 北汇信息是一家专注于汽车电子测试领域的企业,对车载以太网测试有着丰富经验,并可提供相关培训、咨询服务以及测试解决方案,帮助汽车制造商和零部件供应商确保其车载以太网系统的可靠性和安全性。如果需要具体的测试服务或了解更多信息,欢迎大家来联系我们。 参考文献: 【1】《RFC 792》
  • 热度 3
    2024-4-3 17:05
    238 次阅读|
    0 个评论
    IPv4(Internet Protocol version 4)和IPv6(Internet Protocol version 6)是两种互联网协议,用于在网络上唯一标识和寻址设备。在选择IPv4或IPv6时,需要考虑网络速度和配置等因素。 一、网络速度: IPv4:IPv4是互联网上广泛使用的传统协议,大多数网络设备和服务都支持IPv4。由于IPv4地址资源有限,导致IPv4地址短缺,可能会导致一些网络拥塞和延迟问题。 IPv6:IPv6具有更大的地址空间,可以解决IPv4地址短缺的问题,同时提供了更好的路由效率和网络扩展性。在IPv6环境下,因为有更多的地址可供选择,可能会有更快的网络连接速度。 二、配置: IPv4:大多数网络设备和服务默认配置为IPv4,因此IPv4更容易部署和管理。IPv4也更成熟,拥有更广泛的支持和应用。 IPv6:虽然IPv6的部署相对较慢,但随着IPv4地址耗尽和IPv6技术的不断成熟,越来越多的网络服务和设备开始支持IPv6。在一些新兴的网络环境中,可能会优先选择IPv6以提供更好的性能和扩展性。 三、综合考虑以上因素,一般来说: 如果网络环境支持IPv6,并且你的网络服务提供商也支持IPv6,那么在可行的情况下,选择IPv6可能会带来更好的网络速度和性能。 如果网络设备或服务仅支持IPv4,并且IPv4的网络速度和性能满足需求,那么可以继续使用IPv4。 在实际应用中,IPv4和IPv6经常同时存在,网络设备和服务会根据具体情况选择合适的协议进行通信。因此,重要的是要确保网络设备和服务同时支持IPv4和IPv6,并根据实际需求进行配置和管理。
  • 热度 22
    2015-7-16 21:17
    1832 次阅读|
    0 个评论
    The American Registry for Internet Numbers (ARIN) has just sent out an alert that its share of the unique URL addresses for the Internet Protocol, Version 4 (IPv4) is running out. Since only a few of four billion or so unique URL addresses possible with IPv4 are left, ARIN has announced that there’s not enough in its stock to satisfy an entire order. So it has activated a stricter procedure by which to assign the few remaining IPv4 addresses.   Specifically, in its recently announced policy for unmet requests , when an organization qualifies for a block size that no longer remains in the ARIN IPv4 inventory, they'll be given the option to either accept a smaller block that is available to fully satisfy their request, or to be placed on the waiting list for unmet requests.   “The number of days remaining before depletion are dwindling," writes ARIN's chief information officer Richard Jimmerson in a blog post just before July 4. "It is very likely that we are already processing a request that we will be unable to fulfill."   An article in the Washington Post on the ARIN announcement seems to imply that major changes are imminent, but that we are not to worry because IPv6 is available to save us and give us all the URL addresses we need. Only the second part of that is true. Except for many mobile smartphone and tablet users whose wireless service providers are just now making the shift, the transition to IPv6 will take years and even decades. Many existing Internet Service Providers with IPv4 will be around for a long time. Indeed, there is already a growing market for buying used and highly desirable IPv4 addresses .   IPv6 with its 340 trillion trillion trillion possible unique combinations has been sitting in the wings as a replacement for IPv4 since about 2000. But few if any large organizations with the bankroll to establish a presence on the Internet have felt it was economically viable to invest in it until recently. It was not until three to four years ago that major Internet and Web entities under the umbrella of the Internet Society finally started making the transition. Many of those most active in making the shift are in mobile smartphone markets, including ATT, Google, T-Mobile, and Verizon. Most of them are still only half-way through their deployment and testing on IPv6. And where available, it is being offered only as an optional alternative to IPv4.   Currently, only about seven percent of users who come to Google do so over IPv6 connections. (Source: Google)   Even with the number of its remaining unique addresses drying up, IPv4 still accounts for 93 percent of worldwide Internet traffic. According to a continuously updated chart maintained by Google, as of July 3, 2015, the percentage of users worldwide who access Google via ISPs with IPv6 is currently about seven percent. Google's per country adoption charts indicate that in the United States just slightly over 20 percent of the users who come to Google do so via IPv6 connections.   The reason there is not a rush on IPv6 is simple: economics. Most local, regional, and in some cases national Internet Service Providers are not able or are unwilling to pay the expense of transitioning from their existing base of IPv4-based routers, switches, and servers, except on a slow and years-long incremental basis. In the United States, only the largest of ISPs have committed to the transition, including Charter Communications, Comcast, Global Crossing, Hurricane Electric, Liberty Global, and Time-Warner Cable. IPv6 will slowly eat away at the continued IPv4 dominance, due mostly to new network providers and companies with no investment in existing IPv4.   But most second and third tier regional, statewide, and local ISPs who have major investments in IPv4 are not rushing to make the shift. Engineers and technicians at the several regional ISPs I have dealt with directly over the last decade or so point out that there is no compelling end-use application that cannot be done with existing IPv4. Since about 2000, through the use of such traditional techniques as the use of several levels of subdomains, dynamic rather than static network address translation (NAT) , destination and stateful NAT, NAT loopbacks, port address translation, and Internet connection sharing, they have been able to keep up with demands, not only for more bandwidth, but more features and flexibility.   Where such enhancements and workarounds put additional load on their network hardware, IPv4 Internet Service providers are shifting to the use of switches and routers based on more powerful and lower cost multicore processor designs. Also aiding their efforts at improving IPv4 is the shift to systems based on software defined networking (SDN) . Such routers and switches depend not on dedicated hardware for separate network functions, but on software-based network function virtualization (NFV) allowing lightning -fast reconfiguration of a variety of network elements.   While such enhancements of existing IPv4-based systems involve additional investment in hardware and software, this can be done at a lower cost, and on a more piecemeal, as needed, basis rather than by replacing their existing IPv4 systems with IPv6. So, despite the fewer unique URL address out of the four billion or so made possible by IPv4, the end of the Internet has we have known it will not occur soon. IPv4 will continue to be the norm for many decades to come.   In the U.S. that transition will occur more quickly only if one of three things happen: First, a dramatic use case for IPv6 emerges that triggers a demand from users of the Internet, causing IPv4-based ISP companies to make the shift; second, government action is taken either in the form of significant incentives or through a direct statutory requirement; and third, the economics of maintaining IPv4 becomes unviable. Nothing I see now or in the near future makes any of these likely any time soon.