part iii network layer
DESCRIPTION
Part III Network Layer. Networking and Internetworking Devices. Connecting Devices. Following are the networking devices mostly used. Connecting Devices and the OSI Model. A Repeater in the OSI Model :Repeater is a regenerator not an amplifier. A Repeater. Function of a Repeater. - PowerPoint PPT PresentationTRANSCRIPT
PART III NETWORK LAYER
1
Networking and
Internetworking Devices
Connecting Devices
Following are the networking devices mostly used
Connecting Devices and the OSI Model
A Repeater in the OSI Model :Repeater is a regenerator not an amplifier
A Repeater
Function of a Repeater
Bridge : Operates in both physical and data link layer
A Bridge
Function of a Bridge
Multiport Bridge
Router: Router is Network layer device Router relay packets among multiple
interconnected networks
Gateway :Is a protocol convertor A gateway accept a packet formatted for
one protocol and convert it to packet formatted for another protocol
A Gateway
Single-Protocol: Designd to route packet belonging to same protocol
Multiprotocol Router:Designd to route packet belonging to two or more protocol
16
NETWORK LAYER DUTIES
INTERNETWORKING
The Motivation for Internetworking There are many different LAN and WAN technologies In real world, computers are connected by many different
technologies Any system that spans a large organization must accommodate
multiple technologies
Universal services Telephones are useful because any telephone can reach any other
telephone Universal service among computers greatly increases the usefulness
of each computer Providing universal service requires interconnecting networks
employing different technologies
WHAT IS INTERNETWORKING?
A scheme that provides universal service among heterogeneous networks
Hardware Used to interconnect a set of physical networks
Software Provide universal services
Internet System of connected physical networks
INTERNETWORK
NETWORK LAYER IN AN INTERNETWORK
IPv4 ADDRESSESIPv4 ADDRESSES
An An IPv4 addressIPv4 address is a is a 32-bit32-bit address that uniquely and address that uniquely and universally defines the connection of a device (for universally defines the connection of a device (for example, a computer or a router) to the Internet.example, a computer or a router) to the Internet.
Address SpaceNotationsClassful AddressingClassless AddressingNetwork Address Translation (NAT)
Topics discussed in this section:Topics discussed in this section:
FINDING THE ADDRESS CLASS
FINDING THE CLASS IN DECIMAL NOTATION
Example 4Example 4
Find the class of each address:
a. 227.12.14.87
b. 252.5.15.111
c. 134.11.78.56
SolutionSolutiona. The first byte is 227 (between 224 and 239); the class is D.b. The first byte is 252 (between 240 and 255); the class is E.c. The first byte is 134 (between 128 and 191); the class is B.
NETID AND HOSTID
NETWORK ADDRESS
Example 5Example 5
Given the address 23.56.7.91, find the network address.
SolutionSolution
The class is A. Only the first byte defines the netid. We can find the network address by replacing the hostid bytes (56.7.91) with 0s. Therefore, the network address is 23.0.0.0.
Example 6Example 6
Given the address 132.6.17.85, find the network address.
SolutionSolution
The class is B. The first 2 bytes defines the netid. We can find the network address by replacing the hostid bytes (17.85) with 0s. Therefore, the network address is 132.6.0.0.
Example 7Example 7
Given the network address 17.0.0.0, find the class.
SolutionSolution
The class is A because the netid is only 1 byte.
30
A NETWORK WITH TWO LEVELS OF HIERARCHY
• IP addresses are designed with two levels of hierarchy.
31
A NETWORK WITH THREE LEVELS OF HIERARCHY
ADDRESSES IN A NETWORK WITH AND WITHOUT SUBNETTING
SUBNET MASK
Dotted-decimal notation and binary notation for an IPv4 address
Change the following IPv4 addresses from binary notation to dotted-decimal notation.
SolutionWe replace each group of 8 bits with its equivalent decimal number (see Appendix B) and add dots for separation.
Change the following IPv4 addresses from dotted-decimal notation to binary notation.
SolutionWe replace each decimal number with its binary equivalent (see Appendix B).
Finding the classes in binary and dotted-decimal notation
Find the class of each address.a. 00000001 00001011 00001011 11101111b. 11000001 10000011 00011011 11111111c. 14.23.120.8d. 252.5.15.111
Solutiona. The first bit is 0. This is a class A address.b. The first 2 bits are 1; the third bit is 0. This is a class C address.c. The first byte is 14; the class is A.d. The first byte is 252; the class is E.
Default masks for classful addressing
Mask Address
shows a block of addresses, in both binary and dotted-decimal notation, granted to a small business that needs 16 addresses.
We can see that the restrictions are applied to this block. The addresses are contiguous. The number of addresses is a power of 2 (16 = 24), and the first address is divisible by 16. The first address, when converted to a decimal number, is 3,440,387,360, which when divided by 16 results in 215,024,210.
A block of 16 addresses granted to a small organization
A block of addresses is granted to a small organization. We know that one of the addresses is 205.16.37.39/28. What is the first address in the block?
SolutionThe binary representation of the given address is
11001101 00010000 00100101 00100111If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 0010000 or
205.16.37.32. This is actually the block shown in Figure 19.3.
Find the last address for the block in the above example
SolutionThe binary representation of the given address is
11001101 00010000 00100101 00100111If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111 or
205.16.37.47This is actually the block shown in Figure 19.3.
b. The last address can be found by ORing the given addresses with the complement of the mask. ORing here is done bit by bit. The result of ORing 2 bits is 0 if both bits are 0s; the result is 1 otherwise. The complement of a number is found by changing each 1 to 0 and each 0 to 1.
c. The number of addresses can be found by complementing the mask, interpreting it as a decimal number, and adding 1 to it.
Configuration and addresses in a subnetted network
Three-level hierarchy in an IPv4 address
Network and Host Addresses
A Network with Two Levels of Hierarchy
A Network with Three Levels of Hierarchy
Addresses with and without Subnetting
Masking
IP Datagram
Detail of IP datagram
Version Number- Four bit version number defines the version of IP Header length- Defines the total length of the datagram header Service type-How the datagram should be handelled Total length – Defines total length of IP datagram Identification,Flags and fragmentation offset- These three fields are related to the fragmentation of the IP datagram when the size of the datagram is larger than the underplaying network can carry Time-to-alive- Is used to control the maximum number of hopes visited by the router
Continue…
Protocol – In TCP/IP ,the data section of a packet ,called the payload ,carries the whole packet from another protocol Header checksum – Checking of header of IP is the responsibility of header checksum as IP is not a reliable protocol Source and Destination address- IP address of source machine and destination machine Option – A datagram header can have up to 40 bytes of optiones Payload – Is data coming from its higher layer
ARP
Routing Algorithm
Two common methods are used to calculate shortest path between
two routers :Distance vector routing
Link state routing
Example of an Internet
Distance Vector routing
Three keys to understand how this algorithm works1.Knowledge about the whole network –Each routers shares its knowledge about the entire network2.Routing only to its neighbor-Each router periodically shows its knowledge about the network only to those routers to which it has direct link .3.Information sharing at regular interval –For example ,every 30 seconds router send its information about the whole network to its neighbor
The Concept of Distance Vector Routing
Distance Vector Routing Table
Routing Table Distribution
Updating Routing Table for Router A
Final Routing Tables
1. Router transmits its distance vector to each of its neighbors.
2. Each router receives and saves the most recently received distance vector from each of its neighbors.
3. A router recalculates its distance vector when:
a. It receives a distance vector from a neighbor containing different information than before.
b. It discovers that a link to a neighbor has gone down (i.e., a topology change).
The DV calculation is based on minimizing the cost to each destination.
Algorithm :Distance Vector Routing Algorithm :Distance Vector Routing
67
Link State Routing
The following are true related to link state routing 1.Knowledge about the neighborhood 2.To all routers –Each router send this information to every other router on the internetwork not just to its neighbor .3.Information sharing when there is change –Each router send out information about the neighbors when there is change.
Algorithm :Link State routing Algorithm :Link State routing
1. Each router is responsible for meeting its neighbors and learning their names.
2. Each router constructs a link state packet (LSP) which consists of a list of names and cost to reach each of its neighbors.
3. The LSP is transmitted to ALL other routers. Each router stores the most recently generated LSP from each other router.
4. Each router uses complete information on the network topology to compute the shortest path route to each destination node.
Concept of Link State Routing
Cost in Link State Routing
Link State Packet
Flooding of A’s LSP
Link State Database
Initially mark all nodes (except source) with infinite distance.
working node = source nodeSink node = destination nodeWhile the working node is not equal to the sink 1. Mark the working node as permanent. 2. Examine all adjacent nodes in turn
If the sum of label on working node plus distance from working node to adjacent node is less than current labeled distance on the adjacent node, this implies a shorter path. Relabel the distance on the adjacent node and label it with the node from which the probe was made.
3. Examine all tentative nodes (not just adjacent nodes) and mark the node with the smallest labeled value as permanent. This node becomes the new working node.
Reconstruct the path backwards from sink to source.
Dijkstra’s Shortest Path Algorithm
Costs in the Dijkstra Algorithm
Shortest Path Calculation, Part I
Shortest Path Calculation, Part II
Shortest Path Calculation, Part III
Shortest Path Calculation, Part IV
Shortest Path Calculation, Part V
Shortest Path Calculation, Part VI
Shortest Path Calculation, Part VII
Shortest Path Calculation, Part VIII
Shortest Path Calculation, Part IX
Shortest Path Calculation, Part X
Shortest Path Calculation, Part XI
Shortest Path Calculation, Part XII
Shortest Path Calculation, Part XIII
Routing Table for Router A
Multiprotocol Router Vs Single protocol Router
90
Single protocol Router: (Unicast Routing protocol ) : One to one source and destination network RIP :Routing Information Protocol OSPF : Open Shortest Path First BGP4 :Boarder Gateway Protocol 4
Multiprotocol Router (Multicast routing Protocol) One source and group of destination (One to many ) Protocols are DVMRP :Distance Vector Multicast routing protocol MOSF :Multicast open Shortest Path First PIM :Protocol Independent Multicast
Part-IV Transport Layer
Transport Layer protocol
Two protocols : UDP and TCP UDP is connectionless protocol while TCP is connection oriented protocol
Duties of transport layer Duties of transport layer
Process-to-Process Communication Stream Delivery Service Full-Duplex Communication Multiplexing and Demultiplexing
UDP Format
15-2 TCP FEATURES
To provide the services mentioned in the previous section, TCP has several features that are briefly summarized in this section and discussed later in detail.
The bytes of data being transferred in each connection are numbered by TCP.
The numbering starts with an arbitrarily generated number.
Note
Suppose a TCP connection is transferring a file of 5,000 bytes. The first byte is numbered 10,001. What are the sequence numbers for each segment if data are sent in five segments, each carrying 1,000 bytes?
SolutionThe following shows the sequence number for each segment:
The value in the sequence number field of a segment defines the number
assigned to the first data byte contained in that segment.
Note
Stream delivery
Sending and receiving buffers
Stream of bytes
TCP segments
Segment 1
H
Segment N
H
The value of the acknowledgment field in a segment defines the number of the next
byte a party expects to receive.
The acknowledgment number is cumulative.
Note
SEGMENT
Before discussing TCP in more detail, let us discuss the TCP packets themselves. A packet in TCP is called a segment.
TCP segment format
Control field
TCP header fields106
Port Number: A port number identifies the endpoint of a
connection. A pair <IP address, port number> identifies one
endpoint of a connection. Two pairs <client IP address, server port number> and <server IP address, server port number> identify a TCP connection.
TCP
IP
Applications
23 10480Ports:
TCP
IP
Applications
7 1680 Ports:
TCP header fields107
Sequence Number (SeqNo): Sequence number is 32 bits long. So the range of SeqNo is
0 <= SeqNo <= 232 -1 4.3 Gbyte
Each sequence number identifies a byte in the byte stream
Initial Sequence Number (ISN) of a connection is set during connection establishment
TCP header fields108
Acknowledgement Number (AckNo): Acknowledgements are piggybacked, I.e
a segment from A -> B can contain an acknowledgement for a segment sent in the B -> A direction.
A hosts uses the AckNo field to send acknowledgements. (If a host sends an AckNo in a segment it sets the “ACK flag”)
The AckNo contains the next SeqNo that a hosts wants to receiveExample: The acknowledgement for a segment with sequence number 0 and 1500 data bytes is AckNo=1500+1
TCP header fields109
Acknowledge Number (cont’d) TCP uses the sliding window flow protocol to
regulate the flow of traffic from sender to receiver TCP uses the following variation of sliding window:
no NACKs (Negative ACKnowledgement) only cumulative ACKs
Example: Assume: Sender sends two segments with “0..1500”
and “1501..3000”, but receiver only gets the second segment.
In this case, the receiver cannot acknowledge the second packet. It can only send AckNo=0+1
TCP header fields110
Header Length ( 4bits): Length of header in 32-bit words Note that TCP header has variable length
(with minimum 20 bytes)
TCP header fields111
Flag bits: URG: Urgent pointer is valid
If the bit is set, the following bytes contain an urgent message in the range:
SeqNo <= urgent message <= SeqNo+urgent pointer
ACK: Acknowledgement Number is valid PSH: PUSH Flag
Notification from sender to the receiver that the receiver should pass all data that it has to the application.
Normally set by sender when the sender’s buffer is empty
TCP header fields112
Flag bits: RST: Reset the connection
The flag causes the receiver to reset the connection
Receiver of a RST terminates the connection and indicates higher layer application about the reset
SYN: Synchronize sequence numbers Sent in the first packet when initiating a connection
FIN: Sender is finished with sending Used for closing a connection Both sides of a connection must send a FIN
TCP header fields113
Window Size: Each side of the connection advertises the
window size Window size is the maximum number of
bytes that a receiver can accept. Maximum window size is 216-1= 65535 bytes
TCP Checksum: TCP checksum covers TCP segment and IP
pseudo header (see discussion on UDP). Urgent Pointer:
Only valid if URG flag is set
TCP header fields114
Options: NOP is used to pad TCP header to multiples
of 4 bytes Maximum Segment Size Window Scale Options
Increases the TCP window from 16 to 32 bits This option can only be used in the SYN
segment (first segment) during connection establishment time
Timestamp Option Can be used for roundtrip measurements
Services of TCP115
Connection Management (TCP transmission policy) :To establish connection before transmitting data
Congestion Management Timer Management for sending lost
frame and others
Connection Management in TCP
116
Opening a TCP Connection Closing a TCP Connection Special Scenarios State Diagram
TCP Connection Establishment
117
TCP uses a three-way handshake to open a connection:(1) ACTIVE OPEN: Client sends a segment with
SYN bit set port number of client initial sequence number (ISN) of client
(2) PASSIVE OPEN: Server responds with a segment with
SYN bit set initial sequence number of server ACK for ISN of client
(3) Client acknowledges by sending a segment with:
ACK ISN of server
A TCP CONNECTION
TCP is connection-oriented. It establishes a virtual path between the source and destination. All of the segments belonging to a message are then sent over this virtual path. You may wonder how TCP, which uses the services of IP, a connectionless protocol, can be connection-oriented. The point is that a TCP connection is virtual, not physical. TCP operates at a higher level. TCP uses the services of IP to deliver individual segments to the receiver, but it controls the connection itself. If a segment is lost or corrupted, it is retransmitted.
Connection establishment using three-way handshake
Connectionopened
PassiveopenActive
open
SYN
U A P R S F
seq: 8000
SYN + ACKU A P R S F
seq: 15000
ack: 8001rwnd: 5000
ACK
U A P R S F
seq: 8000ack: 15001
rwnd: 10000
Means “no data” !
A SYN segment cannot carry data, but it consumes one sequence number.
A SYN + ACK segment cannot carry data, but does consume one
sequence number.
An ACK segment, if carrying no data, consumes no sequence number.
WINDOWS IN TCP
Before discussing data transfer in TCP and the issues such as flow, error, and congestion control, we describe the windows used in TCP. TCP uses two windows (send window and receive window) for each direction of data transfer, which means four windows for a bidirectional communication. To make the discussion simple, we make an assumption that communication is only unidirectional; the bidirectional communication can be inferred using two unidirectional communications with piggybacking.
Topics Discussed in the SectionTopics Discussed in the Section
Send Window Receive Window
Send window in TCP
Receive window in TCP
FLOW CONTROL
As discussed in, flow control balances the rate a producer creates data with the rate a consumer can use the data. TCP separates flow control from error control. In this section we discuss flow control, ignoring error control. We temporarily assume that the logical channel between the sending and receiving TCP is error-free. Figure 15.24 shows unidirectional data transfer between a sender and a receiver; bidirectional data transfer can be deduced from unidirectional one as discussed in Chapter 13.
TCP/IP protocol suite
Messagesare pushed
1
Segements are pushed
2
Messagesare pulled
3
Flow control feedback
4
Flow controlfeedback5
ERROR CONTROL
TCP is a reliable transport layer protocol. This means that an application program that delivers a stream of data to TCP relies on TCP to deliver the entire stream to the application program on the other end in order, without error, and without any part lost or duplicated.
Error control in TCP is achieved through the use of three tools: checksum, acknowledgment, and time-out.
CONGESTION CONTROL
Congestion control in TCP is based on both open loop and closed-loop mechanisms. TCP uses a congestion window and a congestion policy that avoid congestion and detect and alleviate congestion after it has occurred.
TCP TIMERS: Timer Management
To perform its operation smoothly, most TCP implementations use at least four timers as shown in Figure 15.38 (slide 83).
TCP timers
TCP TimerTCP Timer
Retransmission Timer(RTT):To retransmit lost segments TCP employs one retransmission timer
Rules of RTT
1.When TCP send the segment in front of the sending queue ,it starts the timer
2.When the timer expires TCP send first segment in front of the queue and restart the timer
3.When the segments are cumulatively acknowledged segment or segments are purged from the queue
4.If the queue is empty ,TCP stops the timer ,otherwise TCP restarts the timer
Persistence Timer :To deal with zero window size advertise TCP uses other timer known as persistence timer .If the receiving TCP announces a window size of zero ,the sending TCP stops transmitting segments until the receiving TCP sends an ACK segment announcing non zero size of window Keepalive Timer: Is used in some implementation to prevent long idle connection between two TCPs.Suppose a client open a connection with server and transfer data and become silent . TIME-WAIT Timer:Is used during connection termination
Part-V Presentation and Application Layer
Session Layer Dialog
Session-to-Transport Layer Communication
Synchronization Points
Presentation Layer Functions
Direct and Indirect Methods of Translation
Concept of Encryption and Decryption
Encryption/Decryption Methods
Monoalphabetic Substitution
Polyalphabetic Substitution
Transpositional Encryption
Encoding/Decoding
Permutation
Substitution
Product
Exclusive OR
Rotation
DES
Subkey Generation in DES
One of the 16Steps in DES
Public Key Encryption
RSA
RSA Encryption and Decryption
Security of RSA
Signature Authentication
Application Layer
Client-Server Model
DNS in the Internet
Generic Domains
Country Domains
Inverse Domain
Local Login
Remote Login
Concept of NVT
FTP
SMTP Concept
UAs and MTs
Relay MTAs
Mail Gateways
E-mail Address
The Entire E-mail System
MIME
POP3 and SMTP
SNMP Concept
Internet Management Components
MIB
SNMP Messages