ICMP - Destination Unreachable Message Analysis

Introduction

The 'ICMP Destination unreachable' message is quite interesting, because it doesn't actually contain one message, but infact six! This means that the ICMP Destination unreachable futher breaks down into 6 different messages.

This article will analyse all six destination unreachable messages and explain which occasions each message is used. The table below shows an brief summary of the available messages and their code value contain in the ICMP header:


icmp-dest-unreach-msgs

To make sure you don't get confused, keep one thing in mind: The ICMP Destination unreachable is a generic ICMP message, the different code values or messages which are part of it are there to clarify the type of "Destination unreachable" message was received. It goes something like this: ICMP Destination unreachable.

The ICMP - Destination net unreachable message is one which a user would usually get from the gateway when it doesn't know how to get to a particular network.

The ICMP - Destination host unreachable message is one which a user would usually get from the remote gateway when the destination host is unreachable.

If, in the destination host, the IP module cannot deliver the packet because the indicated protocol module or process port is not active, the destination host may send an ICMP destination protocol / port unreachable message to the source host.

In another case, when a packet received must be fragmented to be forwarded by a gateway but the "Don't Fragment" flag (DF) is on, the gateway must discard the packet and send an ICMP destination fragmentation needed and DF set unreachable message to the source host.

These ICMP messages are most useful when trying to troubleshoot a network. You can check to see if all routers and gateways are configured properly and have their routing tables updated and synchronised.

Let's look at the packet structure of an ICMP destination unreachable packet:

icmp-dest-unreach-packet1

icmp-dest-unreach-packet2

Please read on as the following example will help you understand all the above.

The Analysis

When you open a DOS command prompt and type "ping 200.200.200.200", assuming that your workstation is NOT part of that network, then it would forward the ICMP Echo request to the gateway that's configured in your TCP/IP properties. At that point, the gateway should be able to figure out where to forward the ICMP Echo request.

The gateway usually has a "default route" entry, this entry is used when the gateway doesn't know where the network is. Now, if the gateway has no "default route" you would get an "ICMP Destination net unreachable" message when you try to get to a network which the gateway doesn't know about. When you're connected to the Internet via a modem, then your default gateway is the modem.

In order for me to demonstrate this, I set up my network in a way that should make it easy for you to see how everything works. I have provided a lot of pictures hoping to make it as easy as possible to understand.

I will analyse why and how you get an "ICMP - Destination net unreachable" message.

icmp-dest-unreach-network-setup

In the example above, I've setup my workstation to use the Linux server as a default gateway, which has an IP of 192.168.0.5. The Linux server also has a default gateway entry and this is IP: 192.168.0.1 (the Windows 2000 Server).

When my workstation attempts to ping (send an ICMP Echo request) to IP 200.200.200.200, it realises it's on a different network, so it sends it to the Linux server, which in turn forwards it to its default gateway (the Win2k server) so it can then be forwarded to the Internet and eventually I should get a ping reply (ICMP Echo reply) if the host exists and has no firewall blocking ICMP echo requests.

Here is the packet which I captured and its analysis on the right:

icmp-dest-unreachable-iris-small2

icmp-dest-unreachable-iris-small1

When looking at the decoded packet you can see in the ICMP header section that the ICMP Type is equal to 8, so this confirms that it's an ICMP Echo (ping). As mentioned earlier, we would expect to receive an ICMP echo reply.

Check out though what happens when the default gateway entry is removed from the Linux server:

icmp-dest-unreach-network-setup-2

Now what I did was to remove the default gateway entry from the Linux server. So when it gets a packet from my workstation, it wouldn't know what to do with it. This is how you get the gateway to generate an "ICMP Destination net unreachable" message and send it back to the source host (my workstation).

Here is a screen shot from the command prompt:

icmp-dest-unreachable-example

As you can see, the Linux server has returned an "ICMP Destination net unreachable". This is one of the six possible 'ICMP Destination Unreachable' messages as listed at the beginning of this page. The Linux server doesn't know what to do with the packet since it has no way of getting to that 200.200.200.0 network, so it sends the "ICMP Destination net unreachable" message to my workstation, notifiying it that it doesnt know how to get to that network.

Let's now take a look what the packet sniffer caught :

icmp-dest-unreachable-iris-small4 icmp-dest-unreachable-iris-small3

The decoded packet on the right shows that the Linux server (192.168.0.5) sent back to my workstation (192.168.0.100) an ICMP Destination unreachable message (look at the ICMP type field, right under the ICMP header) but if you also check out the ICMP Code (highlighted field), it's equal to 0, which means "net unreachable". Scrolling right at the top of this page, the first table clearly shows that when the code field has a value of 0, this is indeed a "net unreachable" message.

It is also worth noticing the "Returned IP header" which exists within the ICMP header. This is the IP header of the packet my workstation sent to the Linux server when it attempted to ping 200.200.200.200, and following that is 64 bits (8 bytes) of the original data.

This completed our discussion on the ICMP 'Destination Unreachable' generated packets.

from:http://www.firewall.cx/networking-topics/protocols/icmp-protocol/153-icmp-destination-unreachable.html

    尽管讲解概念如果同学们是初初相识,真有点晦涩难懂,本人讲解概念的同时,尽量结合实操来讲,这样即加固了概念,同时让同学不会感觉到太烦闷,其实对这些重要基础概念的理解,正是学习过《计算机网络原理》,与直接上手做事的人的区别所在。     古人云,腹有诗书气自华,只要先搞懂了原理,学有所成,今后和别人讨论网络底层问题的时候,才能够抑扬顿挫底气十足,不怯场!# 网络层首部     初探十二段内容介绍     ipv4和ipv6 版本号表示;首部长度     区分服务,给数据包添加标识 QoS     总长度 Total Length;标识Identification;标志Flags     生存时间 TTL     协议号;首部校验和     实训抓包验证诸项内容# ICMP 差错报告报文格式     数据包类型(详解列表:类型值和代码)     TTL耗尽报告-1     主机不可到达(Destination unreachable)-2     路由重定向(Redirect)-3     给应用程序返回差错报告-4     实例讲解:使用ping命令测试网络判断出问题范围     跟踪数据包路径主要命令介绍:tracert和pathping# ARP 协议     arp 协议本网段与跨网段的工作原理     arp 欺骗的两个目的,阻断连接或截获数据包     arp 欺骗的工作原理阐述,创建阻断连接的实验环境     arp 欺骗演示工具,网络执法官     arp 欺骗防止或阻止措施:         手工绑定两端通信主机的mac地址 -a         同时修改mac地址和ip地址;安装运行wireshark工具 -b         在路由器中绑定通信主机mac地址 -c# 搭建流媒体服务     提供点对点服务:采用TCP协议,而非IGMP协议     提供多播视频:根据多播地址切换频道(IGMP协议-UDP)     根据多播IP地址,参照预定规则,合成多播MAC地址     阐述IGMP跨网段运行方式,与创建跨网段环境     启用多播路由:实现流媒体跨网段转发视频,同时抓包查看ICMP数据包特性# 习题详解    网络层协议
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值