You are on page 1of 5

IP (Internet Protocol) Info Sheet

The ABCs of IP (Internet Protocol)

INTRODUCTION
The push to incorporate Industrial
Ethernet or even “plain vanilla”
Ethernet into control networks implies
that by making that choice completes
the selection process. As mentioned
in a previous article, Ethernet II and
IEEE 802.3 are strictly data link layer
technologies which do not guarantee
the delivery of messages over a
network or between networks.
Protocol stacks such as TCP/IP or
SPX/IPX provide that functionality
and without them Ethernet would be
useless. With the immense interest
in the Internet and the potential of
attaching control networks to the
Internet, the protocol stack of choice
is TCP/IP because it provides the Technologies such as Ethernet II and Figure 1. The TCP/IP stack is actually a set of
foundation for the Internet. This protocols. IP resides at the network layer of the
IEEE 802.3 reside at the lower data OSI Reference Model shown on the left.
article addresses issues related to the link and physical layers of the
IP portion of the TCP/IP stack as it same model. Finally above the transport layer is
applies to control networks.
DATA ENCAPSULATION the application layer which needs to
THE TCP/IP STACK insert its own data into the data
The data sent over wires is represented
Actually TCP/IP is a set of protocols as frames. An Ethernet II frame portion of the transport layer as well
defined by a series of RFCs (request consists of a preamble, source and as it own header.
for comments) that have evolved destination addresses, type field, data This application data is simply
over the years. In general the field and a frame sequence check field. referred to as data since there is no
Internet Protocol (IP) is used to route You lump these fields into Ethernet defined structure in terms of the
messages between networks and, header, data and trailer fields. The IP TCP/IP stack. That is why if two
therefore, properly resides at the data sits above the data link layer and application data structures are
network layer of the OSI Reference its data, called a datagram, is inserted different, communication between
Model. Transmission Control Protocol into the data field of the Ethernet frame. these applications will not be effective
(TCP) sits on top of IP and is used to The datagram has its own header and even with strict adherence to
guarantee the delivery of messages. data fields but no trailer field. Above TCP/IP standards.
Above TCP is the application layer. the IP layer is the transport layer where The wrapping of data within the data
The services of the presentation and TCP and User Datagram Protocol field of the next immediate lower
session layers of the OSI Reference (UDP) reside. Data from this layer is layer of the protocol stack is called
Model are incorporated into the likewise applied to the data portion of encapsulation while the unwrapping
application layer. Therefore, the the IP datagram. TCP applies segments of the same data at the receiving side
reference model for TCP/IP-based while UDP applies datagrams. Both is called demultiplexing.
systems actually consists of only TCP and UDP have headers as well.
five layers.

Contemporary Control Systems, Inc. • 2431 Curtiss Street • Downers Grove, Illinois 60515 • USA
Telephone 1-630-963-7070 Fax 1-630-963-0109 E-mail info@ccontrols.com Web www.ccontrols.com, www.CTRLink.com

Contemporary Controls Ltd • Sovereign Court Two • University of Warwick Science Park
• Sir William Lyons Rd. • Coventry CV4 7EZ UK
Telephone +44 (0)24 7641 3786 Fax +44 (0)24 7641 3923 E-mail info@ccontrols.co.uk
Web www.ccontrols.co.uk, www.CTRLink.co.uk

November 2006
IP (Internet Protocol) Info Sheet

we do we will need a router. This is


