Extension: Introduction To The Internet Protocol
Extension: Introduction To The Internet Protocol
Winter 1999
EXTENSION
Introduction to
Industrial Ethernet, Part 2.
1
USER DATA works thereby corrupting data-
grams. It is not the responsibility of
APPLICATION
IP to guarantee the delivery of mes-
APPL sages and, therefore, IP is frequent-
HEADER USER DATA
ly termed an unreliable delivery
service. That may be a little harsh
TCP
of a criticism of IP but it is the re-
TCP APPLICATION DATA
sponsibility of the transport layer
HEADER
and not the network layer to guar-
TCP SEGMENT IP
antee end-to-end message delivery.
IP is simply responsible for the ad-
IP TCP dressing and routing of datagrams.
HEADER HEADER APPLICATION DATA
IP DATAGRAM ETHERNET
DRIVER ROUTERS AND HOSTS
ETHERNET IP TCP ETHERNET Unlike repeaters that operate at the
HEADER HEADER HEADER APPLICATION DATA TRAILER
ETHERNET physical layer and bridges that
ETHERNET FRAME operate at the data link layer,
routers operate at the network
46 TO 1500 BYTES layer. A router is used to intercon-
nect two networks together to
Figure 2. The wrapping of data into the sends datagrams. Finally, the appli- form an internet. An internet is a
data field of the next immediate lower cation sends data. To further add general term used to denote a col-
layer is called encapsulation. to the confusion, the terms packet lection of networks. It is not to be
and frame are sometimes used in- confused with the Internet which
terchangeably. is the public network that requires
insert its own data into the data strict addressing standards in order
portion of the transport layer as for different systems to communi-
well as its own header. THE INTERNET PROTOCOL cate. With a control network, we
The Internet Protocol provides the may want to keep it completely
This application data is simply re- basic unit of data transfer, provides private and not connect it to the
ferred to as data since there is no addressing, routing and fragmenta- Internet or the corporate internet
defined structure in terms of the tion. The Internet Protocol resides (sometimes called an Intranet) but
TCP/IP stack. That is why if two at the network layer and sends and if we do we will need a router.
application data structures are dif- receives blocks of data called data- This is being mentioned here
ferent, communication between grams received from upper layer because IP is a routable protocol
these applications will not be ef- software. IP feeds these datagrams and routers are used to implement
fective even with strict adherence to its attached data link layer the protocol.
to TCP/IP standards. which sends and receives these
datagrams as a series of packets.
A datagram is analogous to a first- The end-to-end devices on the in-
This wrapping of data within the class letter sent in the Post. In ternet are called hosts. If two hosts
data field of the next immediate general, it will reach its destination are on the same local network, then
lower layer of the protocol stack is but there is no formal acknowl- messages are routed directly involv-
called encapsulation while the un- edgement that the letter was re- ing no routers. If the two hosts are
wrapping of the same data at the ceived like there would be with on different networks, a router must
receiving side is called demulti- either registered or certified mail. pass the message. This is called in-
plexing. In order to reduce confu- IP utilizes a “best effort” or “con- direct routing.
sion on what is the actual data we nectionless” delivery service
will say that frames are sent over between source and destination IP ADDRESSING
the data link layer. The IP sends addresses. It is connectionless
out datagrams to the data link because there was no formal The IP is responsible for source
layer in the form of packets. A session established between the and destination addresses and its
packet can be a datagram or a source and destination before the structure is defined in RFC 761.
fragment of a datagram. The TCP data was sent. Packets can be lost IPv4 is the most common version
sends segments while the UDP as they traverse the network or net- of addressing and it uses 32-bit ad-
2
dressing. The newer IPv6 calls for shown as a decimal number from If the first two bits of the first byte
128-bit addressing and was devel- 0 to 255. Therefore, an IP address are a “10,” then this is a class B
oped because the explosive growth is usually represented as address. With class B addresses
of the Internet will soon deplete XXX.XXX.XXX.XXX. This address the first two bytes identify the
the inventory of possible 32-bit ad- can be shown as a binary or hexa- network and the remaining two
dresses. IPv6 will not be discussed decimal number as well but the bytes identify the host. This pro-
here since there is ample confu- decimal-dot-decimal notation is the vides a slightly more reasonable
sion in simply discussing 32-bit IP most popular. Therefore, the range 65,534 host addresses.
addressing. of addresses is from 0.0.0.0 to
255.255.255.255. An example of an
address would be 128.8.120.5 but If the first three bits of the first
An IP address must not only looking at the address it is hard to byte are a “110,” then this is a
address a particular host but a par- tell which is the network address class C address. With class C ad-
ticular network as well. The IP and which is the host address. dresses the first three bytes identi-
address must not be confused with fy the network and the remaining
the Ethernet II address which is a byte identifies the host. This pro-
48-bit address sometimes called There are five classes of IP ad- vides a reasonable 254 hosts.
the MAC address. The MAC dresses: A, B, C, D, E. Class D is
address is used to facilitate com- for multicasting, a message from
munication only at the data link one host to many hosts, and class Class D and class E addresses can
layer. The IP address facilitates E is reserved for experiments. That be identified in the same way. A
communication over networks and leaves classes A, B and C which class D address has a leading bit
must be universally recognized, are the most important. These pattern of “1110” while a class E
even if the host is an Ethernet II three classes break up the 32-bit address has a leading bit pattern
node attached to a local area address field into defined address of “11110.”
network or a serial port attached ranges for the netid and hostid.
to a modem. You need to examine the very first There are also other reserved ad-
byte of the IP address to deter- dresses. Regardless of class, a host
address of all 1s is reserved for a
Address broadcast message to all hosts on
Network Address Host Address
Identifier
that network while a host address
Class A of all 0s is reserved to mean “this
network.” Network address 127 is
0 7 bits of network address 24 bits of host address
also reserved and is used for loop-
First byte Last three bytes back testing. This effectively
Class B
wastes 16 million possible host
10 14 bits of network address 16 bits of host address addresses. Network address 0 is
First two bytes Last two bytes reserved as well.
Class C
3
addresses, which a router will not three other bits to indicate prece- ments will contain the same data-
pass, are as follows: dence. These bits are set at higher gram identifier.
10.0.0.0 to 10.255.255.255 layers of the protocol stack and
are suggestions given the router. Flags: Three bits are reserved for
172.16.0.0 to 172.31.255.255 This looks like a nice feature for flags but only two are used. The
192.168.0.0 to 192.168.255.255 control networks since control net- Don’t Fragment bit tells the router
works require low delay and high not to fragment the datagram. If this
reliability. However, it is not clear cannot be done an error message is
that routers even look at these returned. The More Fragments bit is
Class A : 1-127
bits. It appears that this was a used in the fragmentation process.
Class B : 128-191 feature with great promise but A 1 means that the datagram being
Class C : 192-223 never really implemented. This is sent is actually a fragment of a
to be rectified in IPv6. larger datagram. A 0 means that
Class D : 224-239
either the datagram is not fragment-
Class E : 240-254 ed (first and only datagram) or it’s
Total Length: The total length of
the last fragment. Receiving hosts
Figure 4. The class of an IP address can the datagram including the header
be quickly identified by observing only need this information in order to
cannot exceed 65,535 bytes. This
the first byte. reassemble fragments.
16-bit field is for the datagram
itself and not the packet length in
IP HEADER the data link layer. If this datagram Fragment Offset: Thirteen bits are
IP transmits and receives data- is larger than the maximum packet used to indicate which fragment is
grams. Within the datagram is a length that can be sent, the data- being sent. Fragmentation is the
header and the data portion of the gram will need to be fragmented process of breaking up large data-
datagram. The minimum size of into manageable successive grams into manageable packets.
the IP header is 20 bytes consist- packets. In this case the total Ideally you would like to restrict
ing of five 32-bit words. The first length field will represent the datagram size to packet size in
three words provide control infor- length of the fragment sent and not order to avoid fragmentation. With
mation while the remaining two the length of the original datagram. Ethernet II the maximum packet
words provide address informa- size is 1500 bytes. This is called its
tion. An optional field can follow Maximum Transmission Unit (MTU)
Datagram Identification: A
the address information. The infor- and within a private or local
unique 16-bit identifier assigned by
mation in the header is as follows: network the MTU is known and
the host will accompany the data-
can be adhered to. The problem
gram. This is necessary in order for
occurs between networks.
Version: A four-bit field identifies the receiving host to reassemble
Intermediate networks may have a
the IP version. A 4 identifies IPv4 fragmented datagrams. All frag-
lesser MTU requiring the router to
while a 6 identifies IPv6.
4
fragment the original message even MTU. If the datagram is to be sent datagram was processed, the router
though it was originally sent un- beyond the local network set the would decrement this field by the
fragmented. The router does the maximum datagram size to 576 amount of time that occurred.
fragmentation on his own (as long bytes. For control networks, frag- However, in practice modern
as the datagram was not marked as mentation may never be an issue routers are much faster then early
“do not fragment”) and the frag- since control information packets routers and usually process the
ments must be recombined at the are usually short not exceeding datagram within a second but only
destination host. Routers do not re- 256 or 512 bytes. Fragmentation decrement the field by one (the
combine fragments. should be avoided since it increas- minimum amount). Therefore, the
es data latency and increases the field has come to be treated as a
chances of a corrupted datagram hop counter. A hop being an in-
The default MTU is 576 bytes and since multiple packets must be stance of a datagram being
all routers must be able to handle sent per datagram. processed by a router. The originat-
that size transmission. By restrict- ing host sets the Time to Live field
ing the datagram to 576 bytes, it and each router decreases it by
will never need to be fragmented. If fragments are to be sent it is one. If a router decrements the
Of course that puts an undue re- necessary to load in the fragment count to zero it will discard the
striction on the Ethernet II offset. Notice that with every frag- datagram and inform the originat-
network since packets can be as ment the IP header is resent with ing host that the datagram failed to
long as 1500 bytes. So for local just a slight modification. The frag- reach its destination.
networks set the maximum data- ment offset will change on every
gram size to the local network’s fragment and possibly along with
one flag bit. Fragments must be Protocol: The eight-bit protocol
sent in eight-byte multiples field informs the upper layer proto-
What Defines TCP/IP? because there are only13 bits avail- col that the received datagram is
able for identifying fragments and for its use. Usually the upper layer
The TCP/IP stack and its associated datagrams can be 64KB in length. protocol is TCP or UDP but there
protocols are described in Request for For example, if the first fragment is are other protocols as well that
1024 bytes long, the fragment could be sending and receiving
Comments (RFCs). There are about 2700
offset of the next fragment will in- data. The protocol field provides
RFCs in existence and unlike many dicate that the accompanying frag- this distinction.
industrial control standards these are ment begins the 1025th byte of the
free! You can simply download them original datagram. With knowledge
Header Checksum: The complete
from the Internet. One possible location is of the datagram identifier, fragment
offset, the source IP address and IP header is checked for integrity
http://www.ietf.org. Which RFCs do you with the aid of the 16-bit header
the fragments themselves, the com-
need? Matthew Naugle, in his book checksum. The originating host
plete datagram can be reassembled
Illustrated TCP/IP, suggests as mandatory by the receiving host even if the applies the checksum and all
reading RFCs 1122, 1123 and 1812. fragments are received out of routers check the header for in-
These will give a good overview but you order. That is the true strength of tegrity and regenerate a new
checksum when the datagram is
can always seek out others once you find the IP. Packets can take different
routes to the intended destination resent. A new checksum is re-
an index. You can also author your own quired since the Time to Live field
and still be reassembled into the
RFC by following the instructions and would have been changed by the
original datagram.
format in RFC 1543. Most of the RFCs router. Finally, the checksum is
originate from the working groups (WGs) again reconfirmed by the receiv-
of the Internet Engineering Task Force Time to Live: This eight-byte field ing host.
is strictly used by the routers to
(IETF). Some RFCs obsolete prior RFCs. If
prevent a datagram from a faulty
your control strategy is based upon the transmission sequence to endlessly Source/Destination Address: The
TCP/IP protocol, it is recommended that circulate around an internet. 32-bit source and destination ad-
you document which RFCs are important Originally the unit of measure was dresses are included in the header.
These are the IP addresses and not
to your system. These documents might seconds because it was believed
that it would take a router one or MAC addresses.
be the only documents available that
more seconds to process a data-
define your system's compliance.
gram from its queue. Once the
5
IP Options: There may be no When a host needs to send a data- complexity is due to its ability to
options in which case this field is gram to another host on a local route packets directly within a
null or there can be options network, it first checks its ARP local network or indirectly
usually intended for router use table to determine the physical through routers. Routers are not
only. The option fields must be at address for that IP destination ideal for a control network since
least 32-bits in length and must be address. If one is found, the data- they reduce determinism and in-
padded to that amount if shorter. gram transmission proceeds. If crease data latency. Still to accept
none is found, an ARP request is TCP as a transport layer for an
made. An ARP request consists of Ethernet control network requires
ARP a broadcast message to all hosts on acceptance of IP as well. By un-
As mentioned before, the IP routes the local network. Within the ARP derstanding the limitations of IP, a
datagrams between source and request is the originator’s IP and control network can still be de-
destination addresses in the form physical addresses as well as the signed using the TCP/IP family of
of packets over a data link layer. requested IP address. Since it is a protocols. This is especially true if
The data link does not understand broadcast message, all hosts have the control network is restricted to
datagrams nor does it understand the opportunity to learn the IP that of a private or local network.
IP addresses. It does know, address and physical address
however, its own MAC address pairing of the requestor which can
and knows how to communicate be appended to that host’s ARP
to other MAC addresses when told table. Only the host with the re-
to do so. Somehow we need to quested IP address responds to
inform each host what IP address the ARP request by providing its
its MAC address or physical IP address and physical address
address has been assigned and we pairing. This message is sent as a
need to inform the same host all unicast message back to the re-
the other physical address assign- questor. Once the physical address
ments on the local network in is known by the requestor, the
order to have communication. datagram can be sent.
REFERENCES
local network must still need to
learn the assignment.
www.ccontrols.com