Sunteți pe pagina 1din 55

CIS344 Computer Networks

Week 4

Lecture Outline
TCP/IP Transport Layer (TCP)

General Information
IP Addressing
Subnetting (next week)

Note: There will be a lot of material

presented on the whiteboard during this


lecture. If you miss class, you will need to
get notes from someone!

The TCP/IP Application Layer


Transport Layer main goals:

Oversee delivery of data from


application layer on one entity
to application layer on another
entity.
Liaison between application
layers and lower layers

Application
Transport
Network
Data Link
Physical

Transport Layer
The Application layer is only aware of the

Transport layer
Duties of the Transport Layer
Packetizing
Creating a connection
Addressing
Providing reliability

Duties of the Transport Layer


-Packetizing
Creates a packet out of the message handed

down from application layer


Then, larger messages are divided into several
smaller messages (fragmentation)

Motivation: Smaller messages are easier to


manage and lower layers may limit the size of a
packet.

A header is then attached to the data in the

packet

Headers contain control information specific to


the duties of the transport layer

Duties of the Transport Layer


-Creating a Connection
Two types of transport-layer protocols:

Connection-oriented
Connectionless

Duties of the Transport Layer


-Creating a Connection
Connection-Oriented
Establishes a virtual connection (or session)
between sender and receiver
Session remains intact until one party
terminates
Both parties may send multiple messages at a
time to each other.
Three Phases (similar to a telephone call):

Connection Establishment
Data Transfer
Connection Termination

Duties of the Transport Layer


-Creating a Connection
Connection-Oriented (cont.)

Connection Establishment

1.
2.
3.

Requires a 3-way handshake:


Client requests a connection to the server
Server sends a confirmation packet to client
Client sends a packet to acknowledge the
confirmation

Data Transfer

Data is sent back and forth through the


connection.

Duties of the Transport Layer


-Creating a Connection
Connection-Oriented (cont.)

Connection Termination

1.
2.
3.
4.

Requires a 4 steps:
Client requests a disconnection from the server
Server acknowledges
Server requests disconnection from the client
Client acknowledges

Duties of the Transport Layer


-Creating a Connection
Connectionless

No virtual connection (session) between


sender and receiver
Usually used in a system where single packets
need to be transmitted without the overhead of
connection establishment and termination

Duties of the Transport Layer


- Addressing
Local Addressing
We have already seen how two devices must
know each others address to communicate
Therefore, we need 2 addresses to be defined
at the transport layer: one for the client and one
for the server.
Port Numbers

Port number limited to 16 bits

216 = 65536
So the valid port number range is 0..65535
Theoretically, up to 65536 clients may be
connected to the same server at the same time.

Duties of the Transport Layer


- Addressing
Port Numbers (cont.)

Client Port Number

1.
2.

3.

When client wishes to send a message, the


transport layer chooses client port number
according to the following rules:
The number must be within the valid range
Number must be unique (not given to another
client or server)
The reuse of this number must be restricted
until the connection using it is terminated.

Duties of the Transport Layer


- Addressing
Port Numbers (cont.)

Server Port Number

Well-known ports are used so that clients may


easily locate the appropriate application on the
server. Ex: HTTP, SMTP, FTP.

Duties of the Transport Layer


- Addressing
Port Number Conventions:
Port Number

Usage

0 1023

Well-known ports only assigned to


server programs that are intended to
be standard in the Internet

1024 49151

Assigned to registered server


programs

49152 65535 Ephemeral ports temporary port


numbers that can be used as client
port numbers

Duties of the Transport Layer


- Reliability
Unreliable Service

Designed for speed (not reliability)


Packet may be damaged, lost, received out of
sequence, or duplicated.

Transport layer does not accept responsibility for


this under this scheme.

Some protocols using this are TFTP and UDP

Duties of the Transport Layer


- Reliability
Reliable Service

Ensures reliable delivery of packets. That is,


providing:

Damage control
Loss control
Order control
Duplicate control

Overhead associated with reliability:

Slower delivery
More complicated

Duties of the Transport Layer


- Reliability

Damage Control