being mentioned here because IP is
a routable protocol and routers are
used to implement the protocol.
The end-to-end devices on the
Internet are called hosts. If two hosts
are on the same local network, then
messages are routed directly
involving no routers. If the two hosts
are on different networks, a router
must pass the message. This is
called indirect routing.
IP ADDRESSING
The IP is responsible for source and
destination addresses and its
structure is defined in RFC 761. IPv4
is the most common version of
addressing and it uses 32-bit
addressing. The newer IPv6 calls for
128-bit addressing and was
Figure 2. The wrapping of data into the data field developed because the explosive
of the next immediate lower layer is called addresses. It is connectionless because growth of the Internet will soon
encapsulation.
there was no formal session deplete the inventory of possible
In order to reduce confusion on what established between the source and 32-bit addresses. IPv6 will not be
is the actual data we will say that destination before the data was sent. discussed here since there is ample
frames are sent over the data link Packets can be lost as they traverse confusion in simply discussing
layer. The IP sends out datagrams to the network or networks; thereby, 32-bit IP addressing.
the data link layer in the form of corrupting datagrams. It is not the
packets. A packet can be a datagram responsibility of IP to guarantee the An IP address must not only address
or a fragment of a datagram. The delivery of messages and, therefore, a particular host but a particular
TCP sends segments while UDP IP is frequently termed an unreliable network as well. The IP address must
sends datagrams. Finally, the delivery service. That may be a little not be confused with the Ethernet II
application sends data. To further harsh of a criticism of IP, but it is the address which is a 48-bit address
add to the confusion, the terms responsibility of the transport layer and sometimes called the MAC address.
packet and frame are sometimes not the network layer to guarantee end- The MAC address is used to facilitate
used interchangeably. to-end message delivery. IP is simply communication only at the data link
responsible for the addressing and layer. The IP address facilitates
THE INTERNET PROTOCOL
routing of datagrams. communication over networks and
The Internet Protocol provides the must be universally recognized even
basic unit of data transfer, provides ROUTERS AND HOSTS if the host is an Ethernet II node
addressing, routing and fragmentation. Unlike repeaters that operate at the attached to a local area network or
The Internet Protocol resides at the physical layer and bridges that a serial port attached to a modem.
network layer and sends and receives operate at the data link layer, routers The format of the address is
blocks of data called datagrams operate at the network layer. A router <netid, hostid> but is shown as one
received from upper layer software. IP is used to interconnect two networks 32-bit address split up as four bytes.
feeds these datagrams to its attached together to form an Internet. An However, each byte is shown as a
data link layer which sends and Internet is a general term used to decimal number from 0 to 255.
receives these datagrams as a series denote a collection of networks. It is Therefore, an IP address is usually
of packets. A datagram is analogous to not to be confused with the Internet represented as XXX.XXX.XXX.XXX.
a first-class letter sent in the Post. In which is the public network that This address can be shown as a
general, it will reach its destination but requires strict addressing standards binary or hexadecimal number as
there is no formal acknowledgement in order for different systems to well, but the decimal-dot-decimal
that the letter was received like there communicate. With a control network, notation is the most popular.
would be with either a registered or we may want to keep it completely Therefore, the range of addresses is
certified mail. IP utilizes a “best effort” private and not connect it to the from 0.0.0.0. to 255.255.255.255.
or“connectionless” delivery service Internet or the corporate Internet
between source and destination (sometimes called an Intranet), but if

November 2006 Page 2


IP (Internet Protocol) Info Sheet

An example of an address would be identifies the host. This provides a


128.8.120.5, but looking at the reasonable 254 hosts.
address it is hard to tell which is the Class D and class E addresses can be
network address and which is the identified in the same way. A class D
host address. address has a leading bit pattern of “1110”
There are five classes of IP addresses: while a class E address has a leading bit
A, B, C, D, E. CLass D is for multicasting, pattern of “11110.”
a message from one host to many hosts, There are also other reserved addresses. Figure 4. The class of an IP address can be quickly
and class E is reserved for experiments. identified by observing only the first byte.
Regardless of class, a host address of all
That leaves classes A, B and C which are 1s is reserved for a broadcast message
the most important. These three classes to all hosts on that network while a host IP HEADER
break up the 32-bit address field into address of all 0s is reserved to mean
defined address ranges for the netid and IP transmits and receives datagrams.
“this network.” Network address 127 is
hostid. You need to examine the very first Within the datagram is a header and
also reserved and is used for loopback
byte of the IP address to determine the the data portion of the datagram. The
testing. This effectively wastes 16 million
class. If the first bit of this byte is a ‘0’ then minimum size of the IP header is
possible host addresses. Network
this is a class A address. In a class A 20 bytes consisting of five 32-bit words.
address 0 is reserved as well.
address the first byte identifies the network The first three words provide control
and the remaining three bytes identifies the If the control network is to become part information while the remaining two
host. That means you can have of the public Internet then strict adherence words provide address information. An
16, 277, 214 hosts for every network! to the class addressing rules must be optional field can follow the address
followed. Usually these addresses will be information. The information in the
header is as follows:
Version: A four-bit field identifies the IP
version. A 4 identifies IPv4 while a 6
identifies IPv6.
Header Length: A four-bit field
indicates how many four-byte words
are in the header. The header length
cannot exceed 60 bytes; thereby,
allowing 40 bytes for options.
Type of Service: Of the eight-bit field
only six bits are used. The Delay bit
indicates the datagram should be
processed with low delay by the router.
The Throughput bit requests high
throughput while the Reliability bit
requests high reliability. There are three
other bits to indicate precedence.
These bits are set at higher layers of
the protocol stack and are suggestions
Figure 3. Address classes define the split between issued by the corporate network given the router. This looks like a nice
network and host IDs.
administrator or by an Internet Service feature for control networks since
Provider (ISP). But what if the control control networks require low delay and
If the first two bits of the first byte are a network is to become strictly a private
“10,”then this is a class B address. With high reliability. However, it is not clear
network? Cannot any addressing scheme that routers even look at these bits. It
class B addresses the first two bytes work? Yes, any address scheme could
identify the network and the remaining two appears that this was a feature with
work but there is even an RFC guideline great promise but never really
bytes identify the host. This provides a for this situation. According to RFC 1918,
slightly more reasonable 65, 534 implemented. This is to be rectified
only non-routable IP addresses should be in IPv6.
host addresses. used. These addresses, which a router
If the first three bits of the first byte are a will not pass, are as follows: Total Length: The total length of the
“110,” then this is a class C address. With datagram including the header cannot
10.0.0.0 to 10.255.255.255 exceed 65,535 bytes. This 16-bit field is
class C addresses the first three bytes
identify the network and the remaining byte 172.16.0.0 to 172.31.255.255 for the datagram itself and not the
packet length in the data link layer.
192.168.0.0 to 192.168.255.255

