Nothing Special   »   [go: up one dir, main page]

Part 3-Network Layer

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 63

SYLLABUS:

1. Introduction & Physical Layer - Introduction to the Internet - Services and Protocols, Edge -
Protocol Layers and Service Models OSI and TCP/IP models. ​
2. Data link Layer - Link Layer – Services - Error Detection and Correction; Multiple Access
protocols Channel partitioning - Random access - Taking-Turns protocols - Switched LANs ARP - Ethernet
- Link layer switching – VLANs – MPLS.​
3. Network Layer - Data plane forwarding vs. Control plane routing - Software Defined Networking
(SDN) approach - Network Services - Router architecture - Switching fabrics - Input and output queueing-
Core, Packet Switching vs. Circuit Switching - Performance Metrics Delay - Loss – Throughput - IPv4 and
IPv6 addressing DHCP -NAT - IPv4 and IPv6 fragmentation – SDN-based generalized forwarding -
Routing and Supporting Algorithms - Link State vs. Distance Vector - RIP - OSPF – BGP – ICMP - SNMP
- SDN Control Plane. ​
4. Transport Layer - Unreliable Connectionless vs. Reliable Connection-Oriented Services -
Multiplexing; Stop-and-Wait - Go-Back-N and Selective-Repeat - UDP vs. TCP - Flow and Congestion
Control. ​
5. Application Layer - Client-Server and Peer-to-Peer architectures - Application Layer protocols ​
6. Introduction to Wireless and Mobile Networks - Link characteristics - CDMA - 802.11 WiFi -
Bluetooth and Zigbee - Cellular Networks - GSM – UMTS – LTE - Mobility management and handoff -
Mobile IP.​
Part-3 (Lecture Flow & Book Details)

Data plane forwarding vs. Control plane routing - Software Defined Networking (SDN) approach -
Network Services – James Kurose and Keith Ross, “Computer Networking: A Top-down Approach” 7th
edition – Chapter 4- 4.1(Alone)
Router architecture - Switching fabrics -James Kurose and Keith Ross, “Computer Networking: A Top-
down Approach” 6th edition – Chapter 4- 4.3-4.3.1 to 4.3.3(Alone)
Core, Packet Switching vs. Circuit Switching - Performance Metrics Delay - James Kurose and Keith Ross,
“Computer Networking: A Top-down Approach” 6th edition – Chapter 1- 1.3-1.3.1, 1.3.2 and 1.4- 1.4.1-
1.4.3(Alone)
IPv4 - Behrouz Forouzan, “Data Communication and Networking”, Tata McGraw Hill 4th edition. Chapter –
20- only 20.2 and Chapter-19- only 19.1.
IPv6 addressing - IPv4 and IPv6 fragmentation – James Kurose and Keith Ross, “Computer Networking: A
Top-down Approach” 6th edition – Chapter 4- 4.4.4 (Alone)
Routing and Supporting Algorithms - Link State vs. Distance Vector - RIP - OSPF – BGP – Behrouz
Forouzan, “Data Communication and Networking”, Tata McGraw Hill 4th edition. Chapter – 22- only 22.3.
Forwarding and Routing:
• The primary role of the network layer is to move packets from a sending host to a
receiving host.
• Provides host/end/source to host/end/destination communication
• Can be decomposed into two interacting parts: the data plane and the control plane.

Two important network-layer functions are

Forwarding and Routing


Forwarding:
• When a packet arrives at a router’s input link, the router must move the packet to the
appropriate output link. Forwarding is implemented in the data plane.
• Forwarding refers to the router-local action of transferring a packet from an input link
interface to the appropriate output link interface.
• Forwarding takes place at very short timescales (few nanoseconds) and is implemented in
hardware
Forwarding and Routing:

Routing & Routing Algorithm:


