Introduction to TCP/IP

OSI Reference Model

OSI Model provides a guideline that companies use when designing network devices and protocols.

OSI Model has 7 layers

The OSI model does not define specific applications or protocols, it simply provides a guide or framework that is used in design.

LayerNameFunction
7ApplicationID comm partner. Determine if enough resources exist for the application
6PresentationTranslator for Application Layer. Data Encryption, Compression, etc.
5SessionDialog Control (duplex), Connection Establishment, Data Transfer, Connection Release
4TransportEnd-to-end communication. Allows for multiple applications on the wire. Segments and reassembles data. Defines reliable and unreliable communication
3NetworkPath determination, determines network locations and manages network addresses.
2Data LinkResponsible for physical addresses (MAC addressing). Framing of data, converting frames to 1s and 0s. Network topology.
1PhysicalProvides physical and electrical specifications of the media.



Layers communicate in a peer-to-peer fashion. For example: The Network layer of Host A communicates with the Network layer of Host B.

Host A Host B
Application<----------------->
Application
Presentation<----------------->Presentation
Session<----------------->Session
Transport<----------------->Transport
Network<----------------->Network
Data-Link<----------------->Data-Link
Physical<----------------->Physical

DOD Reference Model

Created in the 1970s before OSI model.

The DOD model has 4 Layers v.s. the 7 layers of the OSI model

OSIDOD
Application
-----------
Presentation
------------
Session
Application
TransportHost-to-Host
NetworkInternet
Data-Link
---------
Physical
Network access>



OSIDODApplications
Application
-----------
Presentation
------------
Session
Application
FTP, TFTP, Telent, NFS, SMTP, DNS, SNMP, rlogin
TransportHost-to-HostTCP, UDP
NetworkInternetBootp, ICMP, ARP, RARP
Data-Link
---------
Physical
Network access Ethernet, Fast Ethernet, FDDI, Token Ring

TCP/IP Applications

Telnet - Terminal Emulation

Syntax: telnet < ip address>

ftp - File Transfer Protocol

tftp - Trivial file transfer protocol

An unreliable protocol is not necessarily bad. Unreliable, as protocols go, means that the protocol does not verify that the transmission that has taken place is good. This protocol assumes that an upper layer protocol will verify the data transfer.

Binary To Decimal Conversion

In order to fully understand TCP/IP addressing you must understand Binary to Decimal conversion.

As we all know, computers use binary numbers for storage, communications, and other tasks, but, we use decimal numbers. So we have to know how to go between the two number systems.

For the purposes of this document, we will only do a conversion of eight bits.

For TCP/IP addressing we are concerned only with 8 bits because a TCP/IP address is composed of four groups of eight bits. The right most bit (least significant) is a 0 or 1 and converts to a 0 or 1 for decimal. Going right each bit doubles in possible value.

128	64	32	16	8	4	2	1

Using the above, we can convert from decimal to binary and back very quickly.

For example, convert 195 to binary.

	128	64	32	16	8	4	2	1
	1   	1      	0     	0  	0	0	1	1
our binary number is: 11000011
Convert 10110110 to decimal.

	128	64	32	16	8	4	2	1
	1    	0     	1     	1 	0	1	1	0
128+32+16+4+2 = 182
Convert 255 to binary

	128	64	32	16	8	4	2	1
	1	 1	1	1	1	1	1	1
255 is converted to 11111111
Convert 11000000 to decimal.

	128	64	32	16	8	4	2	1
	1    	1     	0	 0	0	0	0	0
128+64 = 192

TCP/IP Addressing

A TCP/IP address is 32 bits long, divided into four octets.

A dot (.) is used to separate each octet.

An octet can range from a value of 0 to 255.

There are 5 classes of TCP/IP addresses.

The type of address that is used is determined by the first five bits of the first octet.

Class A	0	*	*	*	*	*	*	*	
Class B	1	0	*	*	*	*	*	*	
Class C	1	1	0	*	*	*	*	*
Class D	1	1	1	0	*	*	*	*
Class E	1	1	1	1	*	*	*	*

The breakdown of the addresses are:
Class A

Class B

Class C

Class D

Class E

Class A, Class B, and Class C addresses are used for hosts on a network. Class D is reserved for multicast, and Class E is reserved for research.

Along with the class of address numbers the octets are also broken down into network and host portions. The network number is given by the network administrator. The host portion can be assigned by a DHCP server or entered by a technician or administrator.

The network and host portion breakdown is:
Class A: N.H.H.H
Class B: N.N.H.H
Class C: N.N.N.H

N is the network.
H is the host.

The Internet Assigned Numbers Authority (IANA) is responsible for allocation of all registered TCP/IP addresses.

The address 127.0.0.1 is reserved for a loopback. This address is used for troubleshooting. It allows a host to send packets to itself. For example, to see if the TCP/IP stack is loaded properly on a workstation type PING 172.0.0.1. If there is a reply the protocol stack is probably installed properly. No reply would indicate a faulty installation of the TCP/IP protocol stack.

Other special addresses are:

0.0.0.0 is used by the RIP protocol as the default route. Older protocol stacks use this as a broadcast address.

255.255.255.255 is called the broadcast address. Packets that use this address are forwarded to all devices on the subnetwork. A router will not pass this address.

All zeros in the host portion designates the actual network number. For example the address 204.144.200.0 is a class C network. Routers will use this in routing tables.

All ones in the host portion is a broadcast for that network only.

Subnets and Subnet Masking

Along with the address portion in a TCP/IP address a subnet mask is assigned the default subnet mask for Class A, B, and C addresses are:

Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0

Like the TCP/IP address a subnet mask consists of four octets separated by periods.

A subnet mask is used to separate network bits from host bits.

