Jamsa Chapter 4 - Understanding the Internet Protocol

All sorts of protocols except Address Reference Protocols are encapsulated inside an IP datagram.

 

Internet Addresses. Actually they're IP addreses. IP addresses are associated with interface cards, not the host computer. But we often speak as though the computer owns the address.

 IP addresses are expressed as four bytes, either in hex or dotted-decimal, such as 134.24.8.66.

 Originally, 134 was the network address and the lower 3 bytes identified a computer. This only worked when there were <=255 networks. (FF means "broadcast.")

 Now, the high order bits identify an address class, as follows:

 
 
Class High Order Bits Bytes for Net-ID
A 0 - - - - 1
B 1 0 - - - 2
C 1 1 0 - - 3
D 1 1 1 0 - (multicasting)
E 1 1 1 1 0 (reserved for future)
Class A:
1 bit 7 bits 24 bits
0 Network ID Host ID
Actually there is a bit less than a byte of space available for the network ID; we can only identify 127 Class A networks. Only networks that need to attach more than 2**16 hosts need a Class A address. Their first octet (byte) will be named 00 up to 126.

 

Class B:
 
2 bits 14 bits 16 bits
10 Network ID Host ID
Class B addreses can connect up to 16,384 networks, each could have 65,536 hosts. Class B can be recognized with first octet between 128 and 191 (=128 + 64 -1). Class B is reserved for networks expected to have at least 256 host computers.

 

Class C:
3 bits 21 bits 8 bits
110 Network ID Host ID
So, the Internet can support about 2 million individual Class C networks, but each will have less than 256 hosts. Class C addresses' first octet falls between 192 and 223.

 

Class D and Class E.
D is used for multicast addresses, which is to say for instance "all Rotary Club Members". Of course we can't just do a worldwide broadcast and have individual interfaces reject those it isn't interested in; the implementation must be more structured than that. More later, maybe.

 E is reserved for future expansion.

 Reflections on Addresses. Two million networks: enough?

 Well, they would be small ones. The more likely bottleneck will occur at Class B, because any decent sized business needs a Class B, and it's not at all unlikely that there are more than 16,000 businesses or equivalent governmental entities that will want a network in the next few years.

 Large providers will need Class A, and there are only a few of these; so I conjecture that a stop-gap will be that large providers will get several class B's or a whole bunch of C's issued to them.

 Internet Network Information Center (InterNIC) assigns unique network ID numbers. Local administrators assign host ID numbers. Often they effectively 'recurse' on the Internet strategy by creating sub-networks.

 Multicasting. Regular transmission is "unicasting". Multicasting refers to a host group. The Internet Group Management Protocol (IGMP) is used.
Example multicast addresses:

 224.0.1.1 - Network Time Protocol

 Internet Assigned Number Authority (IANA) assigns some multicast addresses as well-known addresses, designating a permanent host group.

 Address Protocols: Address Resolution Protocol and RARP.

 ARP translates 32 bit Internet addresses into 48 bit Ethernet (or other "link layer") addresses; RARP does the reverse. ARP uses the link layer's broadcast capability to query the net and identify who's currently linked up. It asks them what they think their IP address is, and caches the information for later use. Namely, when an IP datagram arrives, the router translates its address into a link layer address and sends it on along.

 

The IP Datagram

Also Known as the IP Packet. Technically, a packet is a bunch of data where as a datagram is a delivery service.

 Data enroute from the application layer to the transport layer is called an application message. It is probably embodied as a parameter value or an array of data being pointed to in a procedure-call.

 When it's flowing from TCP into the network layer it's called a TCP segment (because TCP is a byte-stream delivery service) or sometimes a transport message. If using UDP, we'd encounter a UDP datagram.

When it comes out of IP headed for the hardware, it's an IP Packet.

 The IP Header.

Almost always 20 bytes wide; thought of as 4 32-bit words. It contains the following information.

 VERS: Version number. 4 bits. Whew! But we're only up to version 4, so I guess 4 bits will be enough for a while.

 HLEN: Header length. 4 bits. Normally this says '5' for 5 32 bit words.