• The network layer must determine the route or path taken by packets as they flow from
sender to a receiver. The algorithms that calculate these paths are referred to as routing
algorithms.
• Routing is implemented in the control plane of the network layer.
• Routing refers to the network-wide process that determines the end-to-end paths that
packets take from source to destination.
• Routing takes place on much longer timescales (in seconds) and is implemented in
software.
• A key element in every network router is its forwarding table.
• A router forwards a packet by examining the value of one or more fields in the arriving
packet’s header and then using these header values to index into its forwarding table.
A packet with a header field value
of 0110 arrives at a router. The
router indexes into its forwarding
table and determines that the
output link interface for this
packet is interface 2. The router
then internally forwards the
packet to interface 2.

Let’s learn about Control Plane First


Control Plane:
The Traditional Approach
• A routing algorithm runs in each and every router and both forwarding and routing functions
are contained within a router.
• The routing algorithm function in one router communicates with the routing algorithm
function in other routers to compute the values for its forwarding table by exchanging routing
messages containing routing information according to a routing protocol
The SDN Approach
• Physically separate remote controller computes and distributes the forwarding tables to be
used by each and every router.
• The remote controller might be implemented in a remote data center with high reliability
and redundancy and might be managed by the ISP or some third party.
• The control-plane approach is the heart of Software-Defined Networking (SDN) where
the network is “software-defined” because the controller that computes forwarding tables
and interacts with routers is implemented in software.
Control Plane: The SDN Approach
• Note that the data plane
components of Figures
4.2 and 4.3 are identical.
• In Figure 4.3 however
control-plane routing
functionality is
separated from the
physical router—the
routing device performs
forwarding only while
the remote controller
computes and distributes
forwarding tables.
Router:
Router:
Four router components -Input ports, Switching Fabric, Output Ports and Routing processor
Input Ports:
• It performs the physical layer function of terminating an incoming physical link at a router
• An input port performs link-layer functions needed to interoperate with the link layer at the
other side of the incoming link
• A lookup function is also performed at the input port
• The forwarding table is consulted to determine the router output port to which an arriving
packet will be forwarded via the switching fabric.
• Control packets (carrying routing protocol information) are forwarded from an input port to
the routing processor.
• In practice, the number of ports supported by a router can range from a relatively small
number in enterprise routers to hundreds of 10 Gbps ports in a router at an ISP’s edge where
the number of incoming lines tends to be the greatest.
Router:
Switching fabric.
• The switching fabric connects the router’s input ports to its output ports.
• Switching fabric is completely contained within the router
Output ports.
• An output port stores packets received from the switching fabric and transmits these packets
on the outgoing link by performing the necessary link-layer and physical-layer functions.
• When a link is bidirectional (carries traffic in both directions) an output port will typically be
paired with the input port for that link on the same line card.
Routing processor.
• The routing processor performs control-plane functions.
• The routing protocols maintains routing tables and attached link state information and
computes the forwarding table for the router.
Switching:
• The switching fabric is at the very heart of a router as it is through this fabric that the
packets are actually switched (i.e forwarded) from an input port to an output port.

Three types of switching:


1. Switching via memory
2. Switching via a bus
3. Switching via an interconnection network
The network core:
• Mesh of switches and links that interconnects the Internet’s end systems
• There are two fundamental approaches to move data through a network of links and
switches
1. Packet switching
2. Circuit switching

The network core: Circuit switching