A subnet is used for the following reasons:

One of the most common reasons for using subnets is the conservation of IP addresses. For example, a company may install a T-1 line between two sites. The only devices that are on this line are the two routers. Without a subnet the company would have to use a full Class C TCP/IP address. Using a Class C address with a subnet mask of 252, the company saves about 130 addresses.

Subnet addresses are simply a series of 1s added the default address (0s cannot be mixed in with the 1s in a subnet mask). This position in the mask creates additional subnets, and reduces the number of hosts (see the table)

Class C Subnet Reference Chart
BitsSubnet MaskNo. of SubnetsNo. of Hosts
2255.255.255.192262
3255.255.255.224614
4255.255.255.2401414
5255.255.255.248306
6255.255.255.252262

To see how a subnet mask works, look at the following example.

IP host address: 201.164.204.114 (11001001.10100100.11001100.1110010)
Subnet mask: 255.255.255.240 (11111111.11111111.11111111.11110000)

The actual subnet address is calculated by using the logical AND on both the host address and the mask for the length of the subnet mask. The host address is taken from the resulting bits in the host portion. This gives the following result:

NetworkSubnetHost
11001001.10100100.11001100.01110010
11111111.11111111.11111111.11110000
11001001.10100100.11001100.01110010
201164204 72

Please remember that a host cannot contain all 1s or all 0s. A host address with all 1s is the subnet broadcast address and the host address with all 0s is the actual network number. Also, a subnet with all 0s and all 1s is illegal. Using the above example. The address 201.164.204.112 is the network (or wire) address and the address 201.164.204.127 is the subnet broadcast address.

Continuing with the example involving a T-1 line, if the company has the address 199.168.142.0 and would like to subnet the address to support only two devices, therefore, saving address in this space, the subnet mask of 252 should be used. If the company takes the first subnet address space in this network for this use, it gets the following:

NetworkSubnet Host
11000111.10101000.10001110.00000100
11111111.11111111.11111111.11111100
11000111.10101000.10001110.00000100
199168142 10

The address 199.168.142.4 is the first network number that our company can use. Its two host addresses (one for each router ) are:

NetworkSubnet Host
11000111.10101000.10001110.00000101
11111111.11111111.11111111.11111100
11000111.10101000.10001110.00000101
199168142 11

First host address: 199.168.142.5

NetworkSubnet Host
11000111.10101000.10001110.00000110
11111111.11111111.11111111.11111100
11000111.10101000.10001110.00000110
199168142 12

Last host address: 199.168.142.6

The two host addresses for this subnet are 199.168.142.5 and 199.168.142.6.
The broadcast address is 199.168.142.7.


Another example would be for a company that has two remote sites with only 20 devices installed at each site. This growth for these sites is very limited and will not exceed a total of 25 devices each. First, from the Class C subnet reference chart, a subnet mask of 255.255.255.224 is needed. This subnet mask will support 30 hosts and 6 subnets, which meets the needs of these offices. Using the Class C address of 201.241.144.0 and the subnet mask of 255.255.255.224 calculate the first and second subnets that can be used. Then list the hosts and broadcast addresses of each subnet.

Office number 1

NetworkSubnet Host
11001001.11110001.10010000.001*00000
11111111.11111111.11111111.11100000
11001001.11110001.10010000.00100000
201241144 10

Subnet number one is 201.241.144.32

* subnet 001 is chosen because a subnet cannot contain all 0s or all 1s.

NetworkSubnet Host
11001001.11110001.10010000.001*00001
11111111.11111111.11111111.11100000
11001001.11110001.10010000.00100001
201241144 11

First host of subnet one is 201.241.144.33

NetworkSubnet Host
11001001.11110001.10010000.001*11110
11111111.11111111.11111111.11100000
11001001.11110001.10010000.00111110
201241144 130

Last host of subnet one is 201.241.144.62
Broadcast address of subnet one is 201.241.144.63



Office number 2

NetworkSubnet Host
11001001.11110001.10010000.01000000
11111111.11111111.11111111.11100000
11001001.11110001.10010000.01000000
201241144 20

Subnet number two is 201.241.144.64

NetworkSubnet Host
11001001.11110001.10010000.01000001
11111111.11111111.11111111.11100000
11001001.11110001.10010000.01000001
201241144 21

First host of subnet two is 201.241.144.65

NetworkSubnet Host
11001001.11110001.10010000.01011110
11111111.11111111.11111111.11100000
11001001.11110001.10010000.01011110
201241144 130

Last host of subnet two is 201.241.144.94
The broadcast address of subnet two is 201.241.144.95.

Private Address Spaces

With the explosion of the internet, address space became a very scarce resource. To combat the problem a new TCP/IP addressing scheme was proposed. This new addressing scheme is called IP version 6. However, it could be many years before this new addressing scheme would be ratified and implemented. To help fix the problem in the short term a series of addresses were designated as private address space. These addresses are not routed on the internet. These can only be routed on a companies internal network. A special computer (usually a firewall) can run either the Network Address Translation Protocol or Port Address Translation Protocol. These two protocols will translate from the private addresses to public addresses.

The following addresses are considered private address space:

Class A: 10.0.0.0 to 10.255.255.255

Class B: 172.16.0.0 to 172.32.255.255

Class C: 192.168.0.0 to 192.168.255.255.

A firewall running Network Address Translation performs a one-to-one translation of a private address to a public address. Port Address Translation converts all outgoing requests to a single IP address. It differentiates between each session by assigning a different port to each individual session.

For more information on Private Address Space see RFC 1918 IP addresses for inside and perimeter addresses.

Additional information regarding all the topics covered in this session can be found at:

Laura Chappel's Web Site
North American Network Operators Group
Tech Tutorials Computer Reference Directory