Error detection
The sender of a packet may include extra information
to provide a cross check at the receiving end.
Example: Given data D, sender encodes a function
f(D) to be included with the packet. The receiver then
reverses the function (i.e. f-1(D) to generate the data
and compares it to the data (they should be the
same).

Acknowledgements (ACK)
Require receiver to acknowledge the receipt of the
senders packets.

Time Outs
If an ACK is not received after a set period of time,
assume the packet was damaged and start again.

Duties of the Transport Layer


- Reliability

Loss Control

Loss of a packet or acknowledgement during


communication many causes for this, including:
Congestion (common) an intermediate connecting
device may become overwhelmed and have to discard
packets

Order Control

As previously mentioned, data may be fragmented


into several packets.
Packets received out of order must be re-arranged

Duplicate Control

If two packets arrive with the same sequence


number, discard one.

Internet Protocols
Two protocols for transport layer in the Internet
User Datagram Protocol (UDP)

Transmission Control Protocol (TCP)

A connectionless, unreliable transport protocol


UDP packets are called user datagrams
Ex: TFTP uses the services of UDP
A connection-oriented, reliable transport protocol
TCP packets are called segments
Ex: SMTP, HTTP, FTP, and TELNET use the
services of TCP

UDP and TCP will be explained in detail


during next weeks lecture.

IP Addressing

IP Addressing
IP addresses uniquely and universally

define the connection of a host or a router to


the Internet.

Therefore IP addresses must be unique


Two devices on the Internet can never have the
same address

IP address consists of 32 bits

Therefore, 232 possible addresses


= 4,294,967,296 possible addresses

IP Addressing
Notation

Binary
4 sets of binary octets (i.e. 4 bytes)
Dotted decimal (conventional)
Easier to read
Each byte is capable of representing 2 8 = 256
possibilities (0..255)

Binary to Dotted Decimal


Lets Try It!
Change to dotted decimal notation:
10000001 00001011 00001011 11101111
b) 11000001 10000011 00011011 11111111

Change to binary notation:


a) 111.56.45.78
b) 221.34.7.82

Classful vs. Classless Addressing


Classful based on concept of classes (from

OO programming)
Although the new classless addressing
technology will eventually take over, classful
addressing will be in existence for a long
time.
We must understand classful before we
understand classless

Classful Addressing
IP address divided into five classes:

A, B, C, D, and E
Address Space:
A covers , B covers , C covers 1/8, and D, E cover 1/16

Addresses per Class (table 4.1)


Class

Number of Addresses

Percentage

231 = 2,147,483,648

50%

230 = 1,073,741,824

25%

229 = 536,870,912

12.5%

228 = 268,435,456

6.25%

228 = 268,435,456

6.25%

Notice: 231 + 230 + 229 + 228 + 228 = 232

Finding the Class of an Address


Binary Notation look at first few bits:

Finding the Class of an Address


Heres a flow chart for finding the class

of a binary IP address:

Finding the Class of an Address


- Try it yourself!
Find the class of the following addresses:
a) 11000001 00001011 00001011 11101111
b) 00000001 00001011 00011011 11110110
c) 10100111 11011011 11111011 00101011
d) 11110011 10011011 11111011 00001111

Finding the Class of An Address


Using dotted decimal notation you can tell by the

range in which the first number falls in

Finding the Class of an Address


- Try it yourself!
Find the class of the following addresses:
a) 227.12.14.87
b) 193.13.56.22
c) 14.23.120.8
d) 252.5.15.111
e) 134.11.78.56

NetID and HostID


In general, an IP address consists of 32 bits (4

bytes) that define a hosts connection to the


network.
Netid

identifies the network

Hostid

Identifies a host (station or node on the network)

General Model:

NetID and HostID


The lengths corresponding to the netid and hostid

vary in lengths depending on the class of the address


(note that Class D, E are not divided into netid and
hostid)

Figure 4-4

Examples

Classes and Blocks


Problem: with classful addressing, each

class is divided into a set number of fixed


sized blocks
You will see how many potential addresses
are wasted in certain classes.

Class A
Divided into 128 blocks (each with different netid)
0.0.0.0 to 0.255.255.255 (netid 0)
1.0.0.0 to 0.255.255.255 (netid 1)

127.0.0.0 to 0.255.255.255 (netid 127)

First and Last blocks are reserved for special

purposes
Netid 10 is used for private addresses.
125 remaining blocks can be assigned to
organizations
Think about this: can only have 125 unique
organizations each with 16,777,216 addresses to use.