The network core: Circuit switching
• The resources that are required to provide communication between the end systems are
reserved for the duration of the communication session between the end systems
• Ex: Traditional telephone networks
• Network must establish a connection between the sender and the receiver called circuit and
reserves a constant transmission rate in the network’s links for the duration of the connection.
• The sender can transfer the data to the receiver at the guaranteed constant rate.
• Consider an example of four circuit switches interconnected by four links
• Each of these links has four circuits so that each link can support four simultaneous
connections
• The hosts are directly connected to one of the switches
• When two hosts want to communicate, the network establishes a dedicated end to-end
connection between the two hosts
• If each link between adjacent switches has a transmission rate of 1 Mbps, then each end-to-end
circuit-switch connection gets 250 kbps of dedicated transmission rate.
The network core: Packet Switching
• Between source and destination each packet travels through communication links and packet
switches
• Packets are transmitted over each communication link at a rate equal to the full transmission
rate of the link
• If a source end system or a packet switch is sending a packet of L bits over a link with
transmission rate R bits/sec, then the time to transmit the packet is L / R seconds
Store-and-Forward Transmission:
• Packet switch must receive the entire packet before it begins to transmit the first bit of the
packet onto the outbound link
The network core: Packet Switching
• The source has three packets each consisting of L bits to send to the destination
• The source begins to transmit at time 0. At time L/R seconds, the source has transmitted the
entire packet and the entire packet has been received and stored at the router.
• At time L/R seconds router begins to transmit the packet onto the outbound link towards the
destination, immediately source starts second packet transmission
• At time 2L/R, the router has transmitted the entire packet and the entire packet has been
received by the destination, the router receives the second packet
• The total delay is 2L/R for first packet
• Now calculate the amount of time that elapses when the source begins to send the first packet
until the destination has received all three packets
• At time 3L/R, the destination has received the first two packets and the router has received the
third packet
• At time 4L/R the destination has received all three packets
The network core: Packet Switching
Consider sending one packet of L bits from source to destination over a path consisting of
N links each of rate R and N-1 routers between source and destination then End-to-end
delay is: N*L/R
• Packet loss: If the buffer is full, either the arriving packet or one of the already-queued
packets will be dropped
The network core:
Packet switching Circuit switching
Resources are allocated on demand Resources are reserved
Ex: Internet Ex: Traditional telephone network, Video
conference
Not possible Guaranteed delivery of data
Variable data rate Constant data rate
Resources are utilized properly Resources are not utilized properly
Variable and unpredictable end to end delay Constant and predictable end to end delay
Variable and unpredictable queuing delay Constant and predictable queuing delay
Simple, efficient and less cost Complex, less efficient and costly
Delay in Packet-Switched Networks:

Nodal Nodal delay dnodal


delay

Processing Queuing Propagation Transmission


delay delay delay delay
Processing delay dproc Queuing Delay dqueue Propagation Delay dprop Transmission Delay dtrans

The total nodal delay is given by dnodal=dproc+dqueue+dtrans+dprop


IPv4 Protocol
• The Internet Protocol version 4 (IPv4) is the delivery mechanism used by the TCP/IP
protocols.
• Network layer protocol.
• Unreliable and connectionless
• No guarantees
• No error or flow control-best effort delivery
• Packet switching networks
IPv4 datagram size in bytes=65536 bytes( 0 to 65535)
Minimum header size in bytes=20 bytes
Maximum header size in bytes=60 bytes
Version = 0100 or 0110
IPv4 datagram format
IHL or HLEN= 4 byte word ( total length of datagram header)
Min= 0101=5X4=20 bytes or max= 1111=15X 4=60 bytes

Total length =16 bits


Length of data= total length- header length

4 bytes

20 bytes
An IPv4 packet has arrived with the first 8 bits as shown:
01000010
The receiver discards the packet. Why?

In an IPv4 packet, the value of HLEN is 1000 in binary. How many bytes of
options are being carried by this packet?

In an IPv4 packet, the value of HLEN is 5, and the value of the total length
field is 0x0028. How many bytes of data are being carried by this packet?

An IPv4 packet has arrived with the first few hexadecimal digits as shown.
0x45000028000100000102 . . .
How many hops can this packet travel before being dropped? The data belong to
what upper-layer protocol?
Version = 0100 or 0110
IPv4 datagram format
IHL or HLEN= 4 byte word ( total length of datagram header)
Min= 0101=5X4=20 bytes or max= 1111=15X 4=60 bytes

Total length =16 bits


Length of data= total length- header length

4 bytes

20 bytes
Maximum transfer unit (MTU)
Fragmentation example

Flags used in fragmentation


Detailed fragmentation example
A packet has arrived with an M bit value of 0. Is this the first fragment, the
last fragment, or a middle fragment? Do we know if the packet was
fragmented?
A packet has arrived with an M bit value of 1. Is this the first fragment, the last
fragment, or a middle fragment? Do we know if the packet was fragmented?

