Google
 

Wednesday, February 27, 2008

Transport Layer Concepts

important concepts:

  • Connection-oriented and connectionless protocols

  • Ports and sockets

  • Multiplexing

Connection-Oriented and Connectionless Protocols

  • A connection-oriented protocol establishes and maintains a connection between communicating computers and monitors the state of that connection over the course of the transmission. In other words, each package of data sent across the network receives an acknowledgment, and the sending machine records status information to ensure that each package is received without errors, retransmitting the data if necessary. At the end of the transmission, the sending and receiving computers gracefully close the connection.

  • A connectionless protocol sends a one-way datagram to the destination and doesn't worry about officially notifying the destination machine that data is on the way. The destination machine receives the data and doesn't worry about returning status information to the source computer.

Introducing the Transport Layer

Transport layer protocols to provide the following:

  • An interface for network applications— that is, a way for applications to access the network. The designers wanted to be able to target data not just to a destination computer, but to a particular application running on the destination computer.

  • A mechanism for multiplexing/demultiplexing. Multiplexing, in this case, means accepting data from different applications and computers and directing that data to the intended recipient application on the receiving computer. In other words, the Transport layer must be capable of simultaneously supporting several network applications and managing the flow of data to the Internet layer. On the receiving end, the Transport layer must accept the data from the Internet layer and direct it to multiple applications. This feature, known as demultiplexing, allows one computer to simultaneously support multiple network applications, such as a Web browser, an email client, and a file-sharing application. Another aspect of multiplexing/demultiplexing is that a single application can simultaneously maintain connections with more than one computer.

  • Error checking, flow control, and verification. The protocol system needs an overall scheme that ensures delivery of data between the sending and receiving machines.

Classless Internet Domain Routing


Class A addresses are long gone, and the world is quickly running out of Class B addresses. Many Class C addresses are still available, but the small address space of a Class C network (254 hosts maximum) is a severe limitation in the high-volume game of Internet service providers (ISPs). It is possible to assign a range of Class C networks to a network owner who needs more than 254 addresses. However, treating multiple Class C networks as separate entities when they are all going to the same place only clutters up routing tables unnecessarily.

Classless Internet Domain Routing (CIDR) is a technique that allows a block of network IDs to be treated as a single entity in routing tables. CIDR groups a range of network IDs into a single address entry using what is called a supernet mask. You can think of a supernet mask as something like the opposite of a subnet mask. Instead of designating additional bits for identifying the network, the supernet mask in effect takes bits away from the network ID. The addresses in the range are therefore identified by the network address bits that the networks in the range hold in common. For example, an ISP might be assigned all Class C addresses in the range

204.21.128.0 (11001100000101011000000000000000)

to 204.21.255.255 (11001100000101011111111111111111).

In this case, the network addresses are identical up to the seventeenth bit counting from the left. The supernet mask would therefore be 11111111111111111000000000000000, which is equivalent to the dotted decimal mask 255.255.128.0.

The address block is specified using the lowest address in the range followed by the supernet mask. A common notation for a CIDR address/mask pair is to show the number of mask bits after the address with a slash (/) separator. Hence, the CIDR range in the preceding example would be specified as 204.21.128.0/17.

Subnet Mask Dotted Notation

Description

Dotted Notation

Binary Pattern

Class A

Default Mask

255.0.0.0

11111111 00000000 00000000 00000000

1 subnet bit

255.128.0.0

11111111 10000000 00000000 00000000

2 subnet bits

255.192.0.0

11111111 11000000 00000000 00000000

3 subnet bits

255.224.0.0

11111111 11100000 00000000 00000000

4 subnet bits

255.240.0.0

11111111 11110000 00000000 00000000

5 subnet bits

255.248.0.0

11111111 11111000 00000000 00000000

6 subnet bits

255.252.0.0

11111111 11111100 00000000 00000000

7 subnet bits

255.254.0.0

11111111 11111110 00000000 00000000

8 subnet bits