TOS: Type of Service. 8 bits, defining service performance.

 
Bits 0-2 3 4 5 6 7
Precedence Delay Throughput Reliability Cost Unused
Precedence is usually ignored. Someday it may be used to distinguish control information from data. The rest are also usually ignored, but could be important when realt-time systems are being designed - IF you can be sure that the routers in between, attend to these bits!

 Delay=1: minimize delays. e. g. Telnet.
Throughput=1: maximize throughput. e. g. FTP.
Reliability=1: maximize reliability. e. g. SNMP (network management)
Cost=1: minimize cost. e. g. Usenet news groups.

 Packet Length, including the packet header, in bytes.

 Identification and Flags and Fragment Offset are used to reassemble fragements of datagrams.

 Time-to-Live (TTL) tells how long the packet can live on the network; i. e. when it becomes 'stale' and useless. Every router decrements TTL by one, plus the number of seconds the packet waited inside the router's buffer. If TTL reaches zero, TCP/IP destroys the packet and notifies the sending host, via ICMP.

 Most folks set TTL to 30 before shipping them.

Protocol is an 8 bit field which indicates which protocol generated the data within the packet. This guides the choice of transport module at the network layer.

 
Protocol Decimal Binary
ICMP 1 00000001
IGMP 2 00000010
TCP 6 00000110
UDP 17 00010001
Header Checksum performs the obvious function. It's a 16 bit number for the IP header fields only. TCP/IP stores the 1's complement of the sum of the header viewed as 16 bit numbers, excluding the checksum (which is treated as containing 0.) Upon receipt this is recalculated including the checksum; the total should add to all 1's. If an invalid packet is received, it is discarded.

 Source and Destination IP addresses (each 32 bits) never change, no matter how many hops the packet takes.

 IP Options - this field of 8 bits is for testing and debugging. They are rarely used.

 Fragmentation

 Technologies such as Ethernet specify a Maximum Transfer Unit (MTU) which is the largest packet size the physical network will be asked to transmit. Anything larger must be broken down.

For reasons of time, we will not describe this section about implementation (pages 94-98).

 Consequences of Fragmentation. Because multiple packets are involved, the probability of failure increases. Also some time cost is incurred by fragmentation.

 Avoiding fragmentation. The default MTU used by TCP is 576 bytes, allowing for 512 bytes of data plus the TCP and IP headers, etc.

IP Routing

An IP Routing Table stores addresses for selected destinations on the network. Routing tables contain the addresses of networks, not host computers. Routing is not controllable by the applications designer.

To get information to a destination, a given router can either perform Direct Delivery (if it knows that the host is in an immediately connected network) or Indirect Delivery (if it knows which adjacent net is best able to pass the information onward.)

 Each entry in a routing table contains three fields: Network destination, Gateway and Flags. The Network field is the "input" - this is the field which must match the destination address. The Gateway and Flags fields are the "output" - the answer to the question "what do I do next?"

 Direct Delivery. If the Flags field indicates a direct connection, then the network will translate the destination IP address into a link layer address (e. g. Ethernet), using the Address Resolution Protocol; encapsulate the data into a data frame and transmit it directly to its destination.

 At the end of every journey is a direct delivery. The mailman puts the letter in your box.

 Indirect Delivery. If an indirect connection was indicated by the routing table, the link layer translation still has to occur but the destination will be the next direct connection along the pathway - i. e. the address of the next router in the chain.

 

Mini-Quiz for Chapters 3 and 4.

1. Briefly summarize the essential differences between TCP and IP.

 2. Describe how successive layers "encapsulate" data from higher layers. Why does every layer add a header, but only Ethernet adds a trailer? The answer is not explicitly stated in these Notes (or in the text, chapters 1..4) but you can deduce it from information you have so far.

 3. Internet addresses are 32 bits long. Does this mean that the Internet can have essentially 2**32 computers on it before we run out of usable address space? If not, why not?

 4. Explain "Time to Live." Does Live rhyme with Jive in this sentence?

 Continue to Chapter 5.

 Return to the Table of Contents for these Lecture Notes.