A packet has arrived with an M bit value of 1 and a fragmentation offset value
of 0. Is this the first fragment, the last fragment, or a middle fragment?
A packet has arrived in which the offset value is 100. What is the number of the
first byte? Do we know the number of the last byte?

A packet has arrived in which the offset value is 100, the value of HLEN is 5, and
the value of the total length field is 100. What are the numbers of the first byte
and the last byte?
An IP datagram of size 5920 bytes arrives at a router. The router has to forward this packet to a network
whose maximum transmission unit is 1300 bytes. How many fragments are generated? Find the total length,
more fragment bit and fragment offset for each fragment. Assume IP header size of 20 bytes.

No. of fragments=5900/1280=4.6=5
Fragment 1:
0 to 1279bytes, Fragment offset=0/8=0, Total length=1300 bytes, M=1
Fragment 2:
1280 to 2559bytes, Fragment offset=1280/8=160, Total length=1300 bytes, M=1
Fragment 3:
2560 to 3839bytes, Fragment offset=2560/8=320, Total length=1300 bytes, M=1
Fragment 4:
3840 to 5119bytes, Fragment offset=3840/8=480, Total length=1300 bytes, M=1
Fragment 5:
5120 to 5899bytes, Fragment offset=5120/8=640, Total length=800 bytes, M=0
IPv4 ADDRESSES
• An IPv4 address is 32 bits long.
• The IPv4 addresses are unique and universal.
• The address space of IPv4 is 232 or 4,294,967,296.
Dotted-decimal notation and binary notation for an IPv4 address

Find the error, if any, in the following IPv4 addresses.


Two types of addressing

• Classful addressing
• Classless addressing

In classful addressing, the address space is divided into five classes:


A, B, C, D, and E.
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111
Solution
a. 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.
Number of blocks and block size in classful IPv4 addressing
• The first address in a block is normally not assigned to any device;
It is used as the network address that represents the organization to the rest of the
world.
Default masks for classful addressing

Given the address 23.56.7.91, find the network address.


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.

Given the address 132.6.17.85, find the network address.

Given the network address 17.0.0.0, find the class.

A network address is different from a netid. A


network address has both netid and hostid,
with 0s for the hostid.
Subnet mask

A router inside the organization receives the packet with destination


address 200.145.25.23. Show how it finds the subnetwork address to route
the packet.
200.145.25.23---destination address
255.255.255.248---subnetwork mask
200.145.25.16
Classful addressing, which is almost obsolete, is replaced with classless addressing.

Classless Addressing
In IPv4 addressing, a block of addresses can be defined as
x.y.z.t /n
in which x.y.z.t defines one of the addresses and the /n defines the mask.
• The first address in the block can be found by setting the rightmost
32 − n bits to 0s.
• The last address in the block can be found by setting the rightmost
32 − n bits to 1s.
• The number of addresses in the block can be found by using the formula
232−n.
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?
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 0010000 or 205.16.37.32.
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111 or 205.16.37.47
The value of n is 28, which means that number
of addresses is 2 32−28 or 16.
Find the first/network address, last/limited broadcast address and number of address
present in a network. The address of one of the device present in the same network is
25.34.12.56/16

n=16
32-n=32-16=16

25.34.0.0
25.34.255.255
2^16
Group 1
For this group, each customer needs 256 addresses. This
means that 8 (log2 256) bits are needed to define each
host. The prefix length is then 32 − 8 = 24. The addresses
are
Group 2
For this group, each customer needs 128 addresses. This
means that 7 (log2 128) bits are needed to define each
host. The prefix length is then 32 − 7 = 25. The addresses
are
Group 3
For this group, each customer needs 64 addresses. This
means that 6 (log264) bits are needed to each host. The
prefix length is then 32 − 6 = 26. The addresses are

Number of granted addresses to the ISP: 65,536


