1
2
3RFC:  791
4                                    
5                                    
6                                    
7                                    
8                                    
9                                    
10                                    
11                           INTERNET PROTOCOL
12                                    
13                                    
14                         DARPA INTERNET PROGRAM
15                                    
16                         PROTOCOL SPECIFICATION
17                                    
18                                    
19                                    
20                             September 1981
21
22
23
24
25
26
27
28
29
30
31
32
33
34                              prepared for
35
36               Defense Advanced Research Projects Agency
37                Information Processing Techniques Office
38                         1400 Wilson Boulevard
39                       Arlington, Virginia  22209
40
41
42
43
44
45
46
47                                   by
48
49                     Information Sciences Institute
50                   University of Southern California
51                           4676 Admiralty Way
52                   Marina del Rey, California  90291
53
54
55
56September 1981                                                          
57                                                       Internet Protocol
58
59
60
61                           TABLE OF CONTENTS
62
63    PREFACE ........................................................ iii
64
651.  INTRODUCTION ..................................................... 1
66
67  1.1  Motivation .................................................... 1
68  1.2  Scope ......................................................... 1
69  1.3  Interfaces .................................................... 1
70  1.4  Operation ..................................................... 2
71
722.  OVERVIEW ......................................................... 5
73
74  2.1  Relation to Other Protocols ................................... 9
75  2.2  Model of Operation ............................................ 5
76  2.3  Function Description .......................................... 7
77  2.4  Gateways ...................................................... 9
78
793.  SPECIFICATION ................................................... 11
80
81  3.1  Internet Header Format ....................................... 11
82  3.2  Discussion ................................................... 23
83  3.3  Interfaces ................................................... 31
84
85APPENDIX A:  Examples & Scenarios ................................... 34
86APPENDIX B:  Data Transmission Order ................................ 39
87
88GLOSSARY ............................................................ 41
89
90REFERENCES .......................................................... 45
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112                                                                [Page i]
113
114
115                                                          September 1981
116Internet Protocol
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171[Page ii]                                                               
172
173
174September 1981                                                          
175                                                       Internet Protocol
176
177
178
179                                PREFACE
180
181
182
183This document specifies the DoD Standard Internet Protocol.  This
184document is based on six earlier editions of the ARPA Internet Protocol
185Specification, and the present text draws heavily from them.  There have
186been many contributors to this work both in terms of concepts and in
187terms of text.  This edition revises aspects of addressing, error
188handling, option codes, and the security, precedence, compartments, and
189handling restriction features of the internet protocol.
190
191                                                           Jon Postel
192
193                                                           Editor
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230                                                              [Page iii]
231
232
233
234                                                          September 1981
235
236
237RFC:  791
238Replaces:  RFC 760
239IENs 128, 123, 111,
24080, 54, 44, 41, 28, 26
241
242                           INTERNET PROTOCOL
243
244                         DARPA INTERNET PROGRAM
245                         PROTOCOL SPECIFICATION
246
247
248
249                            1.  INTRODUCTION
250
2511.1.  Motivation
252
253  The Internet Protocol is designed for use in interconnected systems of
254  packet-switched computer communication networks.  Such a system has
255  been called a "catenet" [1].  The internet protocol provides for
256  transmitting blocks of data called datagrams from sources to
257  destinations, where sources and destinations are hosts identified by
258  fixed length addresses.  The internet protocol also provides for
259  fragmentation and reassembly of long datagrams, if necessary, for
260  transmission through "small packet" networks.
261
2621.2.  Scope
263
264  The internet protocol is specifically limited in scope to provide the
265  functions necessary to deliver a package of bits (an internet
266  datagram) from a source to a destination over an interconnected system
267  of networks.  There are no mechanisms to augment end-to-end data
268  reliability, flow control, sequencing, or other services commonly
269  found in host-to-host protocols.  The internet protocol can capitalize
270  on the services of its supporting networks to provide various types
271  and qualities of service.
272
2731.3.  Interfaces
274
275  This protocol is called on by host-to-host protocols in an internet
276  environment.  This protocol calls on local network protocols to carry
277  the internet datagram to the next gateway or destination host.
278
279  For example, a TCP module would call on the internet module to take a
280  TCP segment (including the TCP header and user data) as the data
281  portion of an internet datagram.  The TCP module would provide the
282  addresses and other parameters in the internet header to the internet
283  module as arguments of the call.  The internet module would then
284  create an internet datagram and call on the local network interface to
285  transmit the internet datagram.
286
287  In the ARPANET case, for example, the internet module would call on a
288
289
290                                                                [Page 1]
291
292
293                                                          September 1981
294Internet Protocol
295Introduction
296
297
298
299  local net module which would add the 1822 leader [2] to the internet
300  datagram creating an ARPANET message to transmit to the IMP.  The
301  ARPANET address would be derived from the internet address by the
302  local network interface and would be the address of some host in the
303  ARPANET, that host might be a gateway to other networks.
304
3051.4.  Operation
306
307  The internet protocol implements two basic functions:  addressing and
308  fragmentation.
309
310  The internet modules use the addresses carried in the internet header
311  to transmit internet datagrams toward their destinations.  The
312  selection of a path for transmission is called routing.
313
314  The internet modules use fields in the internet header to fragment and
315  reassemble internet datagrams when necessary for transmission through
316  "small packet" networks.
317
318  The model of operation is that an internet module resides in each host
319  engaged in internet communication and in each gateway that
320  interconnects networks.  These modules share common rules for
321  interpreting address fields and for fragmenting and assembling
322  internet datagrams.  In addition, these modules (especially in
323  gateways) have procedures for making routing decisions and other
324  functions.
325
326  The internet protocol treats each internet datagram as an independent
327  entity unrelated to any other internet datagram.  There are no
328  connections or logical circuits (virtual or otherwise).
329
330  The internet protocol uses four key mechanisms in providing its
331  service:  Type of Service, Time to Live, Options, and Header Checksum.
332
333  The Type of Service is used to indicate the quality of the service
334  desired.  The type of service is an abstract or generalized set of
335  parameters which characterize the service choices provided in the
336  networks that make up the internet.  This type of service indication
337  is to be used by gateways to select the actual transmission parameters
338  for a particular network, the network to be used for the next hop, or
339  the next gateway when routing an internet datagram.
340
341  The Time to Live is an indication of an upper bound on the lifetime of
342  an internet datagram.  It is set by the sender of the datagram and
343  reduced at the points along the route where it is processed.  If the
344  time to live reaches zero before the internet datagram reaches its
345  destination, the internet datagram is destroyed.  The time to live can
346  be thought of as a self destruct time limit.
347
348
349[Page 2]                                                                
350
351
352September 1981                                                          
353                                                       Internet Protocol
354                                                            Introduction
355
356
357
358  The Options provide for control functions needed or useful in some
359  situations but unnecessary for the most common communications.  The
360  options include provisions for timestamps, security, and special
361  routing.
362
363  The Header Checksum provides a verification that the information used
364  in processing internet datagram has been transmitted correctly.  The
365  data may contain errors.  If the header checksum fails, the internet
366  datagram is discarded at once by the entity which detects the error.
367
368  The internet protocol does not provide a reliable communication
369  facility.  There are no acknowledgments either end-to-end or
370  hop-by-hop.  There is no error control for data, only a header
371  checksum.  There are no retransmissions.  There is no flow control.
372
373  Errors detected may be reported via the Internet Control Message
374  Protocol (ICMP) [3] which is implemented in the internet protocol
375  module.
376
377  
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408                                                                [Page 3]
409
410
411                                                          September 1981
412Internet Protocol
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467[Page 4]                                                                
468
469
470September 1981                                                          
471                                                       Internet Protocol
472
473
474
475                              2.  OVERVIEW
476
4772.1.  Relation to Other Protocols
478
479  The following diagram illustrates the place of the internet protocol
480  in the protocol hierarchy:
481
482                                    
483                 +------+ +-----+ +-----+     +-----+  
484                 |Telnet| | FTP | | TFTP| ... | ... |  
485                 +------+ +-----+ +-----+     +-----+  
486                       |   |         |           |     
487                      +-----+     +-----+     +-----+  
488                      | TCP |     | UDP | ... | ... |  
489                      +-----+     +-----+     +-----+  
490                         |           |           |     
491                      +--------------------------+----+
492                      |    Internet Protocol & ICMP   |
493                      +--------------------------+----+
494                                     |                 
495                        +---------------------------+  
496                        |   Local Network Protocol  |  
497                        +---------------------------+  
498
499                         Protocol Relationships
500
501                               Figure 1.
502
503  Internet protocol interfaces on one side to the higher level
504  host-to-host protocols and on the other side to the local network
505  protocol.  In this context a "local network" may be a small network in
506  a building or a large network such as the ARPANET.
507
5082.2.  Model of Operation
509
510  The  model of operation for transmitting a datagram from one
511  application program to another is illustrated by the following
512  scenario:
513
514    We suppose that this transmission will involve one intermediate
515    gateway.
516
517    The sending application program prepares its data and calls on its
518    local internet module to send that data as a datagram and passes the
519    destination address and other parameters as arguments of the call.
520
521    The internet module prepares a datagram header and attaches the data
522    to it.  The internet module determines a local network address for
523    this internet address, in this case it is the address of a gateway.
524
525
526                                                                [Page 5]
527
528
529                                                          September 1981
530Internet Protocol
531Overview
532
533
534
535    It sends this datagram and the local network address to the local
536    network interface.
537
538    The local network interface creates a local network header, and
539    attaches the datagram to it, then sends the result via the local
540    network.
541
542    The datagram arrives at a gateway host wrapped in the local network
543    header, the local network interface strips off this header, and
544    turns the datagram over to the internet module.  The internet module
545    determines from the internet address that the datagram is to be
546    forwarded to another host in a second network.  The internet module
547    determines a local net address for the destination host.  It calls
548    on the local network interface for that network to send the
549    datagram.
550
551    This local network interface creates a local network header and
552    attaches the datagram sending the result to the destination host.
553
554    At this destination host the datagram is stripped of the local net
555    header by the local network interface and handed to the internet
556    module.
557
558    The internet module determines that the datagram is for an
559    application program in this host.  It passes the data to the
560    application program in response to a system call, passing the source
561    address and other parameters as results of the call.
562
563                                    
564   Application                                           Application
565   Program                                                   Program
566         \                                                   /      
567       Internet Module      Internet Module      Internet Module    
568             \                 /       \                /           
569             LNI-1          LNI-1      LNI-2         LNI-2          
570                \           /             \          /              
571               Local Network 1           Local Network 2            
572
573
574
575                            Transmission Path
576
577                                Figure 2
578
579
580
581
582
583
584
585[Page 6]                                                                
586
587
588September 1981                                                          
589                                                       Internet Protocol
590                                                                Overview
591
592
593
5942.3.  Function Description
595
596  The function or purpose of Internet Protocol is to move datagrams
597  through an interconnected set of networks.  This is done by passing
598  the datagrams from one internet module to another until the
599  destination is reached.  The internet modules reside in hosts and
600  gateways in the internet system.  The datagrams are routed from one
601  internet module to another through individual networks based on the
602  interpretation of an internet address.  Thus, one important mechanism
603  of the internet protocol is the internet address.
604
605  In the routing of messages from one internet module to another,
606  datagrams may need to traverse a network whose maximum packet size is
607  smaller than the size of the datagram.  To overcome this difficulty, a
608  fragmentation mechanism is provided in the internet protocol.
609
610  Addressing
611
612    A distinction is made between names, addresses, and routes [4].   A
613    name indicates what we seek.  An address indicates where it is.  A
614    route indicates how to get there.  The internet protocol deals
615    primarily with addresses.  It is the task of higher level (i.e.,
616    host-to-host or application) protocols to make the mapping from
617    names to addresses.   The internet module maps internet addresses to
618    local net addresses.  It is the task of lower level (i.e., local net
619    or gateways) procedures to make the mapping from local net addresses
620    to routes.
621
622    Addresses are fixed length of four octets (32 bits).  An address
623    begins with a network number, followed by local address (called the
624    "rest" field).  There are three formats or classes of internet
625    addresses:  in class a, the high order bit is zero, the next 7 bits
626    are the network, and the last 24 bits are the local address; in
627    class b, the high order two bits are one-zero, the next 14 bits are
628    the network and the last 16 bits are the local address; in class c,
629    the high order three bits are one-one-zero, the next 21 bits are the
630    network and the last 8 bits are the local address.
631
632    Care must be taken in mapping internet addresses to local net
633    addresses; a single physical host must be able to act as if it were
634    several distinct hosts to the extent of using several distinct
635    internet addresses.  Some hosts will also have several physical
636    interfaces (multi-homing).
637
638    That is, provision must be made for a host to have several physical
639    interfaces to the network with each having several logical internet
640    addresses.
641
642
643
644                                                                [Page 7]
645
646
647                                                          September 1981
648Internet Protocol
649Overview
650
651
652
653    Examples of address mappings may be found in "Address Mappings" [5].
654
655  Fragmentation
656
657    Fragmentation of an internet datagram is necessary when it
658    originates in a local net that allows a large packet size and must
659    traverse a local net that limits packets to a smaller size to reach
660    its destination.
661
662    An internet datagram can be marked "don't fragment."  Any internet
663    datagram so marked is not to be internet fragmented under any
664    circumstances.  If internet datagram marked don't fragment cannot be
665    delivered to its destination without fragmenting it, it is to be
666    discarded instead.
667
668    Fragmentation, transmission and reassembly across a local network
669    which is invisible to the internet protocol module is called
670    intranet fragmentation and may be used [6].
671
672    The internet fragmentation and reassembly procedure needs to be able
673    to break a datagram into an almost arbitrary number of pieces that
674    can be later reassembled.  The receiver of the fragments uses the
675    identification field to ensure that fragments of different datagrams
676    are not mixed.  The fragment offset field tells the receiver the
677    position of a fragment in the original datagram.  The fragment
678    offset and length determine the portion of the original datagram
679    covered by this fragment.  The more-fragments flag indicates (by
680    being reset) the last fragment.  These fields provide sufficient
681    information to reassemble datagrams.
682
683    The identification field is used to distinguish the fragments of one
684    datagram from those of another.  The originating protocol module of
685    an internet datagram sets the identification field to a value that
686    must be unique for that source-destination pair and protocol for the
687    time the datagram will be active in the internet system.  The
688    originating protocol module of a complete datagram sets the
689    more-fragments flag to zero and the fragment offset to zero.
690
691    To fragment a long internet datagram, an internet protocol module
692    (for example, in a gateway), creates two new internet datagrams and
693    copies the contents of the internet header fields from the long
694    datagram into both new internet headers.  The data of the long
695    datagram is divided into two portions on a 8 octet (64 bit) boundary
696    (the second portion might not be an integral multiple of 8 octets,
697    but the first must be).  Call the number of 8 octet blocks in the
698    first portion NFB (for Number of Fragment Blocks).  The first
699    portion of the data is placed in the first new internet datagram,
700    and the total length field is set to the length of the first
701
702
703[Page 8] 
704
705
706September 1981 
707                                                       Internet Protocol
708                                                                Overview
709
710
711
712    datagram.  The more-fragments flag is set to one.  The second
713    portion of the data is placed in the second new internet datagram,
714    and the total length field is set to the length of the second
715    datagram.  The more-fragments flag carries the same value as the
716    long datagram.  The fragment offset field of the second new internet
717    datagram is set to the value of that field in the long datagram plus
718    NFB.
719
720    This procedure can be generalized for an n-way split, rather than
721    the two-way split described.
722
723    To assemble the fragments of an internet datagram, an internet
724    protocol module (for example at a destination host) combines
725    internet datagrams that all have the same value for the four fields:
726    identification, source, destination, and protocol.  The combination
727    is done by placing the data portion of each fragment in the relative
728    position indicated by the fragment offset in that fragment's
729    internet header.  The first fragment will have the fragment offset
730    zero, and the last fragment will have the more-fragments flag reset
731    to zero.
732
7332.4.  Gateways
734
735  Gateways implement internet protocol to forward datagrams between
736  networks.  Gateways also implement the Gateway to Gateway Protocol
737  (GGP) [7] to coordinate routing and other internet control
738  information.
739
740  In a gateway the higher level protocols need not be implemented and
741  the GGP functions are added to the IP module.
742
743                                    
744                   +-------------------------------+   
745                   | Internet Protocol & ICMP & GGP|   
746                   +-------------------------------+   
747                           |                 |         
748                 +---------------+   +---------------+ 
749                 |   Local Net   |   |   Local Net   | 
750                 +---------------+   +---------------+ 
751
752                           Gateway Protocols
753
754                               Figure 3.
755
756  
757
758
759
760
761
762                                                                [Page 9]
763
764
765                                                          September 1981
766Internet Protocol
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821[Page 10]                                                               
822
823
824September 1981                                                          
825                                                       Internet Protocol
826
827
828
829                           3.  SPECIFICATION
830
8313.1.  Internet Header Format
832
833  A summary of the contents of the internet header follows:
834
835                                    
836    0                   1                   2                   3   
837    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
838   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
839   |Version|  IHL  |Type of Service|          Total Length         |
840   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
841   |         Identification        |Flags|      Fragment Offset    |
842   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
843   |  Time to Live |    Protocol   |         Header Checksum       |
844   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
845   |                       Source Address                          |
846   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
847   |                    Destination Address                        |
848   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
849   |                    Options                    |    Padding    |
850   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
851
852                    Example Internet Datagram Header
853
854                               Figure 4.
855
856  Note that each tick mark represents one bit position.
857
858  Version:  4 bits
859
860    The Version field indicates the format of the internet header.  This
861    document describes version 4.
862
863  IHL:  4 bits
864
865    Internet Header Length is the length of the internet header in 32
866    bit words, and thus points to the beginning of the data.  Note that
867    the minimum value for a correct header is 5.
868
869
870
871
872
873
874
875
876
877
878
879
880                                                               [Page 11]
881
882
883                                                          September 1981
884Internet Protocol
885Specification
886
887
888
889  Type of Service:  8 bits
890
891    The Type of Service provides an indication of the abstract
892    parameters of the quality of service desired.  These parameters are
893    to be used to guide the selection of the actual service parameters
894    when transmitting a datagram through a particular network.  Several
895    networks offer service precedence, which somehow treats high
896    precedence traffic as more important than other traffic (generally
897    by accepting only traffic above a certain precedence at time of high
898    load).  The major choice is a three way tradeoff between low-delay,
899    high-reliability, and high-throughput.
900
901      Bits 0-2:  Precedence.
902      Bit    3:  0 = Normal Delay,      1 = Low Delay.
903      Bits   4:  0 = Normal Throughput, 1 = High Throughput.
904      Bits   5:  0 = Normal Relibility, 1 = High Relibility.
905      Bit  6-7:  Reserved for Future Use.
906
907         0     1     2     3     4     5     6     7
908      +-----+-----+-----+-----+-----+-----+-----+-----+
909      |                 |     |     |     |     |     |
910      |   PRECEDENCE    |  D  |  T  |  R  |  0  |  0  |
911      |                 |     |     |     |     |     |
912      +-----+-----+-----+-----+-----+-----+-----+-----+
913
914        Precedence
915
916          111 - Network Control
917          110 - Internetwork Control
918          101 - CRITIC/ECP
919          100 - Flash Override
920          011 - Flash
921          010 - Immediate
922          001 - Priority
923          000 - Routine
924
925    The use of the Delay, Throughput, and Reliability indications may
926    increase the cost (in some sense) of the service.  In many networks
927    better performance for one of these parameters is coupled with worse
928    performance on another.  Except for very unusual cases at most two
929    of these three indications should be set.
930
931    The type of service is used to specify the treatment of the datagram
932    during its transmission through the internet system.  Example
933    mappings of the internet type of service to the actual service
934    provided on networks such as AUTODIN II, ARPANET, SATNET, and PRNET
935    is given in "Service Mappings" [8].
936
937
938
939[Page 12]                                                               
940
941
942September 1981                                                          
943                                                       Internet Protocol
944                                                           Specification
945
946
947
948    The Network Control precedence designation is intended to be used
949    within a network only.  The actual use and control of that
950    designation is up to each network. The Internetwork Control
951    designation is intended for use by gateway control originators only.
952    If the actual use of these precedence designations is of concern to
953    a particular network, it is the responsibility of that network to
954    control the access to, and use of, those precedence designations.
955
956  Total Length:  16 bits
957
958    Total Length is the length of the datagram, measured in octets,
959    including internet header and data.  This field allows the length of
960    a datagram to be up to 65,535 octets.  Such long datagrams are
961    impractical for most hosts and networks.  All hosts must be prepared
962    to accept datagrams of up to 576 octets (whether they arrive whole
963    or in fragments).  It is recommended that hosts only send datagrams
964    larger than 576 octets if they have assurance that the destination
965    is prepared to accept the larger datagrams.
966
967    The number 576 is selected to allow a reasonable sized data block to
968    be transmitted in addition to the required header information.  For
969    example, this size allows a data block of 512 octets plus 64 header
970    octets to fit in a datagram.  The maximal internet header is 60
971    octets, and a typical internet header is 20 octets, allowing a
972    margin for headers of higher level protocols.
973
974  Identification:  16 bits
975
976    An identifying value assigned by the sender to aid in assembling the
977    fragments of a datagram.
978
979  Flags:  3 bits
980
981    Various Control Flags.
982
983      Bit 0: reserved, must be zero
984      Bit 1: (DF) 0 = May Fragment,  1 = Don't Fragment.
985      Bit 2: (MF) 0 = Last Fragment, 1 = More Fragments.
986
987          0   1   2
988        +---+---+---+
989        |   | D | M |
990        | 0 | F | F |
991        +---+---+---+
992
993  Fragment Offset:  13 bits
994
995    This field indicates where in the datagram this fragment belongs.
996
997
998                                                               [Page 13]
999
1000
1001                                                          September 1981
1002Internet Protocol
1003Specification
1004
1005
1006
1007    The fragment offset is measured in units of 8 octets (64 bits).  The
1008    first fragment has offset zero.
1009
1010  Time to Live:  8 bits
1011
1012    This field indicates the maximum time the datagram is allowed to
1013    remain in the internet system.  If this field contains the value
1014    zero, then the datagram must be destroyed.  This field is modified
1015    in internet header processing.  The time is measured in units of
1016    seconds, but since every module that processes a datagram must
1017    decrease the TTL by at least one even if it process the datagram in
1018    less than a second, the TTL must be thought of only as an upper
1019    bound on the time a datagram may exist.  The intention is to cause
1020    undeliverable datagrams to be discarded, and to bound the maximum
1021    datagram lifetime.
1022
1023  Protocol:  8 bits
1024
1025    This field indicates the next level protocol used in the data
1026    portion of the internet datagram.  The values for various protocols
1027    are specified in "Assigned Numbers" [9].
1028
1029  Header Checksum:  16 bits
1030
1031    A checksum on the header only.  Since some header fields change
1032    (e.g., time to live), this is recomputed and verified at each point
1033    that the internet header is processed.
1034
1035    The checksum algorithm is:
1036
1037      The checksum field is the 16 bit one's complement of the one's
1038      complement sum of all 16 bit words in the header.  For purposes of
1039      computing the checksum, the value of the checksum field is zero.
1040
1041    This is a simple to compute checksum and experimental evidence
1042    indicates it is adequate, but it is provisional and may be replaced
1043    by a CRC procedure, depending on further experience.
1044
1045  Source Address:  32 bits
1046
1047    The source address.  See section 3.2.
1048
1049  Destination Address:  32 bits
1050
1051    The destination address.  See section 3.2.
1052
1053
1054
1055
1056
1057[Page 14]                                                               
1058
1059
1060September 1981                                                          
1061                                                       Internet Protocol
1062                                                           Specification
1063
1064
1065
1066  Options:  variable
1067
1068    The options may appear or not in datagrams.  They must be
1069    implemented by all IP modules (host and gateways).  What is optional
1070    is their transmission in any particular datagram, not their
1071    implementation.
1072
1073    In some environments the security option may be required in all
1074    datagrams.
1075
1076    The option field is variable in length.  There may be zero or more
1077    options.  There are two cases for the format of an option:
1078
1079      Case 1:  A single octet of option-type.
1080
1081      Case 2:  An option-type octet, an option-length octet, and the
1082               actual option-data octets.
1083
1084    The option-length octet counts the option-type octet and the
1085    option-length octet as well as the option-data octets.
1086
1087    The option-type octet is viewed as having 3 fields:
1088
1089      1 bit   copied flag,
1090      2 bits  option class,
1091      5 bits  option number.
1092
1093    The copied flag indicates that this option is copied into all
1094    fragments on fragmentation.
1095
1096      0 = not copied
1097      1 = copied
1098
1099    The option classes are:
1100
1101      0 = control
1102      1 = reserved for future use
1103      2 = debugging and measurement
1104      3 = reserved for future use
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116                                                               [Page 15]
1117
1118
1119                                                          September 1981
1120Internet Protocol
1121Specification
1122
1123
1124
1125    The following internet options are defined:
1126
1127      CLASS NUMBER LENGTH DESCRIPTION
1128      ----- ------ ------ -----------
1129        0     0      -    End of Option list.  This option occupies only
1130                          1 octet; it has no length octet.
1131        0     1      -    No Operation.  This option occupies only 1
1132                          octet; it has no length octet.
1133        0     2     11    Security.  Used to carry Security,
1134                          Compartmentation, User Group (TCC), and
1135                          Handling Restriction Codes compatible with DOD
1136                          requirements.
1137        0     3     var.  Loose Source Routing.  Used to route the
1138                          internet datagram based on information
1139                          supplied by the source.
1140        0     9     var.  Strict Source Routing.  Used to route the
1141                          internet datagram based on information
1142                          supplied by the source.
1143        0     7     var.  Record Route.  Used to trace the route an
1144                          internet datagram takes.
1145        0     8      4    Stream ID.  Used to carry the stream
1146                          identifier.
1147        2     4     var.  Internet Timestamp.
1148
1149      
1150
1151    Specific Option Definitions
1152
1153      End of Option List
1154
1155        +--------+
1156        |00000000|
1157        +--------+
1158          Type=0
1159
1160        This option indicates the end of the option list.  This might
1161        not coincide with the end of the internet header according to
1162        the internet header length.  This is used at the end of all
1163        options, not the end of each option, and need only be used if
1164        the end of the options would not otherwise coincide with the end
1165        of the internet header.
1166
1167        May be copied, introduced, or deleted on fragmentation, or for
1168        any other reason.
1169
1170
1171
1172
1173
1174
1175[Page 16]                                                               
1176
1177
1178September 1981                                                          
1179                                                       Internet Protocol
1180                                                           Specification
1181
1182
1183
1184      No Operation
1185
1186        +--------+
1187        |00000001|
1188        +--------+
1189          Type=1
1190
1191        This option may be used between options, for example, to align
1192        the beginning of a subsequent option on a 32 bit boundary.
1193
1194        May be copied, introduced, or deleted on fragmentation, or for
1195        any other reason.
1196
1197      Security
1198
1199        This option provides a way for hosts to send security,
1200        compartmentation, handling restrictions, and TCC (closed user
1201        group) parameters.  The format for this option is as follows:
1202
1203          +--------+--------+---//---+---//---+---//---+---//---+
1204          |10000010|00001011|SSS  SSS|CCC  CCC|HHH  HHH|  TCC   |
1205          +--------+--------+---//---+---//---+---//---+---//---+
1206           Type=130 Length=11
1207
1208        Security (S field):  16 bits
1209
1210          Specifies one of 16 levels of security (eight of which are
1211          reserved for future use).
1212
1213            00000000 00000000 - Unclassified
1214            11110001 00110101 - Confidential
1215            01111000 10011010 - EFTO
1216            10111100 01001101 - MMMM
1217            01011110 00100110 - PROG
1218            10101111 00010011 - Restricted
1219            11010111 10001000 - Secret
1220            01101011 11000101 - Top Secret
1221            00110101 11100010 - (Reserved for future use)
1222            10011010 11110001 - (Reserved for future use)
1223            01001101 01111000 - (Reserved for future use)
1224            00100100 10111101 - (Reserved for future use)
1225            00010011 01011110 - (Reserved for future use)
1226            10001001 10101111 - (Reserved for future use)
1227            11000100 11010110 - (Reserved for future use)
1228            11100010 01101011 - (Reserved for future use)
1229
1230
1231
1232
1233
1234                                                               [Page 17]
1235
1236
1237                                                          September 1981
1238Internet Protocol
1239Specification
1240
1241
1242
1243        Compartments (C field):  16 bits
1244
1245          An all zero value is used when the information transmitted is
1246          not compartmented.  Other values for the compartments field
1247          may be obtained from the Defense Intelligence Agency.
1248
1249        Handling Restrictions (H field):  16 bits
1250
1251          The values for the control and release markings are
1252          alphanumeric digraphs and are defined in the Defense
1253          Intelligence Agency Manual DIAM 65-19, "Standard Security
1254          Markings".
1255
1256        Transmission Control Code (TCC field):  24 bits
1257
1258          Provides a means to segregate traffic and define controlled
1259          communities of interest among subscribers. The TCC values are
1260          trigraphs, and are available from HQ DCA Code 530.
1261
1262        Must be copied on fragmentation.  This option appears at most
1263        once in a datagram.
1264
1265      Loose Source and Record Route
1266
1267        +--------+--------+--------+---------//--------+
1268        |10000011| length | pointer|     route data    |
1269        +--------+--------+--------+---------//--------+
1270         Type=131
1271
1272        The loose source and record route (LSRR) option provides a means
1273        for the source of an internet datagram to supply routing
1274        information to be used by the gateways in forwarding the
1275        datagram to the destination, and to record the route
1276        information.
1277
1278        The option begins with the option type code.  The second octet
1279        is the option length which includes the option type code and the
1280        length octet, the pointer octet, and length-3 octets of route
1281        data.  The third octet is the pointer into the route data
1282        indicating the octet which begins the next source address to be
1283        processed.  The pointer is relative to this option, and the
1284        smallest legal value for the pointer is 4.
1285
1286        A route data is composed of a series of internet addresses.
1287        Each internet address is 32 bits or 4 octets.  If the pointer is
1288        greater than the length, the source route is empty (and the
1289        recorded route full) and the routing is to be based on the
1290        destination address field.
1291
1292
1293[Page 18]                                                               
1294
1295
1296September 1981                                                          
1297                                                       Internet Protocol
1298                                                           Specification
1299
1300
1301
1302        If the address in destination address field has been reached and
1303        the pointer is not greater than the length, the next address in
1304        the source route replaces the address in the destination address
1305        field, and the recorded route address replaces the source
1306        address just used, and pointer is increased by four.
1307
1308        The recorded route address is the internet module's own internet
1309        address as known in the environment into which this datagram is
1310        being forwarded.
1311
1312        This procedure of replacing the source route with the recorded
1313        route (though it is in the reverse of the order it must be in to
1314        be used as a source route) means the option (and the IP header
1315        as a whole) remains a constant length as the datagram progresses
1316        through the internet.
1317
1318        This option is a loose source route because the gateway or host
1319        IP is allowed to use any route of any number of other
1320        intermediate gateways to reach the next address in the route.
1321
1322        Must be copied on fragmentation.  Appears at most once in a
1323        datagram.
1324
1325      Strict Source and Record Route
1326
1327        +--------+--------+--------+---------//--------+
1328        |10001001| length | pointer|     route data    |
1329        +--------+--------+--------+---------//--------+
1330         Type=137
1331
1332        The strict source and record route (SSRR) option provides a
1333        means for the source of an internet datagram to supply routing
1334        information to be used by the gateways in forwarding the
1335        datagram to the destination, and to record the route
1336        information.
1337
1338        The option begins with the option type code.  The second octet
1339        is the option length which includes the option type code and the
1340        length octet, the pointer octet, and length-3 octets of route
1341        data.  The third octet is the pointer into the route data
1342        indicating the octet which begins the next source address to be
1343        processed.  The pointer is relative to this option, and the
1344        smallest legal value for the pointer is 4.
1345
1346        A route data is composed of a series of internet addresses.
1347        Each internet address is 32 bits or 4 octets.  If the pointer is
1348        greater than the length, the source route is empty (and the
1349
1350
1351
1352                                                               [Page 19]
1353
1354
1355                                                          September 1981
1356Internet Protocol
1357Specification
1358
1359
1360
1361        recorded route full) and the routing is to be based on the
1362        destination address field.
1363
1364        If the address in destination address field has been reached and
1365        the pointer is not greater than the length, the next address in
1366        the source route replaces the address in the destination address
1367        field, and the recorded route address replaces the source
1368        address just used, and pointer is increased by four.
1369
1370        The recorded route address is the internet module's own internet
1371        address as known in the environment into which this datagram is
1372        being forwarded.
1373
1374        This procedure of replacing the source route with the recorded
1375        route (though it is in the reverse of the order it must be in to
1376        be used as a source route) means the option (and the IP header
1377        as a whole) remains a constant length as the datagram progresses
1378        through the internet.
1379
1380        This option is a strict source route because the gateway or host
1381        IP must send the datagram directly to the next address in the
1382        source route through only the directly connected network
1383        indicated in the next address to reach the next gateway or host
1384        specified in the route.
1385
1386        Must be copied on fragmentation.  Appears at most once in a
1387        datagram.
1388
1389      Record Route
1390
1391        +--------+--------+--------+---------//--------+
1392        |00000111| length | pointer|     route data    |
1393        +--------+--------+--------+---------//--------+
1394          Type=7
1395
1396        The record route option provides a means to record the route of
1397        an internet datagram.
1398
1399        The option begins with the option type code.  The second octet
1400        is the option length which includes the option type code and the
1401        length octet, the pointer octet, and length-3 octets of route
1402        data.  The third octet is the pointer into the route data
1403        indicating the octet which begins the next area to store a route
1404        address.  The pointer is relative to this option, and the
1405        smallest legal value for the pointer is 4.
1406
1407        A recorded route is composed of a series of internet addresses.
1408        Each internet address is 32 bits or 4 octets.  If the pointer is
1409
1410
1411[Page 20]                                                               
1412
1413
1414September 1981                                                          
1415                                                       Internet Protocol
1416                                                           Specification
1417
1418
1419
1420        greater than the length, the recorded route data area is full.
1421        The originating host must compose this option with a large
1422        enough route data area to hold all the address expected.  The
1423        size of the option does not change due to adding addresses.  The
1424        intitial contents of the route data area must be zero.
1425
1426        When an internet module routes a datagram it checks to see if
1427        the record route option is present.  If it is, it inserts its
1428        own internet address as known in the environment into which this
1429        datagram is being forwarded into the recorded route begining at
1430        the octet indicated by the pointer, and increments the pointer
1431        by four.
1432
1433        If the route data area is already full (the pointer exceeds the
1434        length) the datagram is forwarded without inserting the address
1435        into the recorded route.  If there is some room but not enough
1436        room for a full address to be inserted, the original datagram is
1437        considered to be in error and is discarded.  In either case an
1438        ICMP parameter problem message may be sent to the source
1439        host [3].
1440
1441        Not copied on fragmentation, goes in first fragment only.
1442        Appears at most once in a datagram.
1443
1444      Stream Identifier
1445
1446        +--------+--------+--------+--------+
1447        |10001000|00000010|    Stream ID    |
1448        +--------+--------+--------+--------+
1449         Type=136 Length=4
1450
1451        This option provides a way for the 16-bit SATNET stream
1452        identifier to be carried through networks that do not support
1453        the stream concept.
1454
1455        Must be copied on fragmentation.  Appears at most once in a
1456        datagram.
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470                                                               [Page 21]
1471
1472
1473                                                          September 1981
1474Internet Protocol
1475Specification
1476
1477
1478
1479      Internet Timestamp
1480
1481        +--------+--------+--------+--------+
1482        |01000100| length | pointer|oflw|flg|
1483        +--------+--------+--------+--------+
1484        |         internet address          |
1485        +--------+--------+--------+--------+
1486        |             timestamp             |
1487        +--------+--------+--------+--------+
1488        |                 .                 |
1489                          .
1490                          .
1491        Type = 68
1492
1493        The Option Length is the number of octets in the option counting
1494        the type, length, pointer, and overflow/flag octets (maximum
1495        length 40).
1496
1497        The Pointer is the number of octets from the beginning of this
1498        option to the end of timestamps plus one (i.e., it points to the
1499        octet beginning the space for next timestamp).  The smallest
1500        legal value is 5.  The timestamp area is full when the pointer
1501        is greater than the length.
1502
1503        The Overflow (oflw) [4 bits] is the number of IP modules that
1504        cannot register timestamps due to lack of space.
1505
1506        The Flag (flg) [4 bits] values are
1507
1508          0 -- time stamps only, stored in consecutive 32-bit words,
1509
1510          1 -- each timestamp is preceded with internet address of the
1511               registering entity,
1512
1513          3 -- the internet address fields are prespecified.  An IP
1514               module only registers its timestamp if it matches its own
1515               address with the next specified internet address.
1516
1517        The Timestamp is a right-justified, 32-bit timestamp in
1518        milliseconds since midnight UT.  If the time is not available in
1519        milliseconds or cannot be provided with respect to midnight UT
1520        then any time may be inserted as a timestamp provided the high
1521        order bit of the timestamp field is set to one to indicate the
1522        use of a non-standard value.
1523
1524        The originating host must compose this option with a large
1525        enough timestamp data area to hold all the timestamp information
1526        expected.  The size of the option does not change due to adding
1527
1528
1529[Page 22]                                                               
1530
1531
1532September 1981                                                          
1533                                                       Internet Protocol
1534                                                           Specification
1535
1536
1537
1538        timestamps.  The intitial contents of the timestamp data area
1539        must be zero or internet address/zero pairs.
1540
1541        If the timestamp data area is already full (the pointer exceeds
1542        the length) the datagram is forwarded without inserting the
1543        timestamp, but the overflow count is incremented by one.
1544
1545        If there is some room but not enough room for a full timestamp
1546        to be inserted, or the overflow count itself overflows, the
1547        original datagram is considered to be in error and is discarded.
1548        In either case an ICMP parameter problem message may be sent to
1549        the source host [3].
1550
1551        The timestamp option is not copied upon fragmentation.  It is
1552        carried in the first fragment.  Appears at most once in a
1553        datagram.
1554
1555  Padding:  variable
1556
1557    The internet header padding is used to ensure that the internet
1558    header ends on a 32 bit boundary.  The padding is zero.
1559
15603.2.  Discussion
1561
1562  The implementation of a protocol must be robust.  Each implementation
1563  must expect to interoperate with others created by different
1564  individuals.  While the goal of this specification is to be explicit
1565  about the protocol there is the possibility of differing
1566  interpretations.  In general, an implementation must be conservative
1567  in its sending behavior, and liberal in its receiving behavior.  That
1568  is, it must be careful to send well-formed datagrams, but must accept
1569  any datagram that it can interpret (e.g., not object to technical
1570  errors where the meaning is still clear).
1571
1572  The basic internet service is datagram oriented and provides for the
1573  fragmentation of datagrams at gateways, with reassembly taking place
1574  at the destination internet protocol module in the destination host.
1575  Of course, fragmentation and reassembly of datagrams within a network
1576  or by private agreement between the gateways of a network is also
1577  allowed since this is transparent to the internet protocols and the
1578  higher-level protocols.  This transparent type of fragmentation and
1579  reassembly is termed "network-dependent" (or intranet) fragmentation
1580  and is not discussed further here.
1581
1582  Internet addresses distinguish sources and destinations to the host
1583  level and provide a protocol field as well.  It is assumed that each
1584  protocol will provide for whatever multiplexing is necessary within a
1585  host.
1586
1587
1588                                                               [Page 23]
1589
1590
1591                                                          September 1981
1592Internet Protocol
1593Specification
1594
1595
1596
1597  Addressing
1598
1599    To provide for flexibility in assigning address to networks and
1600    allow for the  large number of small to intermediate sized networks
1601    the interpretation of the address field is coded to specify a small
1602    number of networks with a large number of host, a moderate number of
1603    networks with a moderate number of hosts, and a large number of
1604    networks with a small number of hosts.  In addition there is an
1605    escape code for extended addressing mode.
1606
1607    Address Formats:
1608
1609      High Order Bits   Format                           Class
1610      ---------------   -------------------------------  -----
1611            0            7 bits of net, 24 bits of host    a
1612            10          14 bits of net, 16 bits of host    b
1613            110         21 bits of net,  8 bits of host    c
1614            111         escape to extended addressing mode
1615
1616      A value of zero in the network field means this network.  This is
1617      only used in certain ICMP messages.  The extended addressing mode
1618      is undefined.  Both of these features are reserved for future use.
1619
1620    The actual values assigned for network addresses is given in
1621    "Assigned Numbers" [9].
1622
1623    The local address, assigned by the local network, must allow for a
1624    single physical host to act as several distinct internet hosts.
1625    That is, there must be a mapping between internet host addresses and
1626    network/host interfaces that allows several internet addresses to
1627    correspond to one interface.  It must also be allowed for a host to
1628    have several physical interfaces and to treat the datagrams from
1629    several of them as if they were all addressed to a single host.
1630
1631    Address mappings between internet addresses and addresses for
1632    ARPANET, SATNET, PRNET, and other networks are described in "Address
1633    Mappings" [5].
1634
1635  Fragmentation and Reassembly.
1636
1637    The internet identification field (ID) is used together with the
1638    source and destination address, and the protocol fields, to identify
1639    datagram fragments for reassembly.
1640
1641    The More Fragments flag bit (MF) is set if the datagram is not the
1642    last fragment.  The Fragment Offset field identifies the fragment
1643    location, relative to the beginning of the original unfragmented
1644    datagram.  Fragments are counted in units of 8 octets.  The
1645
1646
1647[Page 24]                                                               
1648
1649
1650September 1981                                                          
1651                                                       Internet Protocol
1652                                                           Specification
1653
1654
1655
1656    fragmentation strategy is designed so than an unfragmented datagram
1657    has all zero fragmentation information (MF = 0, fragment offset =
1658    0).  If an internet datagram is fragmented, its data portion must be
1659    broken on 8 octet boundaries.
1660
1661    This format allows 2**13 = 8192 fragments of 8 octets each for a
1662    total of 65,536 octets.  Note that this is consistent with the the
1663    datagram total length field (of course, the header is counted in the
1664    total length and not in the fragments).
1665
1666    When fragmentation occurs, some options are copied, but others
1667    remain with the first fragment only.
1668
1669    Every internet module must be able to forward a datagram of 68
1670    octets without further fragmentation.  This is because an internet
1671    header may be up to 60 octets, and the minimum fragment is 8 octets.
1672
1673    Every internet destination must be able to receive a datagram of 576
1674    octets either in one piece or in fragments to be reassembled.
1675
1676    The fields which may be affected by fragmentation include:
1677
1678      (1) options field
1679      (2) more fragments flag
1680      (3) fragment offset
1681      (4) internet header length field
1682      (5) total length field
1683      (6) header checksum
1684
1685    If the Don't Fragment flag (DF) bit is set, then internet
1686    fragmentation of this datagram is NOT permitted, although it may be
1687    discarded.  This can be used to prohibit fragmentation in cases
1688    where the receiving host does not have sufficient resources to
1689    reassemble internet fragments.
1690
1691    One example of use of the Don't Fragment feature is to down line
1692    load a small host.  A small host could have a boot strap program
1693    that accepts a datagram stores it in memory and then executes it.
1694
1695    The fragmentation and reassembly procedures are most easily
1696    described by examples.  The following procedures are example
1697    implementations.
1698
1699    General notation in the following pseudo programs: "=<" means "less
1700    than or equal", "#" means "not equal", "=" means "equal", "<-" means
1701    "is set to".  Also, "x to y" includes x and excludes y; for example,
1702    "4 to 7" would include 4, 5, and 6 (but not 7).
1703
1704
1705
1706                                                               [Page 25]
1707
1708
1709                                                          September 1981
1710Internet Protocol
1711Specification
1712
1713
1714
1715    An Example Fragmentation Procedure
1716
1717      The maximum sized datagram that can be transmitted through the
1718      next network is called the maximum transmission unit (MTU).
1719
1720      If the total length is less than or equal the maximum transmission
1721      unit then submit this datagram to the next step in datagram
1722      processing; otherwise cut the datagram into two fragments, the
1723      first fragment being the maximum size, and the second fragment
1724      being the rest of the datagram.  The first fragment is submitted
1725      to the next step in datagram processing, while the second fragment
1726      is submitted to this procedure in case it is still too large.
1727
1728      Notation:
1729
1730        FO    -  Fragment Offset
1731        IHL   -  Internet Header Length
1732        DF    -  Don't Fragment flag
1733        MF    -  More Fragments flag
1734        TL    -  Total Length
1735        OFO   -  Old Fragment Offset
1736        OIHL  -  Old Internet Header Length
1737        OMF   -  Old More Fragments flag
1738        OTL   -  Old Total Length
1739        NFB   -  Number of Fragment Blocks
1740        MTU   -  Maximum Transmission Unit
1741
1742      Procedure:
1743
1744        IF TL =< MTU THEN Submit this datagram to the next step
1745             in datagram processing ELSE IF DF = 1 THEN discard the
1746        datagram ELSE
1747        To produce the first fragment:
1748        (1)  Copy the original internet header;
1749        (2)  OIHL <- IHL; OTL <- TL; OFO <- FO; OMF <- MF;
1750        (3)  NFB <- (MTU-IHL*4)/8;
1751        (4)  Attach the first NFB*8 data octets;
1752        (5)  Correct the header:
1753             MF <- 1;  TL <- (IHL*4)+(NFB*8);
1754             Recompute Checksum;
1755        (6)  Submit this fragment to the next step in
1756             datagram processing;
1757        To produce the second fragment:
1758        (7)  Selectively copy the internet header (some options
1759             are not copied, see option definitions);
1760        (8)  Append the remaining data;
1761        (9)  Correct the header:
1762             IHL <- (((OIHL*4)-(length of options not copied))+3)/4;
1763
1764
1765[Page 26]                                                               
1766
1767
1768September 1981                                                          
1769                                                       Internet Protocol
1770                                                           Specification
1771
1772
1773
1774             TL <- OTL - NFB*8 - (OIHL-IHL)*4);
1775             FO <- OFO + NFB;  MF <- OMF;  Recompute Checksum;
1776        (10) Submit this fragment to the fragmentation test; DONE.
1777
1778      In the above procedure each fragment (except the last) was made
1779      the maximum allowable size.  An alternative might produce less
1780      than the maximum size datagrams.  For example, one could implement
1781      a fragmentation procedure that repeatly divided large datagrams in
1782      half until the resulting fragments were less than the maximum
1783      transmission unit size.
1784
1785    An Example Reassembly Procedure
1786
1787      For each datagram the buffer identifier is computed as the
1788      concatenation of the source, destination, protocol, and
1789      identification fields.  If this is a whole datagram (that is both
1790      the fragment offset and the more fragments  fields are zero), then
1791      any reassembly resources associated with this buffer identifier
1792      are released and the datagram is forwarded to the next step in
1793      datagram processing.
1794
1795      If no other fragment with this buffer identifier is on hand then
1796      reassembly resources are allocated.  The reassembly resources
1797      consist of a data buffer, a header buffer, a fragment block bit
1798      table, a total data length field, and a timer.  The data from the
1799      fragment is placed in the data buffer according to its fragment
1800      offset and length, and bits are set in the fragment block bit
1801      table corresponding to the fragment blocks received.
1802
1803      If this is the first fragment (that is the fragment offset is
1804      zero)  this header is placed in the header buffer.  If this is the
1805      last fragment ( that is the more fragments field is zero) the
1806      total data length is computed.  If this fragment completes the
1807      datagram (tested by checking the bits set in the fragment block
1808      table), then the datagram is sent to the next step in datagram
1809      processing; otherwise the timer is set to the maximum of the
1810      current timer value and the value of the time to live field from
1811      this fragment; and the reassembly routine gives up control.
1812
1813      If the timer runs out, the all reassembly resources for this
1814      buffer identifier are released.  The initial setting of the timer
1815      is a lower bound on the reassembly waiting time.  This is because
1816      the waiting time will be increased if the Time to Live in the
1817      arriving fragment is greater than the current timer value but will
1818      not be decreased if it is less.  The maximum this timer value
1819      could reach is the maximum time to live (approximately 4.25
1820      minutes).  The current recommendation for the initial timer
1821      setting is 15 seconds.  This may be changed as experience with
1822
1823
1824                                                               [Page 27]
1825
1826
1827                                                          September 1981
1828Internet Protocol
1829Specification
1830
1831
1832
1833      this protocol accumulates.  Note that the choice of this parameter
1834      value is related to the buffer capacity available and the data
1835      rate of the transmission medium; that is, data rate times timer
1836      value equals buffer size (e.g., 10Kb/s X 15s = 150Kb).
1837
1838      Notation:
1839
1840        FO    -  Fragment Offset
1841        IHL   -  Internet Header Length
1842        MF    -  More Fragments flag
1843        TTL   -  Time To Live
1844        NFB   -  Number of Fragment Blocks
1845        TL    -  Total Length
1846        TDL   -  Total Data Length
1847        BUFID -  Buffer Identifier
1848        RCVBT -  Fragment Received Bit Table
1849        TLB   -  Timer Lower Bound
1850
1851      Procedure:
1852
1853        (1)  BUFID <- source|destination|protocol|identification;
1854        (2)  IF FO = 0 AND MF = 0
1855        (3)     THEN IF buffer with BUFID is allocated
1856        (4)             THEN flush all reassembly for this BUFID;
1857        (5)          Submit datagram to next step; DONE.
1858        (6)     ELSE IF no buffer with BUFID is allocated
1859        (7)             THEN allocate reassembly resources
1860                             with BUFID;
1861                             TIMER <- TLB; TDL <- 0;
1862        (8)          put data from fragment into data buffer with
1863                     BUFID from octet FO*8 to
1864                                         octet (TL-(IHL*4))+FO*8;
1865        (9)          set RCVBT bits from FO
1866                                        to FO+((TL-(IHL*4)+7)/8);
1867        (10)         IF MF = 0 THEN TDL <- TL-(IHL*4)+(FO*8)
1868        (11)         IF FO = 0 THEN put header in header buffer
1869        (12)         IF TDL # 0
1870        (13)          AND all RCVBT bits from 0
1871                                             to (TDL+7)/8 are set
1872        (14)            THEN TL <- TDL+(IHL*4)
1873        (15)                 Submit datagram to next step;
1874        (16)                 free all reassembly resources
1875                             for this BUFID; DONE.
1876        (17)         TIMER <- MAX(TIMER,TTL);
1877        (18)         give up until next fragment or timer expires;
1878        (19) timer expires: flush all reassembly with this BUFID; DONE.
1879
1880      In the case that two or more fragments contain the same data
1881
1882
1883[Page 28]                                                               
1884
1885
1886September 1981                                                          
1887                                                       Internet Protocol
1888                                                           Specification
1889
1890
1891
1892      either identically or through a partial overlap, this procedure
1893      will use the more recently arrived copy in the data buffer and
1894      datagram delivered.
1895
1896  Identification
1897
1898    The choice of the Identifier for a datagram is based on the need to
1899    provide a way to uniquely identify the fragments of a particular
1900    datagram.  The protocol module assembling fragments judges fragments
1901    to belong to the same datagram if they have the same source,
1902    destination, protocol, and Identifier.  Thus, the sender must choose
1903    the Identifier to be unique for this source, destination pair and
1904    protocol for the time the datagram (or any fragment of it) could be
1905    alive in the internet.
1906
1907    It seems then that a sending protocol module needs to keep a table
1908    of Identifiers, one entry for each destination it has communicated
1909    with in the last maximum packet lifetime for the internet.
1910
1911    However, since the Identifier field allows 65,536 different values,
1912    some host may be able to simply use unique identifiers independent
1913    of destination.
1914
1915    It is appropriate for some higher level protocols to choose the
1916    identifier. For example, TCP protocol modules may retransmit an
1917    identical TCP segment, and the probability for correct reception
1918    would be enhanced if the retransmission carried the same identifier
1919    as the original transmission since fragments of either datagram
1920    could be used to construct a correct TCP segment.
1921
1922  Type of Service
1923
1924    The type of service (TOS) is for internet service quality selection.
1925    The type of service is specified along the abstract parameters
1926    precedence, delay, throughput, and reliability.  These abstract
1927    parameters are to be mapped into the actual service parameters of
1928    the particular networks the datagram traverses.
1929
1930    Precedence.  An independent measure of the importance of this
1931    datagram.
1932
1933    Delay.  Prompt delivery is important for datagrams with this
1934    indication.
1935
1936    Throughput.  High data rate is important for datagrams with this
1937    indication.
1938
1939
1940
1941
1942                                                               [Page 29]
1943
1944
1945                                                          September 1981
1946Internet Protocol
1947Specification
1948
1949
1950
1951    Reliability.  A higher level of effort to ensure delivery is
1952    important for datagrams with this indication.
1953
1954    For example, the ARPANET has a priority bit, and a choice between
1955    "standard" messages (type 0) and "uncontrolled" messages (type 3),
1956    (the choice between single packet and multipacket messages can also
1957    be considered a service parameter). The uncontrolled messages tend
1958    to be less reliably delivered and suffer less delay.  Suppose an
1959    internet datagram is to be sent through the ARPANET.  Let the
1960    internet type of service be given as:
1961
1962      Precedence:    5
1963      Delay:         0
1964      Throughput:    1
1965      Reliability:   1
1966
1967    In this example, the mapping of these parameters to those available
1968    for the ARPANET would be  to set the ARPANET priority bit on since
1969    the Internet precedence is in the upper half of its range, to select
1970    standard messages since the throughput and reliability requirements
1971    are indicated and delay is not.  More details are given on service
1972    mappings in "Service Mappings" [8].
1973
1974  Time to Live
1975
1976    The time to live is set by the sender to the maximum time the
1977    datagram is allowed to be in the internet system.  If the datagram
1978    is in the internet system longer than the time to live, then the
1979    datagram must be destroyed.
1980
1981    This field must be decreased at each point that the internet header
1982    is processed to reflect the time spent processing the datagram.
1983    Even if no local information is available on the time actually
1984    spent, the field must be decremented by 1.  The time is measured in
1985    units of seconds (i.e. the value 1 means one second).  Thus, the
1986    maximum time to live is 255 seconds or 4.25 minutes.  Since every
1987    module that processes a datagram must decrease the TTL by at least
1988    one even if it process the datagram in less than a second, the TTL
1989    must be thought of only as an upper bound on the time a datagram may
1990    exist.  The intention is to cause undeliverable datagrams to be
1991    discarded, and to bound the maximum datagram lifetime.
1992
1993    Some higher level reliable connection protocols are based on
1994    assumptions that old duplicate datagrams will not arrive after a
1995    certain time elapses.  The TTL is a way for such protocols to have
1996    an assurance that their assumption is met.
1997
1998
1999
2000
2001[Page 30]                                                               
2002
2003
2004September 1981                                                          
2005                                                       Internet Protocol
2006                                                           Specification
2007
2008
2009
2010  Options
2011
2012    The options are optional in each datagram, but required in
2013    implementations.  That is, the presence or absence of an option is
2014    the choice of the sender, but each internet module must be able to
2015    parse every option.  There can be several options present in the
2016    option field.
2017
2018    The options might not end on a 32-bit boundary.  The internet header
2019    must be filled out with octets of zeros.  The first of these would
2020    be interpreted as the end-of-options option, and the remainder as
2021    internet header padding.
2022
2023    Every internet module must be able to act on every option.  The
2024    Security Option is required if classified, restricted, or
2025    compartmented traffic is to be passed.
2026
2027  Checksum
2028
2029    The internet header checksum is recomputed if the internet header is
2030    changed.  For example, a reduction of the time to live, additions or
2031    changes to internet options, or due to fragmentation.  This checksum
2032    at the internet level is intended to protect the internet header
2033    fields from transmission errors.
2034
2035    There are some applications where a few data bit errors are
2036    acceptable while retransmission delays are not.  If the internet
2037    protocol enforced data correctness such applications could not be
2038    supported.
2039
2040  Errors
2041
2042    Internet protocol errors may be reported via the ICMP messages [3].
2043
20443.3.  Interfaces
2045
2046  The functional description of user interfaces to the IP is, at best,
2047  fictional, since every operating system will have different
2048  facilities.  Consequently, we must warn readers that different IP
2049  implementations may have different user interfaces.  However, all IPs
2050  must provide a certain minimum  set of services to guarantee that all
2051  IP implementations can support the same protocol hierarchy.  This
2052  section specifies the functional interfaces required of all IP
2053  implementations.
2054
2055  Internet protocol interfaces on one side to the local network and on
2056  the other side to either a higher level protocol or an application
2057  program.  In the following, the higher level protocol or application
2058
2059
2060                                                               [Page 31]
2061
2062
2063                                                          September 1981
2064Internet Protocol
2065Specification
2066
2067
2068
2069  program (or even a gateway program) will be called the "user" since it
2070  is using the internet module.  Since internet protocol is a datagram
2071  protocol, there is minimal memory or state maintained between datagram
2072  transmissions, and each call on the internet protocol module by the
2073  user supplies all information necessary for the IP to perform the
2074  service requested.
2075
2076  An Example Upper Level Interface
2077
2078  The following two example calls satisfy the requirements for the user
2079  to internet protocol module communication ("=>" means returns):
2080
2081  SEND (src, dst, prot, TOS, TTL, BufPTR, len, Id, DF, opt => result)
2082
2083    where:
2084
2085      src = source address
2086      dst = destination address
2087      prot = protocol
2088      TOS = type of service
2089      TTL = time to live
2090      BufPTR = buffer pointer
2091      len = length of buffer
2092      Id  = Identifier
2093      DF = Don't Fragment
2094      opt = option data
2095      result = response
2096        OK = datagram sent ok
2097        Error = error in arguments or local network error
2098
2099    Note that the precedence is included in the TOS and the
2100    security/compartment is passed as an option.
2101
2102  RECV (BufPTR, prot, => result, src, dst, TOS, len, opt)
2103
2104    where:
2105
2106      BufPTR = buffer pointer
2107      prot = protocol
2108      result = response
2109        OK = datagram received ok
2110        Error = error in arguments
2111      len = length of buffer
2112      src = source address
2113      dst = destination address
2114      TOS = type of service
2115      opt = option data
2116
2117
2118
2119[Page 32]                                                               
2120
2121
2122September 1981                                                          
2123                                                       Internet Protocol
2124                                                           Specification
2125
2126
2127
2128  When the user sends a datagram, it executes the SEND call supplying
2129  all the arguments.  The internet protocol module, on receiving this
2130  call, checks the arguments and prepares and sends the message.  If the
2131  arguments are good and the datagram is accepted by the local network,
2132  the call returns successfully.  If either the arguments are bad, or
2133  the datagram is not accepted by the local network, the call returns
2134  unsuccessfully.  On unsuccessful returns, a reasonable report must be
2135  made as to the cause of the problem, but the details of such reports
2136  are up to individual implementations.
2137
2138  When a datagram arrives at the internet protocol module from the local
2139  network, either there is a pending RECV call from the user addressed
2140  or there is not.  In the first case, the pending call is satisfied by
2141  passing the information from the datagram to the user.  In the second
2142  case, the user addressed is notified of a pending datagram.  If the
2143  user addressed does not exist, an ICMP error message is returned to
2144  the sender, and the data is discarded.
2145
2146  The notification of a user may be via a pseudo interrupt or similar
2147  mechanism, as appropriate in the particular operating system
2148  environment of the implementation.
2149
2150  A user's RECV call may then either be immediately satisfied by a
2151  pending datagram, or the call may be pending until a datagram arrives.
2152
2153  The source address is included in the send call in case the sending
2154  host has several addresses (multiple physical connections or logical
2155  addresses).  The internet module must check to see that the source
2156  address is one of the legal address for this host.
2157
2158  An implementation may also allow or require a call to the internet
2159  module to indicate interest in or reserve exclusive use of a class of
2160  datagrams (e.g., all those with a certain value in the protocol
2161  field).
2162
2163  This section functionally characterizes a USER/IP interface.  The
2164  notation used is similar to most procedure of function calls in high
2165  level languages, but this usage is not meant to rule out trap type
2166  service calls (e.g., SVCs, UUOs, EMTs), or any other form of
2167  interprocess communication.
2168
2169  
2170
2171
2172
2173
2174
2175
2176
2177
2178                                                               [Page 33]
2179
2180
2181                                                          September 1981
2182Internet Protocol
2183
2184
2185
2186APPENDIX A:  Examples & Scenarios
2187
2188Example 1:
2189
2190  This is an example of the minimal data carrying internet datagram:
2191
2192                                    
2193    0                   1                   2                   3   
2194    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
2195   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2196   |Ver= 4 |IHL= 5 |Type of Service|        Total Length = 21      |
2197   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2198   |      Identification = 111     |Flg=0|   Fragment Offset = 0   |
2199   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2200   |   Time = 123  |  Protocol = 1 |        header checksum        |
2201   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2202   |                         source address                        |
2203   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2204   |                      destination address                      |
2205   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2206   |     data      |                                                
2207   +-+-+-+-+-+-+-+-+                                                
2208
2209                       Example Internet Datagram
2210
2211                               Figure 5.
2212
2213  Note that each tick mark represents one bit position.
2214
2215  This is a internet datagram in version 4 of internet protocol; the
2216  internet header consists of five 32 bit words, and the total length of
2217  the datagram is 21 octets.  This datagram is a complete datagram (not
2218  a fragment).
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237[Page 34]                                                               
2238
2239
2240September 1981                                                          
2241                                                       Internet Protocol
2242
2243
2244
2245Example 2:
2246
2247  In this example, we show first a moderate size internet datagram (452
2248  data octets), then two internet fragments that might result from the
2249  fragmentation of this datagram if the maximum sized transmission
2250  allowed were 280 octets.
2251
2252                                    
2253    0                   1                   2                   3   
2254    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
2255   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2256   |Ver= 4 |IHL= 5 |Type of Service|       Total Length = 472      |
2257   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2258   |     Identification = 111      |Flg=0|     Fragment Offset = 0 |
2259   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2260   |   Time = 123  | Protocol = 6  |        header checksum        |
2261   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2262   |                         source address                        |
2263   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2264   |                      destination address                      |
2265   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2266   |                             data                              |
2267   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2268   |                             data                              |
2269   \                                                               \
2270   \                                                               \
2271   |                             data                              |
2272   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2273   |             data              |                                
2274   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                
2275
2276                       Example Internet Datagram
2277
2278                               Figure 6.
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296                                                               [Page 35]
2297
2298
2299                                                          September 1981
2300Internet Protocol
2301
2302
2303
2304  Now the first fragment that results from splitting the datagram after
2305  256 data octets.
2306
2307                                    
2308    0                   1                   2                   3   
2309    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
2310   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2311   |Ver= 4 |IHL= 5 |Type of Service|       Total Length = 276      |
2312   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2313   |     Identification = 111      |Flg=1|     Fragment Offset = 0 |
2314   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2315   |   Time = 119  | Protocol = 6  |        Header Checksum        |
2316   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2317   |                         source address                        |
2318   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2319   |                      destination address                      |
2320   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2321   |                             data                              |
2322   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2323   |                             data                              |
2324   \                                                               \
2325   \                                                               \
2326   |                             data                              |
2327   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2328   |                             data                              |
2329   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2330
2331                       Example Internet Fragment
2332
2333                               Figure 7.
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355[Page 36]                                                               
2356
2357
2358September 1981                                                          
2359                                                       Internet Protocol
2360
2361
2362
2363  And the second fragment.
2364
2365                                    
2366    0                   1                   2                   3   
2367    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
2368   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2369   |Ver= 4 |IHL= 5 |Type of Service|       Total Length = 216      |
2370   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2371   |     Identification = 111      |Flg=0|  Fragment Offset  =  32 |
2372   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2373   |   Time = 119  | Protocol = 6  |        Header Checksum        |
2374   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2375   |                         source address                        |
2376   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2377   |                      destination address                      |
2378   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2379   |                             data                              |
2380   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2381   |                             data                              |
2382   \                                                               \
2383   \                                                               \
2384   |                             data                              |
2385   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2386   |            data               |                                
2387   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                
2388
2389                       Example Internet Fragment
2390
2391                               Figure 8.
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414                                                               [Page 37]
2415
2416
2417                                                          September 1981
2418Internet Protocol
2419
2420
2421
2422Example 3:
2423
2424  Here, we show an example of a datagram containing options:
2425
2426                                    
2427    0                   1                   2                   3   
2428    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
2429   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2430   |Ver= 4 |IHL= 8 |Type of Service|       Total Length = 576      |
2431   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2432   |       Identification = 111    |Flg=0|     Fragment Offset = 0 |
2433   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2434   |   Time = 123  |  Protocol = 6 |       Header Checksum         |
2435   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2436   |                        source address                         |
2437   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2438   |                      destination address                      |
2439   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2440   | Opt. Code = x | Opt.  Len.= 3 | option value  | Opt. Code = x |
2441   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2442   | Opt. Len. = 4 |           option value        | Opt. Code = 1 |
2443   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2444   | Opt. Code = y | Opt. Len. = 3 |  option value | Opt. Code = 0 |
2445   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2446   |                             data                              |
2447   \                                                               \
2448   \                                                               \
2449   |                             data                              |
2450   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2451   |                             data                              |
2452   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2453
2454                       Example Internet Datagram
2455
2456                               Figure 9.
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473[Page 38]                                                               
2474
2475
2476September 1981                                                          
2477                                                       Internet Protocol
2478
2479
2480
2481APPENDIX B:  Data Transmission Order
2482
2483The order of transmission of the header and data described in this
2484document is resolved to the octet level.  Whenever a diagram shows a
2485group of octets, the order of transmission of those octets is the normal
2486order in which they are read in English.  For example, in the following
2487diagram the octets are transmitted in the order they are numbered.
2488
2489                                    
2490    0                   1                   2                   3   
2491    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
2492   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2493   |       1       |       2       |       3       |       4       |
2494   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2495   |       5       |       6       |       7       |       8       |
2496   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2497   |       9       |      10       |      11       |      12       |
2498   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2499
2500                      Transmission Order of Bytes
2501
2502                               Figure 10.
2503
2504Whenever an octet represents a numeric quantity the left most bit in the
2505diagram is the high order or most significant bit.  That is, the bit
2506labeled 0 is the most significant bit.  For example, the following
2507diagram represents the value 170 (decimal).
2508
2509                                    
2510                            0 1 2 3 4 5 6 7 
2511                           +-+-+-+-+-+-+-+-+
2512                           |1 0 1 0 1 0 1 0|
2513                           +-+-+-+-+-+-+-+-+
2514
2515                          Significance of Bits
2516
2517                               Figure 11.
2518
2519Similarly, whenever a multi-octet field represents a numeric quantity
2520the left most bit of the whole field is the most significant bit.  When
2521a multi-octet quantity is transmitted the most significant octet is
2522transmitted first.
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532                                                               [Page 39]
2533
2534
2535                                                          September 1981
2536Internet Protocol
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591[Page 40]                                                               
2592
2593
2594September 1981                                                          
2595                                                       Internet Protocol
2596
2597
2598
2599                                GLOSSARY
2600
2601
2602
26031822
2604          BBN Report 1822, "The Specification of the Interconnection of
2605          a Host and an IMP".  The specification of interface between a
2606          host and the ARPANET.
2607
2608ARPANET leader
2609          The control information on an ARPANET message at the host-IMP
2610          interface.
2611
2612ARPANET message
2613          The unit of transmission between a host and an IMP in the
2614          ARPANET.  The maximum size is about 1012 octets (8096 bits).
2615
2616ARPANET packet
2617          A unit of transmission used internally in the ARPANET between
2618          IMPs. The maximum size is about 126 octets (1008 bits).
2619
2620Destination
2621          The destination address, an internet header field.
2622
2623DF
2624          The Don't Fragment bit carried in the flags field.
2625
2626Flags
2627          An internet header field carrying various control flags.
2628
2629Fragment Offset
2630          This internet header field indicates where in the internet
2631          datagram a fragment belongs.
2632
2633GGP
2634          Gateway to Gateway Protocol, the protocol used primarily
2635          between gateways to control routing and other gateway
2636          functions.
2637
2638header
2639          Control information at the beginning of a message, segment,
2640          datagram, packet or block of data.
2641
2642ICMP
2643          Internet Control Message Protocol, implemented in the internet
2644          module, the ICMP is used from gateways to hosts and between
2645          hosts to report errors and make routing suggestions.
2646
2647
2648
2649
2650                                                               [Page 41]
2651
2652
2653                                                          September 1981
2654Internet Protocol
2655Glossary
2656
2657
2658
2659Identification
2660          An internet header field carrying the identifying value
2661          assigned by the sender to aid in assembling the fragments of a
2662          datagram.
2663
2664IHL
2665          The internet header field Internet Header Length is the length
2666          of the internet header measured in 32 bit words.
2667
2668IMP
2669          The Interface Message Processor, the packet switch of the
2670          ARPANET.
2671
2672Internet Address
2673          A four octet (32 bit) source or destination address consisting
2674          of a Network field and a Local Address field.
2675
2676internet datagram
2677          The unit of data exchanged between a pair of internet modules
2678          (includes the internet header).
2679
2680internet fragment
2681          A portion of the data of an internet datagram with an internet
2682          header.
2683
2684Local Address
2685          The address of a host within a network.  The actual mapping of
2686          an internet local address on to the host addresses in a
2687          network is quite general, allowing for many to one mappings.
2688
2689MF
2690          The More-Fragments Flag carried in the internet header flags
2691          field.
2692
2693module
2694          An implementation, usually in software, of a protocol or other
2695          procedure.
2696
2697more-fragments flag
2698          A flag indicating whether or not this internet datagram
2699          contains the end of an internet datagram, carried in the
2700          internet header Flags field.
2701
2702NFB
2703          The Number of Fragment Blocks in a the data portion of an
2704          internet fragment.  That is, the length of a portion of data
2705          measured in 8 octet units.
2706
2707
2708
2709[Page 42]                                                               
2710
2711
2712September 1981                                                          
2713                                                       Internet Protocol
2714                                                                Glossary
2715
2716
2717
2718octet
2719          An eight bit byte.
2720
2721Options
2722          The internet header Options field may contain several options,
2723          and each option may be several octets in length.
2724
2725Padding
2726          The internet header Padding field is used to ensure that the
2727          data begins on 32 bit word boundary.  The padding is zero.
2728
2729Protocol
2730          In this document, the next higher level protocol identifier,
2731          an internet header field.
2732
2733Rest
2734          The local address portion of an Internet Address.
2735
2736Source
2737          The source address, an internet header field.
2738
2739TCP
2740          Transmission Control Protocol:  A host-to-host protocol for
2741          reliable communication in internet environments.
2742
2743TCP Segment
2744          The unit of data exchanged between TCP modules (including the
2745          TCP header).
2746
2747TFTP
2748          Trivial File Transfer Protocol:  A simple file transfer
2749          protocol built on UDP.
2750
2751Time to Live
2752          An internet header field which indicates the upper bound on
2753          how long this internet datagram may exist.
2754
2755TOS
2756          Type of Service
2757
2758Total Length
2759          The internet header field Total Length is the length of the
2760          datagram in octets including internet header and data.
2761
2762TTL
2763          Time to Live
2764
2765
2766
2767
2768                                                               [Page 43]
2769
2770
2771                                                          September 1981
2772Internet Protocol
2773Glossary
2774
2775
2776
2777Type of Service
2778          An internet header field which indicates the type (or quality)
2779          of service for this internet datagram.
2780
2781UDP
2782          User Datagram Protocol:  A user level protocol for transaction
2783          oriented applications.
2784
2785User
2786          The user of the internet protocol.  This may be a higher level
2787          protocol module, an application program, or a gateway program.
2788
2789Version
2790          The Version field indicates the format of the internet header.
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827[Page 44]                                                               
2828
2829
2830September 1981                                                          
2831                                                       Internet Protocol
2832
2833
2834
2835                               REFERENCES
2836
2837
2838
2839[1]  Cerf, V., "The Catenet Model for Internetworking," Information
2840     Processing Techniques Office, Defense Advanced Research Projects
2841     Agency, IEN 48, July 1978.
2842
2843[2]  Bolt Beranek and Newman, "Specification for the Interconnection of
2844     a Host and an IMP," BBN Technical Report 1822, Revised May 1978.
2845
2846[3]  Postel, J., "Internet Control Message Protocol - DARPA Internet
2847     Program Protocol Specification," RFC 792, USC/Information Sciences
2848     Institute, September 1981.
2849
2850[4]  Shoch, J., "Inter-Network Naming, Addressing, and Routing,"
2851     COMPCON, IEEE Computer Society, Fall 1978.
2852
2853[5]  Postel, J., "Address Mappings," RFC 796, USC/Information Sciences
2854     Institute, September 1981.
2855
2856[6]  Shoch, J., "Packet Fragmentation in Inter-Network Protocols,"
2857     Computer Networks, v. 3, n. 1, February 1979.
2858
2859[7]  Strazisar, V., "How to Build a Gateway", IEN 109, Bolt Beranek and
2860     Newman, August 1979.
2861
2862[8]  Postel, J., "Service Mappings," RFC 795, USC/Information Sciences
2863     Institute, September 1981.
2864
2865[9]  Postel, J., "Assigned Numbers," RFC 790, USC/Information Sciences
2866     Institute, September 1981.
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886                                                               [Page 45]
2887
2888