November 2006 Page 3


IP(Internet Protocol) Info Sheet

If this datagram is larger than the Ideally you would like to restrict data- If fragments are to be sent, it is
maximum packet length that can be gram size to packet size in order to necessary to load in the fragment offset.
sent, the datagram will need to be avoid fragmentation. With Ethernet II Notice that with every fragment, the
fragmented into manageable the maximum packet size is 1500 bytes. IP header is resent with just a slight
successive packets. In this case the This is called its Maximum Transmission modification. The fragment offset will
total length field will represent the length Unit (MTU) and within a private or local change on every fragment and possibly
of the fragment sent and not the length network the MTU is known and can be along with one flag bit. Fragments must
of the original datagram. adhered to. The problem occurs be sent in eight-byte multiples because
between networks. Intermediate net- there are only 13 bits available for
works may have a lesser MTU requiring identifying fragments and datagrams
can be 64 KB in length. For example, if
the first fragment is 1024 bytes long,
the fragment offset of the next fragment
will indicate that the accompanying
fragment begins the 1025th byte of the
original datagram. With knowledge of
the datagram identifier, fragment
offset, the source IP address and the
fragments themselves, the complete
datagram can be reassembled by the
receiving host even if the fragments
are received out of order. That is the
true strength of the IP. Packets can take
different routes to the intended destination
and still be reassembled into the
original datagram.
Figure 5. The IP datagram consisting of a header the router to fragment the original Time to Live: This eight-byte field is
and data is inserted into the Ethernet data field. message even though it was originally strictly used by the routers to prevent a
sent unfragmented. The router does the datagram from a faulty transmission
fragmentation on his own (as long as sequence to endlessly circulate around
Datagram Identification: A unique
the datagram was not marked as “do an Internet. Originally, the unit of measure
16-bit identifier assigned by the host
not fragment”) and the fragments must was seconds because it was believed that
will accompany the datagram. This is
be recombined at the destination host. it would take a router one or more
necessary in order for the receiving
Routers do not recombine fragments. seconds to process a datagram from its
host to reassemble fragmented
datagrams. All fragments will contain The default MTU is 576 bytes and all queue. Once the datagram was
the same datagram identifier. routers must be able to handle that processed, the router would decrement
size transmission. By restricting the this field by the amount of time that
Flags: Three bits are reserved for flags
datagram to 576 bytes, it will never occurred. However, in practice, modern
but only two are used. The Don’t
need to be fragmented. Of course, routers are much faster then early routers
Fragment bit tells the router not to
that puts an undue restriction on the and usually process the datagram within
fragment the datagram. If this cannot be
Ethernet II network since packets can a second, but only decrement the field
done, an error message is returned.
be as long as 1500 bytes. So for local by one (the minimum amount). Therefore,
The More Fragments bit is used in the
networks set the maximum datagram the field has come to be treated as a hop
fragmentation process. A 1 means that
size to the local network’s MTU. If the counter. A hop being an instance of a
the datagram being sent is actually a
datagram is to be sent beyond the datagram being processed by a router.
fragment of a larger datagram. A 0
local network, set the maximum The originating host sets the Time to Live
means that either the datagram is not
datagram size to 576 bytes. For field and each router decreases it by one.
fragmented (first and only datagram) or
control networks, fragmentation may If a router decrements the count to zero,
it’s the last fragment. Receiving hosts
never be an issue since control it will discard the datagram and inform the
need this information in order to
information packets are usually short, originating host that the datagram failed
reassemble fragments.
not exceeding 256 or 512 bytes. to reach its destination.
Fragment Offset: Thirteen bits are Fragmentation should be avoided since Protocol: The eight-bit protocol field
used to indicate which fragment is it increases data latency and increases informs the upper layer protocol that the
being sent. Fragmentation is the the chances of a corrupted datagram received datagram is for its use. Usually,
process of breaking up large datagrams since multiple packets must be sent the upper layer protocol is TCP or UDP,
into manageable packets. per datagram. but there are other protocols as well that