Number of allocated addresses by the ISP: 40,960
Number of available addresses: 24,576
1. a) In Classless addressing, the IP address of one of the host is 200.10.11.144/16, Find
i.First and last IP address in the network
ii.Total number of addresses in the network
b) Given a host address of 192.168.100.0 and a subnet mask of 255.255.255.192.
iii.Find the number of subnets created.
iv.Find the subnetwork address.
v.Find the number of hosts present per subnet.
Version = 0100 or 0110
IPv4 datagram format
IHL or HLEN= 4 byte word ( total length of datagram header)
Min= 0101=5X4=20 bytes or max= 1111=15X 4=60 bytes

Total length =16 bits


Length of data= total length- header length

4 bytes

20 bytes
Service type or differentiated services
IPv6 Datagram format:
• Expanded addressing capabilities.
• IPv6 increases the size of the IP address from 32 to 128 bits. This ensures that the world won’t
run out of IP addresses.
• In addition to unicast and multicast addresses, IPv6 has introduced a new type of address,
called an anycast address, that allows a datagram to be delivered to any one of a group of
hosts.
• A streamlined 40-byte header.
• IPv4 fields have been dropped or made optional. The resulting 40-byte fixed-length header
allows for faster processing of the IP datagram by a router.
• A new encoding of options allows for more flexible options processing.
• Flow labeling.
• IPv6 has an elusive definition of a flow. RFC 2460 states that this allows “labeling of packets
belonging to particular flows for which the sender requests special handling, such as a non-
default quality of service or real-time service.”
• For ex: audio and video transmission might likely be treated as a flow.
IPv6 Datagram format:
• On the other hand the more traditional applications such as file transfer and e-mail might not
be treated as flows.
• It is possible that the traffic carried by a high-priority user (for ex: someone paying for better
service for their traffic) might also be treated as a flow.
• The following fields are defined in IPv6:
• Version.
• This 4-bit field identifies the IP version number.
• IPv6 carries a value of 6 in this field.
• Traffic class.
• The 8-bit traffic class field, like the TOS field in IPv4, can be used to give priority to certain
datagrams within a flow, or it can be used to give priority to datagrams from certain
applications (for ex: voice-over-IP) over datagrams from other applications (for ex: SMTP e-
mail).
• Flow label.
• 20-bit field is used to identify a flow of datagrams.
IPv6 Datagram format:
• Payload length.
• This 16-bit value is treated as an unsigned integer giving the number of bytes in the IPv6
datagram following the fixed-length, 40-byte datagram header.
• Next header.
• This field identifies the protocol to which the contents (data field) of this datagram will be
delivered (for ex: to TCP or UDP).
• The field uses the same values as the protocol field in the IPv4 header.
• Hop limit.
• The contents of this field are decremented by one by each router that forwards the datagram.
• If the hop limit count reaches zero, the datagram is discarded.
• Source and destination addresses.
• Data.
• This is the payload portion of the IPv6 datagram. When the datagram reaches its destination,
the payload will be removed from the IP datagram and passed on to the protocol specified in
the next header field.
IPv6 Datagram format:
• Several fields appearing in the IPv4 datagram are no longer present in the IPv6 datagram:
• Fragmentation/reassembly.
• IPv6 does not allow for fragmentation and reassembly at intermediate routers; these operations
can be performed only by the source and destination.
• If an IPv6 datagram received by a router is too large to be forwarded over the outgoing link,
the router simply drops the datagram and sends a “Packet Too Big” ICMP error message back
to the sender.
• The sender can then resend the data, using a smaller IP datagram size.
• Fragmentation and reassembly is a time-consuming operation; removing this functionality
from the routers and placing it squarely in the end systems considerably speeds up IP
forwarding within the network.
• Header checksum.
• Because the transport-layer (for ex: TCP and UDP) and link-layer (for ex: Ethernet) protocols
in the Internet layers perform check summing, the designers of IP probably felt that this
functionality was sufficiently redundant in the network layer that it could be removed.
IPv6 Datagram format:
• As with fragmentation and reassembly, this too was a costly operation in IPv4.
• Options.
• An options field is no longer a part of the standard IP header.
• The removal of the options field results in a fixed-length 40-byteIP header.
ROUTING PROTOCOLS
• A routing table can be either static or dynamic.
• A static table is one with manual entries.
• A dynamic table is one that is updated automatically when there is a
change somewhere in the Internet.
• A routing protocol is a combination of rules and procedures that lets
routers in the Internet inform each other of changes.
Distance Vector Routing
• These protocols select the best path based on hop counts to reach a
destination network in a particular direction.
• The router shares its knowledge about the whole network to its neighbors
and accordingly updates the table based on its neighbors.
• Full routing tables are not sent in updates but only distance vector is shared.
• The sharing of information with the neighbors takes place at regular
intervals.
• It makes use of Bellman-Ford Algorithm for making routing tables.
Link State Routing