255.255.0.0

11111111 11111111 00000000 00000000

9 subnet bits

255.255.128.0

11111111 11111111 10000000 00000000

10 subnet bits

255.255.192.0

11111111 11111111 11000000 00000000

11 subnet bits

255.255.224.0

11111111 11111111 11100000 00000000

12 subnet bits

255.255.240.0

11111111 11111111 11110000 00000000

13 subnet bits

255.255.248 0

11111111 11111111 11111000 00000000

14 subnet bits

255.255.252.0

11111111 11111111 11111100 00000000

15 subnet bits

255.255.254.0

11111111 11111111 11111110 00000000

16 subnet bits

255.255.255.0

11111111 11111111 11111111 00000000

17 subnet bits

255.255.255.128

11111111 11111111 11111111 10000000

18 subnet bits

255.255.255.192

11111111 11111111 11111111 11000000

19 subnet bits

255.255.255.224

11111111 11111111 11111111 11100000

20 subnet bits

255.255.255.240

11111111 11111111 11111111 11110000

21 subnet bits

255.255.255.248

11111111 11111111 11111111 11111000

22 subnet bits

255.255.255.252

11111111 11111111 11111111 11111100

Class B

Default Mask

255.255.0.0

11111111 11111111 00000000 00000000

1 subnet bit

255.255.128.0

11111111 11111111 10000000 00000000

2 subnet bits

255.255.192.0

11111111 11111111 11000000 00000000

3 subnet bits

255.255.224.0

11111111 11111111 11100000 00000000

4 subnet bits

255.255.240.0

11111111 11111111 11110000 00000000

5 subnet bits

255.255.248.0

11111111 11111111 11111000 00000000

6 subnet bits

255.255.252.0

11111111 11111111 11111100 00000000

7 subnet bits

255.255.254.0

11111111 11111111 11111110 00000000

8 subnet bits

255.255.255.0

11111111 11111111 11111111 00000000

9 subnet bits

255.255.255.128

11111111 11111111 11111111 10000000

10 subnet bits

255.255.255.192

11111111 11111111 11111111 11000000

11 subnet bits

255.255.255.224

11111111 11111111 11111111 11100000

12 subnet bits

255.255.255.240

11111111 11111111 11111111 11110000

13 subnet bits

255.255.255.248

11111111 11111111 11111111 11111000

14 subnet bits

255.255.255.252

11111111 11111111 11111111 11111100

Class C

Default subnet mask

255.255.255.0

11111111 11111111 11111111 00000000

1 subnet bit

255.255.255.128

11111111 11111111 11111111 10000000

2 subnet bits

255.255.255.192

11111111 11111111 11111111 11000000

3 subnet bits

255.255.255.224

11111111 11111111 11111111 11100000

4 subnet bits

255.255.255.240

11111111 11111111 11111111 11110000

5 subnet bits

255.255.255.248

11111111 11111111 11111111 11111000

6 subnet bits

255.255.255.252

11111111 11111111 11111111 11111100

Wednesday, February 13, 2008

Subnet Mask to Dotted Decimal Notation

To convert a binary subnet mask to dotted decimal notation, follow these steps:

  1. Divide the subnet mask into octets by writing the 32-bit binary subnet mask with periods inserted at the octet boundaries:

    11111111.11111111.11110000.00000000
  2. For every all-ones octet, write down 255. For every all-zeros octet, write down 0.

  3. Convert the mixed octet to decimal using the binary conversion techniques add up the bit position values for all one bits

  4. Write down the final dotted decimal address:

    255.255.240.0

RARP

RARP stands for Reverse ARP. RARP is the opposite of ARP. ARP is used when the IP address is known but the physical address is not known. RARP is used when the physical address is known but the IP address is not known. RARP is often used in conjunction with the BOOTP protocol to boot diskless workstations.