November 2006 Page 4


IP (Internet Protocol) Info Sheet

could be sending and receiving data. The ARP Since it is a broadcast message, all hosts
protocol field provides this distinction. As mentioned before, the IP routes have the opportunity to learn the IP address
Header Checksum: The complete IP datagrams between source and destination and physical address pairing of the
header is checked fro integrity with the aid addresses in the form of packets over a requestor which can be appended to that
of the 16-bit header checksum. The data link layer. The data link does not host’s ARP table. Only the host with the
originating host applies the checksum and understand datagrams nor does it requested IP address responds to the ARP
all routers check the header for integrity understand IP addresses. It does know, request by providing its IP address and
and regenerate a new checksum when however, its own MAC address and physical address pairing. This message is
the datagram is resent. A new checksum knows how to communicate to other sent as a unicast message back to the
is required since the Time to Live field MAC addresses when told to do so. Somehow requestor. Once the physical address is
would have been changed by the router. we need to inform each host what IP known by the requestor, the datagram can
Finally, the checksum is again reconfirmed address its MAC address or physical be sent.
by the receiving host. address has been assigned, and we need SUMMARY
Source/Destination Address: The 32-bit to inform the same host all the other The IP is responsible for the end-to-end
source and destination addresses are physical address assignments on the local delivery of datagrams over an Internet. It
included in the header. These are the IP network in order to have communication. also provides host and network addressing
and not MAC addresses. Usually, the host IP address-physical and the means for fragmenting datagrams
IP Options: There may be no options in address assignment is stored in non- into manageable packets. IP is a routable
which case this field is null or there can be volatile memory or in a file. Using a 32-bit protocol and much of its complexity is due
options usually intended for router DIP switch for assignment is not to its ability to route packets directly within
use only. The option fields must be at least practical. Sometimes a serial port on the a local network or indirectly through
32-bits in length and must be padded to device is used for programming the IP routers. Routers are not ideal for a control
that amount if shorter. address, but once programmed, all other network since they reduce determinism
hosts on the local network must still need and increase data latency. Still to accept
to learn the assignment. TCP as a transport layer for an Ethernet
What Defines TCP/IP? The Address Resolution Protocol (ARP) is control network requires acceptance of
used for learning physical address IP as well. By understanding the
The TCP/IP stack and its limitations of IP, a control network can still
assignments. ARP has its own structure
associated protocols are described be designed using the TCP/IP family of
and does not use that of IP. ARP
in Request for Comments (RFCs). protocols. This is especially true if the
directly communicates to the data link
There are about 2700 RFCs in control network is restricted to that of a
layer and, therefore, must be aware of the
existence and unlike many private or local network.
various types of network adapters that
industrial control standards these
are available.
are free! You can simply download
them from the Internet. One When a host needs to send a datagram
possible location is http:www.ietf.org. to another host on a local network, it
Which RFCs do you need? Matthew first checks its ARP table to determine the
Naugle, in his book called Illustrated physical address for that IP destination
TCP/IP, suggests as mandatory address. If one is found, the datagram
reading RFCs 1122, 1123, and 1812. transmission proceeds. If none is found, an
These will give a good overview ARP request is made. An ARP request
but you can always seek out others consists of a broadcast message to all
one you find an index. You can hosts on the local network.
also author your own RFC by Within the ARP request is the originator’s
following the instructions and IP and physical addresses as well as the
format in RFC 1543. Most of the requested IP address.
RFCs originate from the working
groups (WGs) of the Internet REFERENCES
Engineering Task Force (IETF). Illustrated TCP/IP, Matthew Naugle, 1998, Wiley Computer Publishing
Some RFCs obsolete prior RFCs. Practical Networking with Ethernet, Charles E. Spurgeon, 1997,
If your control strategy is based upon International Thomson Computer Press
the TCP/IP protocol, it is International Standard ISO/IEC 8802-3 ANSI/IEEE std 802.3, 1996,
recommended that your document The Institute of Electrical and Electronic Engineers, Inc.
which RFCs are important to
TCP/IP Clearly Explained, Pete Loshin, 1997, Academic Press
your system.
TCP/IP Illustrated, Volume 1, The Protocols, W. Richard Stevens, 1994,
Addison-Wesley Publishing Company

November 2006 Page 5

You might also like