What exactly is the difference between ICMP type 3 code 1 and code 7 messages? By reading their descriptions they seem to be used for the same purpose. I am trying to understand when a router will choose to send one or the other.
ICMP type 3 code 1 and 7, what is the diference
icmpprotocol-theory
Related Solutions
If we look at RFC 792 (pages 14-15) it clearly only defines code 0 for ICMP types 0 and 8, this corresponds to IANA's definitions for reply and request. This means above all that 9 does not have a meaning, so it does not mean Communication with Destination Network is Administratively Prohibited
as used in the Destination Unreachable message.
The next point is if any other code than 0
is allowed. RFC 792 is quite old and does not really follow the more strict SHOULD/MUST/MAY/... conventions. The remainder of the RFC only states sections like IF code = 0 ...
or Code 0 may be received ...
. It actually never states what should be done if code is not zero. One might intuitively interpret it as the opposite of what is defined, so may *not* be received
, another might say that if it's not explicitly disallowed it's okay. There is nothing in the RFC that even hints at what's right, so behavior will likely be very implementation-specific.
There is also RFC 1122 but this does not provide any extra specific limitation on the code
field.
Now as for why the reply also uses 9
, easiest bet is to look at implementation. A simple echo reply would just take the incoming packet, replace the type 8
with type 0
, recalculate the checksum and send back. This is simpler and more efficient than building the reply from scratch, but of course leaves the 9
code.
I am reading a book and it states
If I were in a snarkier mood, I'd tell you to burn the book. I'm sure you can find other sources that can explain this more clearly.
A better (and simpler) definition in this context is that a protocol is a set of procedures and objects used for communicating between devices. You might think of it as a specialized language for communication. Each layer uses a specific protocol to talk to the corresponding layer on the other device. For example, IP is the protocol used by the network layer on one device to talk to the network layer on another device. Note that this layer to layer communication is logical.
I don't understand the concepts of these protocols in the OSI model. Are they just code that gets invoked?
Forgetting for a moment that no one actually uses the OSI model, yes the protocols are implemented in code. They are a set of communications functions and data objects. This question and answer might help you better understand.
Is it put on every server machine that needs to conform to the protocol when you are designing the network?
In the case of the TCP/IP model, every device that uses IP has the protocol stack. That includes PCs, servers, routers, etc.
Best Answer
The differences are explained in RFC 1812 IPv4 Router Requirements, page 81:
Later in the RFC, it requires routers not to send a "Network Unreachable" instead of Type 3 Codes 1 or 7 when other hosts on the subnet are reachable...
Speaking practically, I haven't seen a router implement Type 3 Code 7 (Destination Host Unknown), normally I see Type 3 Code 1 (Host Unreachable).