BOOTP (boot PROM)— Many network adapters contain an empty socket for insertion of an integrated circuit known as a boot PROM. The boot PROM firmware starts as soon as the computer is powered on. It loads an operating system into the computer by reading it from a network server instead of a local disk drive. The operating system downloaded to the BOOTP device is pre-configured for a specific IP address






Wednesday, February 6, 2008

Special IP Addresses

A few IP addresses have special meanings and are not assigned to specific hosts. An all-zero host ID refers to the network itself. For instance, the IP address 129.152.0.0 refers to the Class B network with the network ID 129.152.

An all-ones host ID signifies a broadcast. A broadcast is a message sent to all hosts on the network. The IP address 129.152.255.255 is the broadcast address for the Class B network with the network ID 129.152. (Note that the dotted decimal term 255 corresponds to the all-ones binary octet 11111111.)

The address 255.255.255.255 can also be used for broadcast on the network.

Addresses beginning with the term 127 are loopback addresses. A message addressed to a loopback address is sent by the local TCP/IP software to itself. The loopback address is used to verify that the TCP/IP software is functioning.

RFC 1597 also reserves some IP address ranges for private networks. The assumption is that these private address ranges are not connected to the Internet, so the addresses don't have to be unique. In today's world, these private address ranges are often used for the protected network behind network translation devices:

  • 10.0.0.0 to 10.255.255.255

  • 172.16.0.0 to 172.31.255.255

  • 192.168.0.0 to 192.168.255.255

Converting a Decimal Number

Converting a Decimal Number to a Binary Octet

To convert the decimal number 207 to a binary octet, follow these steps:

  1. Compare the decimal number you want to convert (in this case 207) to the number 128. If the decimal number is greater than or equal to 128, subtract 128 and write down a 1. If the decimal number is less than 128, subtract 0 and write down a 0.

    207 > 128

    207 – 128 = 79

    Write down 1 for the 128s place

    Answer so far: 1

  2. Take the result from step 1 (79 in this case) and compare it to the number 64. If the decimal number is greater than or equal to 64, subtract 64 and write down a 1. If the decimal number is less than 64, subtract 0 and write down a 0.

    79 > 64

    79 – 64 = 15

    Write down a 1 for the 64s place

    Answer so far: 11

  3. Take the result from step 2 (15 in this case) and compare it to the number 32. If the decimal number is greater than or equal to 32, subtract 32 and write down a 1. If the decimal number is less than 32, subtract 0 and write down a 0.

    15 <>

    15 – 0 = 15

    Write down a 0 in the 32s place

    Answer so far: 110

  4. Compare the result from step 3 to the number 16. If the number is greater than or equal to 16, subtract 16 and write down a 1. If the number is less than 16, subtract 0 and write down a 0.

    15 <>

    15 – 0 = 15

    Write down a 0 in the 16s place

    Answer so far: 1100

  5. Compare the result of step 4 to the number 8. If the decimal number is greater than or equal to 8, subtract 8 and write down a 1. If the decimal number is less than 8, subtract 0 and write down a 0.

    15 > 8

    15 – 8 = 7

    Write down a 1 in the 8s place

    Answer so far: 11001

  6. Compare the result of step 5 to the number 4. If the decimal number is greater than or equal to 4, subtract 4 and write down a 1. If the decimal number is less than 4, subtract 0 and write down a 0.

    7 > 4

    7 – 4 = 3

    Write down a 1 in the 4s place

    Answer so far: 110011

  7. Compare the result of step 6 to the number 2. If the decimal number is greater than or equal to 2, subtract 2 and write down a 1. If the decimal number is less than 2, subtract 0 and write down a 0.

    3 > 2

    3 – 2 = 1

    Write down a 1 in the 2s place

    Answer so far: 1100111

  8. If the result of step 7 is a 1, write down a 1. If the result of step 7 is a 0, write down a 0.

    1 = 1

    Write down a 1 in the ones place

    Final answer: 11001111

You have now converted the decimal number 207 to its binary equivalent 11001111

Converting a 32-Bit Binary Address

Converting a 32-Bit Binary Address to Dotted Decimal Format