Waste of addresses!

Class B
Divided into 16,384 blocks (each with different netid)
128.0.0.0 to 128.0.255.255 (netid 128.0)
128.1.0.0 to 128.1.255.255 (netid 128.1)

191.255.0.0 to 191.255.255.255 (netid 191.255)

16 blocks reserved for special purposes


16,368 remaining addresses can be assigned to

organizations
Each organization would then have 65,536 available
addresses
Think about it! 16,368 unique organizations possible,
each with 65,536 addresses to use.

Again, many addresses would be wasted

Class C
Divided into 2,097,152 blocks (each with a

different netid).
256 blocks used for special purposes.
2,096,896 blocks can be assigned to
organizations
Each organization would then have 256
addresses
Think about this one:

Most organizations have many more than 256


devices
Ex: Saint Rose has well over 500 computers

Class D & E
Class D

Just one block of addresses


Each address identifies a group of hosts on
the Internet
Used for multicasting covered later

Class E

Again, just one block of addresses


Designed for use as reserved addresses
covered later

Network Address
The network address identifies the network

to the rest of the Internet.


It is the first address in the block
Given the network address, we can infer
other information, such as:
Class
Block
Range of addresses in the block

Network Address
- Try it yourself!
Example Problems:
1)

Given network address 17.0.0.0, find the


class, block and range of the addresses

2)

Given network address 199.35.18.0, find the


class, block and range of addresses

Masks
Given an address, can we extract the network

address (the beginning address in the block)?


A mask is used to find this

information
32 bit binary number
Applying the logical AND
operator to the mask and
the address gives the first
address in the block
(network address)

B A AND B

Masks
The AND operates as follows:
1. If the bit in the mask is 1, the corresponding

bit in the address does not change


2. If the bit in the mask is 0, the bit
corresponding bit in the address becomes 0

Masks
Default Masks

For classful addressing, there is a default


mask for classes A, B, and C]
Notice that for each, the binary 1s retain the
netid and the binary 0s change the hostids
to 0.

Class

Mask in Binary

Mask in dotteddecimal

11111111 00000000 00000000 00000000

255.0.0.0

11111111 11111111 00000000 00000000

255.255.0.0

11111111 11111111 11111111 00000000

255.255.255.0

Masks
-Try It Yourself
1) Given address 23.56.7.91, apply the

appropriate default mask to find the


beginning address (network address).

Solution: Mask would be for Class A and we


would get 23.0.0.0

2) Now try 132.6.17.85


3) Now try 201.180.56.5

Masks
Depletion of Addresses on the Internet

Due to the classful addressing scheme


Several organizations occupying an address
are not using anywhere near their allotted
internal addresses (A and B classes)
Few organizations want a C class address
Result, theres nowhere near 232 devices on
the Internet, yet we are running out of netids!

Other Issues
-Multihomed Devices
Multihomed device

A device connected to more than one network


A device connected to N networks, must have N different
addresses. When it moves, it must change addresses.
Example: a router is connected to multiple networks,
therefore it has an address for each interface (to the
networks)

Other Issues
-Special Addresses
Special Address

Netid

Hostid

Source or Destination

Network address

Specific

All 0s

None

Direct broadcast address

Specific

All 1s

Destination

Limited broadcast address

All 1s

All 1s

Destination

This host on this network

All 0s

All 0s

Source

Specific host on this network

All 0s

Specific

Destination

Loopback address

127

Any

Destination

We already know what a network address is, so we will

explain the rest in the next few slides

Other Issues
-Special Addresses
Direct Broadcast Address

Used to transmit a message to all hosts


within a specific network

Other Issues
-Special Addresses
Limited Broadcast Address

Belongs to class E
Allows a host to send a message to all other hosts

Other Issues
-Special Addresses
This Host on This Network

Other Issues
-Special Addresses
Specific Host on This Network

Other Issues
-Special Addresses
Loopback Address - used to test the software on a machine

Note:
packet never
leaves
machine

Other Issues
-Special Addresses
Private Addresses

Addresses not recognized globally


Discussed in more detail later in the course

Unicast vs. Multicast


Unicast
One-to-one
Individual source sends packet to an individual
destination
Class A, B, and C addresses
Multicast

One-to-many
Individual source sends packet to group of
destinations
Class D address

S-ar putea să vă placă și