Quick viewing(Text Mode)

INTRODUCTION to the INTERNET PROTOCOL How Does IP Impact Control Networks? by George Thomas, Contemporary Controls

INTRODUCTION to the INTERNET PROTOCOL How Does IP Impact Control Networks? by George Thomas, Contemporary Controls

Volume 1 • Issue 4 Winter 1999

Introduction to Industrial , Part 2. Part 1 was featured in Issue 3, the Fall 1999. If you would like a copy, please send your request to EXTENSION [email protected] A Technical Supplement to control NETWORK

INTRODUCTION TO THE PROTOCOL How does IP impact control networks? By George Thomas, Contemporary Controls

Application FTP SMTP DNS SNMP DHCP INTRODUCTION Presentation Session The push to incorporate Industrial RIP Ethernet or even “plain vanilla” Ethernet into control networks Transport RTP Transmission User Diagram implies that by making that choice OSPF RTCP Control Protocol Protocol completes the selection process. As mentioned in a previous article, Ethernet II and IEEE 802.3 are IGMP ICMP strictly data which do not guarantee the deliv- Network ery of messages over a network or between networks. Protocol stacks ARP such as TCP/IP or SPX/IPX provide that functionality and without them Ethernet would be useless. With Data Link Ethernet ARCNET Token Ring FDDI the immense interest in the Physical Internet and the potential of at- taching control networks to the to guarantee the delivery of mes- Figure 1. The TCP/IP stack is actually a Internet, the of sages. Above TCP is the applica- set of protocols. IP resides at the choice is TCP/IP because it pro- of the OSI Reference tion layer. The services of the Model shown on the left. vides the foundation for the presentation and session layers of Internet. This article addresses the OSI Reference Model are in- lump these fields into Ethernet issues related to the IP portion of corporated into the application , data and trailer fields The the TCP/IP stack as it applies to layer. Therefore, the reference IP data sits above the data link control networks. model for TCP/IP-based systems layer and its data, called a data- actually consists of only five gram, is inserted into the data field layers. Technologies such as THE TCP/IP STACK of the . The data- Ethernet II and IEEE 802.3 reside gram has it own header and data Actually TCP/IP is a set of proto- at the lower data link and physical fields but no trailer field. Above cols defined by a series of RFCs layers of the same model. the IP layer is the () that have where TCP and User evolved over the years. In general Protocol (UDP) reside. Data from the Internet Protocol (IP) is used DATA ENCAPSULATION this layer is likewise applied to the to messages between net- The data sent over wires is repre- data portion of the IP datagram. works and, therefore, properly sented as frames. An Ethernet II TCP applies segments while UDP resides at the network layer of frame consists of a preamble, applies . Both TCP and the OSI Reference Model. source and destination addresses, UDP have headers as well. Finally Transmission Control Protocol type field, data field and a frame above the transport layer is the (TCP) sits on top of IP and is used sequence check field. You can which needs to

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- sponsibility of the transport layer TCP APPLICATION DATA HEADER and not the network layer to guar- TCP SEGMENT antee end-to-end message delivery. IP IP is simply responsible for the ad- IP TCP dressing and of datagrams. HEADER HEADER APPLICATION DATA

IP DATAGRAM ETHERNET DRIVER ROUTERS AND

ETHERNET IP TCP ETHERNET Unlike repeaters that operate at the HEADER HEADER HEADER APPLICATION DATA TRAILER ETHERNET and bridges that ETHERNET FRAME operate at the , routers operate at the network 46 TO 1500 BYTES layer. A 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 ) 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, between grams received from upper layer because IP is a routable protocol these applications will not be ef- . 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 . 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 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 attached to a local area address field into defined address of “11110.” network or a attached ranges for the netid and hostid. to a . 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 Network Address Host Address broadcast message to all hosts on Identifier that network while a host address Class A of all 0s is reserved to mean “this network.” Network address 127 is 7 bits of network address 24 bits of host address 0 also reserved and is used for loop- First byte Last three bytes Class B back testing. This effectively 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