Following is an example showing how to convert a 32-bit binary IP address to dotted decimal format.

Convert the binary address 01011001000111011100110000011000.

  1. First break the address into 8-bit octets:

    Octet 1: 01011001

    Octet 2: 00011101

    Octet 3: 11001100

    Octet 4: 00011000

  2. Convert each octet to a decimal number.

    Table 4.2. Converting a Binary Address to Dotted Decimal Format

    Octet

    Binary Value

    Calculation

    Decimal Value

    1

    01011001

    1+8+16+64

    89

    2

    00011101

    1+4+8+16

    29

    3

    11001100

    4+8+64+128

    204

    4

    00011000

    8+16

    24

  3. Write out the decimal equivalent values in order from left to right. Separate the values with periods:

    The address is: 89.29.204.24

Monday, February 4, 2008

IP Addressing

An IP address is a 32-bit binary address. This 32-bit address is subdivided into four 8-bit segments called octets. Humans do not work well with 32-bit binary addresses or even 8-bit binary octets, so the IP address is almost always expressed in what is called dotted decimal format. In dotted decimal format, each octet is given as an equivalent decimal number. The four decimal values (4 x 8 = 32 bits) are then separated with periods. Eight binary bits can represent any whole number from 0 to 255, so the segments of a dotted decimal address are decimal numbers from 0 to 255. You have probably seen examples of dotted decimal IP addresses on your computer, in this book, or in other TCP/IP documents. A dotted decimal IP address looks like this: 209.121.131.14.

Part of the IP address is used for the network ID, and part of the address is used for the host ID. One complication is that the portion of the address allotted to the network ID varies, depending on the address. Most IP addresses fall into the following address classes:

  • Class A addresses— The first 8 bits of the IP address are used for the network ID. The final 24 bits are used for the host ID.

  • Class B addresses— The first 16 bits of the IP address are used for the network ID. The final 16 bits are used for the host ID.

  • Class C addresses— The first 24 bits of the IP address are used for the network ID. The final 8 bits are used for the host ID.

More bits lead to more bit combinations. As you might guess, the Class A format provides a small number of possible network IDs and a huge number of possible host IDs for each network. A Class A network can support approximately 224, or 16,777,216 hosts. A Class C network, on the other hand, can provide host IDs for only a small number of hosts (approximately 28, or 256), but many more combinations of network IDs are available in the Class C format.

You might be wondering how a computer or router knows whether to interpret an IP address as a Class A, Class B, or Class C address. The designers of TCP/IP wrote the address rules such that the class of an address is obvious from the address itself. The first few bits of the binary address specify whether the address should be interpreted as a Class A, Class B, or Class C address (see Table 4.1). The rules for interpreting addresses are as follows:

  • If the 32-bit binary address starts with a 0 bit, the address is a Class A address.

  • If the 32-bit binary address starts with the bits 10, the address is a Class B address.

  • If the 32-bit binary address starts with the bits 110, the address is a Class C address.

This scheme (thankfully) is easy to convert to dotted decimal notation because these rules have the effect of limiting the range of values for the first term in the dotted decimal address. For instance, because a Class A address must have a 0 bit in the leftmost place of the first octet, the first term in a Class A dotted decimal address cannot be higher than 127. You'll learn more about converting binary numbers to decimal later in this hour. For purposes of this discussion, Table 4.1 shows the address ranges for Class A, B, and C networks. Note that some address ranges are listed as excluded addresses. Certain IP address ranges are not assigned to networks because they are reserved for special uses. You'll learn more about special IP addresses later in this hour.

Table 4.1. Address Ranges for Class A, B, and C Networks

Address Class

Binary Address Must Begin with

First Term of Dotted Decimal Address Must Be

Excluded Addresses

A

0

0 to 127

10.0.0.0 to 10.255.255.255

127.0.0.0 to 127.255.255.255

B

10

128 to 191

172.16.0.0 to 172.31.255.255

