OSI Network Layer Laurent Babout, PhD, DSc Based on Cisco CCNA Objectives • • • • • • Identify the role of the Network Layer, as it describes communication from one.
Download
Report
Transcript OSI Network Layer Laurent Babout, PhD, DSc Based on Cisco CCNA Objectives • • • • • • Identify the role of the Network Layer, as it describes communication from one.
OSI Network Layer
Laurent Babout, PhD, DSc
Based on Cisco CCNA
Objectives
•
•
•
•
•
•
Identify the role of the Network Layer, as it describes
communication from one end device to another end device
Examine the most common Network Layer protocol, Internet
Protocol (IP), and its features for providing connectionless and
best-effort service
Understand IP addressing and subnetworking
Understand the principles used to guide the division or grouping
of devices into networks
Understand the hierarchical addressing of devices and how this
allows communication between networks
Understand the fundamentals of routes, next hop addresses and
packet forwarding to a destination network
2
Network Layer Protocols and Internet
Protocol (IP)
• The main tasks of Layer 3:
–
–
–
–
Addressing
Encapsulation
Routing
Decapsulation
• Encapsulation of
segment (layer 4 PDU)
into packet
• Routers analyse packet
to direct then to their
destination
3
Network Layer Protocols and Internet
Protocol (IP)
• Role of IPv4 (Internet Protocol v4) (RFC 791)
– Connectionless – No connection is established
before sending data packets
– Best effort (unreliable) – No overhead is used to
guarantee packet delivery (done by other layer)
– Media independent - Operate independently of the
medium carrying the data
4
IPv4 #1
• Connectionless
– Connection is the problem of layer 4 (Transport
layer), for instance TCP (3-way handshake)
• Analogy to a letter sent without notification
5
IPv4 #2
• Why is it “unreliable”?
– Small header, less delay in delivery. Reduce burden on the
network during packet transport
– Unreliable means simply that IP does not have the
capability to manage, and recover from, undelivered or
corrupt packets
• No acknowledgment
• No data checking
• No packet tracking / retransmission
6
IPv4 #3
• Medium independent
– Responsibility of Layer 2 Data link layer to format
frames for transmission on the desired media
– One thing that IP cares of: maximum size of PDU
that medium can transport (MTU: Maximal
Transmission Unit)
– Router can split packet if transmission from media
to media with smaller MTU
7
IPv4 #4
• Header of 20 bytes encapsulating segment
(transport layer)
Data QoS priority: enables router to give
priority to voice and network route info over
regular data
No. of hops before packet is dropped: value
InfoPrevent
about protocol
decremented at each hop.
packet management
being trapped in rootingValue:
loops TCP / UDP.
Control flag such as DFAllow
(Don’t
Fragment)
receiver
to determine the place of a particular
or MF (More Fragment)fragment in the original IP datagram. Useful if MF=1
IP address of the source. Remains unchanged
during transmission. Allow destination to respond
IP address of the destination Remains unchanged
to the source if required
during transmission.Enables routers to forward packet
to next hop towards the destination
8
IPv4 #5
• Wireshark example
9
Grouping Devices into Networks and
Hierarchical Addressing #1
• Why grouping devices into sub-networks?
– More practical and manageable to group hosts into
specific network (called subnet)
– Geography, purpose or ownership are factors that
influence subneting
10
Grouping Devices into Networks and
Hierarchical Addressing #2
• Dividing a large network can increase network performance
– Change a middle switch by a router allows to create 2 IP subnets,
hence 2 distinct broadcast domains. All devices are connected but
local broadcasts are contained
11
Grouping Devices into Networks and
Hierarchical Addressing #3
• Dividing a large network can also increase network security
– Here student and researcher networks have different security levels
– Access granted within network but denied outside using firewall
12
Grouping Devices into Networks and
Hierarchical Addressing #4
• Why the intermediary device (aka. gateway) within a
network is so useful in a network?
– A host has the addresses of other host in its own network
– If it does know the destination address, packets directed
outside via the gateway
13
Grouping Devices into Networks and
Hierarchical Addressing #5
• Hierarchical addressing solves the problem of devices
communicating across networks of networks
– Uniquely identify each host
– Has levels that assist in forwarding packets across internetworks
• Analogy to mail delivery: the level of info from the
address is not analyzed in the same way by post-offices
during transit
14
Grouping Devices into Networks and
Hierarchical Addressing #6
• The same for IP addresses
– Address contains prefix (portion) part which corresponds to
the network where the host is located
– 32-bit mask indicates the prefix (number of consecutive 1s
makes prefix length)
• To divide network, network portion extended to borrow
bits from host part: subnetworking
15
Subnetworking #1
• Classes A, B, C allow to have networks of
different size on the net
16
Subnetworking #2
• How to determine the network, the subnet and the
number of possible hosts knowing one host IP address
and the mask (prefix)?
• Example: 172.16.132.70/20
Prefix length 20 means:
11111111.11111111.11110000.00000000 in bits representation
OR
255.255.240.0 in decimal representation
172. 16.132.70 in bit representation is:
10101100.00010000.10000100.01000110
17
Subnetworking #3
• AND operation between IP address and mask to
calculate network
10101100.00010000.10000100.01000110
AND
11111111.11111111.11110000.00000000
=
10101100.00010000.10000000.00000000
• So, network address is: 172.16.128.0
18
Subnetworking #4
• How to calculate number of subnets?
– First need to know the address class
• 172. 16.132.70 is a class B (N.N.H.H), so network part considers 2
first octets (so 16 first bits)
– We know that the prefix length is 20, so 20-16=4 bits have
been borrowed from the host part of the address
– The number of maximum subnet is 24=16
– The number of hosts per subnet is 232-20 – 2 = 212 – 2 = 4094
• To be more general, if prefix length is m and borrowed
number of bits is n for IPv4 address:
– 2n maximum subnets
– 232-m – 2 hosts per subnet (first: network address, last:
broadcast address)
19
Subnetworking #4
• So subnet IDs for network 172.16.128.0/20 are:
–
–
–
–
–
–
–
–
#0: 172.16.128.0 (hosts: 172.16.128.1 to 172.16.143.254)
#1: 172.16.144.0 (hosts: 172.16.144.1 to 172.16.159.254)
#2: 172.16.160.0 (hosts: 172.16.160.1 to 172.16.175.254)
#3: 172.16.176.0 (hosts: 172.16.176.1 to 172.16.191.254)
#4: 172.16.192.0 (hosts: 172.16.192.1 to 172.16.207.254)
#5: 172.16.208.0 (hosts: 172.16.208.1 to 172.16.223.254)
#6: 172.16.224.0 (hosts: 172.16.224.1 to 172.16.239.254)
#7: 172.16.240.0 (hosts: 172.16.240.1 to 172.16.255.254)
20
Fundamentals of Routes #1
• From IP address and mask, we can figure out easily
what is the network the host belongs to
• Outside, no a priori knowledge of the other networks
• Send to gateway!!!
• Usually, gateway
is using either the
first or the last host
address of subnet
21
Fundamentals of Routes #2
• Trace the steps of an IP packet as it traverses
unchanged via routers from sub network to
sub-network
22
Fundamentals of Routes #3
• Default gateway
23
Next Hop Addresses #1
• For a router to know where to send the packet, it
needs to know what is its next hop
• Information provided into the routing table
24
Next Hop Addresses #2
• Local routing table output using show ip route
• Besides next hop, also info about metric and
destination network
• Router matches destination address with destination
network of a route
• If more than 1
possible route,
routing table
shows the one
with lowest metric
value
2
25
Next Hop Addresses #3
• In set, a default route is used to forward packets
with destination address not part of the routing
table
• Default address route: 0.0.0.0
• Packets sent to the Gateway of Last Resort
2
26
Next Hop Addresses #4
• Routing table can be built manually or dynamically
• Static routing: router set manually.
• Major problem: topology changed (e.g. router down).
Network
11.1.1.0/24
Router C:
192.168.1.1/24
Configured manually as
next hop for
networks 192.168.2.0/24
and 11.1.1.0/24
and 192.168.1.0/24
and 11.1.1.0/24
27
Next Hop Addresses #5
• Static: IP routes for 3 routers
Network
11.1.1.0/24
Router C
Router A
CLASSLESS
Router B
28
Next Hop Address #6
• Dynamic routing
– RIP, OSPF, EIGRP
– When changes done one own router, passes info to
adjacent routers, and so on until idempotence
Network
11.1.1.0/24
29
Next Hop Address #7
• RIP: IP routes for 3 routers
Network
11.1.1.0/24
Router A
Router C
CLASSFUL
Router B
30