• It is a dynamic routing algorithm in which each router shares knowledge of its


neighbors with every other router in the network.
• A router sends its information about its neighbors only to all the routers through
flooding.
• Information sharing takes place only whenever there is a change.
• It makes use of Dijkstra’s Algorithm for making routing tables.
Path Vector Routing
• Maintains the path information that gets updated dynamically.
• Each entry in the routing table contains the destination network, the next router and the path
to reach the destination.
Routing Algorithms: Least Cost Algorithms
Two types:
Dijkstra and Bellman-Ford algorithms
Dijkstra algorithm:

Iteration Nodes Least cost


considered
N1 N2 N3 N4 N5 N6

1 N1 - 2 5 1(N1-
N4)  
2 N1,N4 - 2(N1- 4 - 2 
N2)
3 N1, N4,N2 - - 4 - 2(N1-N4- 
N5)
4 N1,N4,N2,N - - 3(N1- - - 4
5 N4-N5-
N3)
5 N1,N4,N2,N - - - - - 4(N1-N4-
5,N3 N5-N6)
For Practice
Dijkstra algorithm:

Iteration Nodes Least cost


considered
V1 V2 V3 V4 V5 V6 V7

1 V1 - 4 6 8   
2 V1. V2 - - 5 8 11  
3 V1, V2, V3 - -- - 7 10 9 

4 V1, V2, V3, - - - - 10 9 


V4

5 V1, V2, V3, - - - - 10 - 17


V4, V6

6 V1, V2, V3, - - - - - - 16


V4, V6,V5
Dijkstra algorithm:

Iteration Nodes Least cost


considered
V1 V2 V3 V4 V5 V6 V7

1 V1 - 4 6 8   
2 V1. V2 - - 5 8 11  
3 V1, V2, V3 - -- - 7 10 9 
4 V1, V2, V3, - - - - 10 9 
V4

5 V1, V2, V3, - - - - 10 - 17


V4, V6

6 V1, V2, V3, - - - - - - 17


V4, V6,V5
Bellman-Ford algorithm
h Lh(2) Path Lh(3) Path Lh(4) Path Lh(5) Path Lh(6) Path

0  -  -  -  -  -

1 2 N1- 5 N1-N3 1 N1-  -  -


N2 N4
2 2 N1- 4 N1-N4- 1 N1- 2 N1- 9 N1-N4-N3-
N2 N3 N4 N4- N6
N5
3 2 N1- 3 N1-N4- 1 N1- 2 N1- 4 N1-N4-N5-
N2 N5-N3 N4 N4- N6
N5
h Lh(2) Path Lh(3) Path Lh(4) Path Lh( Path Lh(6) Path Lh(7) Path
5)

0  -  -  -  -  -  -

1 4 1-2 6 1-3 8 1-4  -  -  -

2 4 1-2 5 1-2-3 7 1-2-3-4 10 1-2-3-5 9 1-2-3-6  -

3 4 1-2 5 1-2-3 7 1-2-3-4 10 1-2-3-5 9 1-2-3-6 16 1-2-3-5

4 4 1-2 5 1-2-3 7 1-2-3-4 10 1-2-3-5 9 1-2-3-6 16 1-2-3-5


For Practice

You might also like