C

110

192 to 223

192.168.0.0 to 192.168.255.255

Internet Protocol (IP)


The IP protocol provides a hierarchical, hardware-independent addressing system and offers the services necessary for delivering data on a complex, routed network. Each network adapter on a TCP/IP network has a unique IP address.


IP Header Fields

Every IP datagram begins with an IP header. The TCP/IP software on the source computer constructs the IP header. The TCP/IP software at the destination uses the information enclosed in the IP header to process the datagram. The IP header contains a great deal of information, including the IP addresses of the source and destination computers, the length of the datagram, the IP version number, and special instructions to routers.

  • Version— This 4-bit field indicates which version of IP is being used. The current version of IP is 4. The binary pattern for 4 is 0100.

  • IHL (Internet Header Length)— This 4-bit field gives length of the IP header in 32-bit words. The minimum header length is five 32-bit words. The binary pattern for 5 is 0101.

  • Type of Service— The source IP can designate special routing information. Some routers ignore the Type of Service field, although this field recently has received more attention with the emergence of Quality of Service (QoS) technologies. The primary purpose of this 8-bit field is to provide a means of prioritizing datagrams that are waiting to pass through a router. Most implementations of IP today simply put all zeros in this field.

  • Total Length— This 16-bit field identifies the length, in octets, of the IP datagram. This length includes the IP header and the data payload.

  • Identification— This 16-bit field is an incrementing sequence number assigned to messages sent by the source IP. When a message is sent to the IP layer and it is too large to fit in one datagram, IP fragments the message into multiple datagrams, giving all datagrams the same identification number. This number is used on the receiving end to reassemble the original message.

  • Flags— The Flags field indicates fragmentation possibilities. The first bit is unused and should always have a value of zero. The next bit is called the DF (Don't Fragment) flag. The DF flag signifies whether fragmentation is allowed (value = 0) or not (value = 1), The next bit is the MF (More Fragments) flag, which tells the receiver that more fragments are on the way. When MF is set to 0, no more fragments need to be sent or the datagram never was fragmented.

  • Fragment Offset— This 13-bit field is a numeric value assigned to each successive fragment. IP at the destination uses the fragment offset to reassemble the fragments into the proper order. The offset value found here expresses the offset as a number of 8-byte units.

  • Time to Live— This bit field indicates the amount of time in seconds or router hops that the datagram can survive before being discarded. Every router examines and decrements this field by at least 1, or by the number of seconds the datagram is delayed inside the router. The datagram is discarded when this field reaches zero.

A hop or a router hop correlates to a router that a datagram travels through on its way to its destination. If a datagram passes through five routers before arriving at its destination, the destination is said to be five hops, or five router hops, away.

  • Protocol— The 8-bit Protocol field indicates the protocol that will receive the data payload. A datagram with the protocol identifier 6 (binary 00000110) is passed up the stack to the TCP module, for example. The following are some common protocol values:

    Protocol Name

    Protocol Identifier

    ICMP

    1

    TCP

    6

    UDP

    17

  • Header Checksum— This field holds a 16-bit calculated value to verify the validity of the header only. This field is recomputed in every router as the TTL field decrements.

  • Source IP Address— This 32-bit field holds the address of the source of the datagram.

  • Destination IP Address— This 32-bit field holds the destination address of the datagram and is used by the destination IP to verify correct delivery.

  • IP Options— This field supports a number of optional header settings primarily used for testing, debugging, and security. Options include Strict Source Route (a specific path router path that the datagram should follow), Internet Timestamp (a record of timestamps at each router), and security restrictions.

  • Padding— The IP Options field may vary in length. The Padding field provides additional zero bits so that the total header length is an exact multiple of 32 bits. (The header must end after a 32-bit word because the IHL field measures the header length in 32-bit words.)

  • IP Data Payload— This field typically contains data destined for delivery to TCP or UDP (in the Transport layer), ICMP, or IGMP. The amount of data is variable but could include thousands of bytes.