110 21 bits of network address 8 bits of host address If the control network is to First three bytes Last byte Class D become part of the public Internet then strict adherence to the class 1110 address in the range of 224.0.0.0 - 239.255.255.255 addressing rules must be followed. Usually these addresses will be Class E issued by the corporate network 11110 Class E - Reserved for future use administrator or by an Internet Service Provider (ISP). But what if Figure 3. Address classes define the split mine the class. If the first bit of the control network is to become between network and host IDs. this byte is a ‘0’ then this is a class strictly a ? Cannot A address. In a class A address the any addressing scheme work? Yes, first byte identifies the network any address scheme could work The format of the address is and the remaining three bytes but there is even an RFC guideline but is shown as identifies the host. That means you for this situation. According to one 32-bit address split up as four can have 16,277,214 hosts for RFC 1918, only non-routable IP bytes. However, each byte is every network! addresses should be used. These

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 Class A : 1-127 returned. The More Fragments bit is 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. Class D : 224-239 larger datagram. A 0 means that 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 need this information in order to be quickly identified by observing only cannot exceed 65,535 bytes. This reassemble fragments. the first byte. 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 Maximum Transmission Unit (MTU) tion. An optional field can follow Datagram Identification: A and within a private or local the address information. The infor- unique 16-bit identifier assigned by network the MTU is known and mation in the header is as follows: the host will accompany the data- can be adhered to. The problem gram. This is necessary in order for occurs between networks. the receiving host to reassemble Version: A four-bit field identifies Intermediate networks may have a fragmented datagrams. All frag- the IP version. A 4 identifies IPv4 lesser MTU requiring the router to while a 6 identifies IPv6.

Vers Hlen Service Type Total Length Header Length: A four-bit field in- Identification Flags Fragment Offset dicates how many four-byte words Protocol Header Checksum are in the header. The header length cannot exceed 60 bytes Source IP address thereby allowing 40 bytes for Destination IP address options. IP Options (may be null) Padding IP Datagram Data (up to 65535 bytes) Type of Service: Of the eight-bit field only six bits are used. The

Delay bit indicates the datagram Type DA SA CRC should be processed with low 0800 IP Header and Data delay by the router. The Ethernet Data Field Throughput bit requests high throughput while the Reliability bit Figure 5. The IP datagram consisting of a requests high reliability. There are header and data is inserted into the Ethernet data field.

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 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 ! 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 IP header is checked for integrity http://www.ietf.org. Which RFCs do you offset, the source IP address and the fragments themselves, the com- with the aid of the 16-bit header need? Matthew Naugle, in his book plete datagram can be reassembled checksum. The originating host 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 resent. A new checksum is re- an index. You can also author your own routes to the intended destination and still be reassembled into the quired since the Time to Live field RFC by following the instructions and original datagram. would have been changed by the 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 MAC addresses. be the only documents available that that it would take a router one or 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 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.

Usually the host IP address-physi- SUMMARY cal address assignment is stored in The IP is responsible for the end- non-volatile memory or in a file. to-end delivery of datagrams over Using a 32-bit DIP switch for as- an internet. It also provides host signment is not practical. and network addressing and the Sometimes a serial port on the means for fragmenting datagrams device is used for programming into manageable packets. IP is a the IP address but once pro- routable protocol and much of its grammed all other hosts on the local network must still need to learn the assignment. REFERENCES Illustrated TCP/IP, Matthew Naugle, 1998, Wiley Publishing The Address Resolution Protocol (ARP) is used for learning physical Practical Networking With Ethernet, Charles E. Spurgeon, 1997, address assignments. ARP has its International Thomsom Computer Press own structure and does not use International Standard ISO/IEC 8802-3 ANSI/IEEE std 802.3, 1996, that of IP. ARP directly communi- The Institute of Electrical and Electronic Engineers, Inc. cates to the data link layer and, therefore, must be aware of the TCP/IP Clearly Explained, Pete Loshin, 1997, Academic Press various types of network adapters TCP/IP Illustrated, Volume 1, The Protocols, W. Richard Stevens, 1994, that are available. Addison-Wesley Publishing Company

www.ccontrols.com

6