CTEC1704 - Networks
The Network Layer
Source: https://en.wikipedia.org/wiki/File:Internet_map_1024_-_transparent,_inverted.png
Lecture Content
●
Network Layer services
●
Datagram networks
●
IP Addresses
●
IP protocol
●
Routers: forwarding
©cfi/dmu -2- CTEC1704 - Networks
References
●
Kurose & Ross; Computer Networking; Chapter 4 & 5
●
http://www.tcpipguide.com/free/t_NetworkLayerLayer3.htm
●
https://www.geeksforgeeks.org/differences-between-virtual-ci
rcuits-datagram-networks/
●
https://www.lifewire.com/top-network-routing-protocols-explai
ned-817965
●
https://www.tutorialspoint.com/network_security/network_sec
urity_data_link_layer.htm
●
https://en.wikipedia.org/wiki/Network_address_translation
●
http://www.networkerinterview.net/entries/nat/nat-network-ad
dress-translation-
©cfi/dmu -3- CTEC1704 - Networks
Post lecture discussion topics
●
Read the reference about NATting
●
Research and compare two network layer
routing protocols
●
List and describe the purpose of each
field within the headers of a link-layer
frame compared to a datagram packet
●
What are the known security issues of the
network layer?
©cfi/dmu -4- CTEC1704 - Networks
Lecture Content
●
Network Layer services
●
Datagram networks
●
IP Addresses
●
IP protocol
●
Routers: forwarding
©cfi/dmu -5- CTEC1704 - Networks
Inside the Network Layer
©cfi/dmu -6- CTEC1704 - Networks
Functions of the Network Layer
• Data Plane
– local logic
• Control Plane
– network-wide logic
• Forwarding/Routing
– determine the path taken by packets
through the network
– network-wide activity
– determines and adjust forwarding tables
©cfi/dmu -7- CTEC1704 - Networks
©cfi/dmu -8- CTEC1704 - Networks
Services the Network Layer
can provide
• Guaranteed Delivery:
– packet will eventually arrive
• Guaranteed Delivery with bounded delay:
– packet will arrive within a certain time
• In-order packet delivery:
– packets arrive at destination in order they
were sent
©cfi/dmu -9- CTEC1704 - Networks
Services the Network Layer
can provide
• Guaranteed minimal bandwidth:
– emulates a specific bit rate (e.g. 1 Mbps)
• Guaranteed maximal jitter:
– time between the arrival of two packets is equal to the time
between sending the packets
●
with a defined margin of error
• Security Services:
– integrity
– confidentiality
– authentication
©cfi/dmu - 10 - CTEC1704 - Networks
Lecture Content
●
Network Layer services
●
Datagram networks
●
IP Addresses
●
IP protocol
●
Routers: forwarding
©cfi/dmu - 11 - CTEC1704 - Networks
Network Service Types
●
Virtual Circuits
●
connection-oriented service
●
Datagram networks
●
connection-less services
©cfi/dmu - 12 - CTEC1704 - Networks
Datagram Network
• Each datagram (packet) is forwarded independently based
upon its destination address
– in the header field
©cfi/dmu - 13 - CTEC1704 - Networks
Datagram Network
• Router forwards packets based on a
forwarding table
– maps from destination addresses to
interfaces
• Matching is performed on a longest prefix
basis
©cfi/dmu - 14 - CTEC1704 - Networks
Lecture Content
●
Network Layer services
●
Datagram networks
●
IP Addresses
●
IP protocol
●
Routers: forwarding
©cfi/dmu - 15 - CTEC1704 - Networks
Internet Protocol Addresses
• IP address
– numerical label assigned to each device
connected to a computer network that
uses the Internet Protocol for
communication
• Two main functions
– location addressing
– host number
●
NIC identification
– (network interface card)
©cfi/dmu - 16 - CTEC1704 - Networks
Internet Protocol Addresses
• IP address space managed
– Globally
●
Internet Assigned Numbers Authority (IANA)
– Regionally
●
5 Regional Internet registries (RIRs)
●
responsible in their designated
territories for assignment to local
Internet registries
●
eg ISPs, and other end users
©cfi/dmu - 17 - CTEC1704 - Networks
Internet Protocol Addresses
• IPv4 addresses were distributed by IANA to the
RIRs in blocks of approximately 16.8 million
addresses each
– exhausted at the IANA level since 2011
some IPv4 addresses are reserved for
private networks and are not globally
unique
●
DMU uses the class A 10 network
– look at the IP address on your
phone ...
©cfi/dmu - 18 - CTEC1704 - Networks
IP Addresses
• IPv4 addresses are 32 bits long (4 bytes)
• There are 232 = approx. 4 billion possible
addresses
• Typically written in dotted decimal notation
(octets):
11000001 00100000 11011000 00001001
193 .32 .216 .9
©cfi/dmu - 19 - CTEC1704 - Networks
IP Addresses
• Originally, IPv4 address space was split up
into 5 “classes”
– A to E
• Talk about “/8” (pronounced “slash 8”) blocks
• 256 such blocks
• numbered 0/8 to 255/8
• Each /8 block has 254 (about 16.7 million)
addresses
©cfi/dmu - 20 - CTEC1704 - Networks
Subnet Masking
• IP address classes: C =/24 ; B =/16 ; A =/8
• Subnet mask “masks” the subnet bits
• ie
– subnet mask = 255.255.255.0/24
●
class C network
– subnet mask = 255.255.0.0/16
●
class B network
• Eg IPv4 address = 192.0.2.1
– subnet mask = 255.255.255.0
– 254 possible host addresses
●
but one address is the network gateway
©cfi/dmu - 21 - CTEC1704 - Networks
Localhost
• Local loopback
127.0.0.1
localhost
• Used for testing
©cfi/dmu - 22 - CTEC1704 - Networks
IP Addresses
Three class C local subnets connected by a router
netmask = 255.255.255.0
4th octet = host machine number
223.1.1.0/24
223.1.2.0/24
224.1.3.0/24
©cfi/dmu - 23 - CTEC1704 - Networks
IP Address Exhaustion
https://en.wikipedia.org/wiki/IPv4_address_exhaustion
• IPv4 address space was exhausted in 2011
– anticipated in ~1988
• Solutions
– CIDR
– Network Address Translation
– IPv6 (128 bit addresses) - 1998
©cfi/dmu - 24 - CTEC1704 - Networks
CIDR
• Classless Interdomain Routing
–
(CIDR, RFC 4632)
• The 32 bit IP address is divided into two
parts
–
written as a.b.c.d/x
–
where x is the number of bits in the first
part of the address
• The x most significant bits are known as
the network prefix
• Router only needs to consider network
prefix
©cfi/dmu - 25 - CTEC1704 - Networks
CIDR
●
Variable length subnet masks
●
200.23.16.0/26
11001000 00010111 00010000 00000000
26 - 2 = 62 host addresses
●
200.23.16.0/20
11001000 00010111 00010000 00000000
212 - 2 = 4,094 host addresses
●
199.31.0.0/16
11000111 00011111 00000000 00000000
216 - 2 = 65,534 host addresses
●
Try this CIDR subnet calculator
©cfi/dmu - 26 - CTEC1704 - Networks
IPv6
• IPv6 increased address space to 128 bits
• Streamlined 40 byte fixed-length header
• Traffic Class can be used to give priorities.
• Flow Label is used to mark packets to belong to a particular flow, e.g. for special QoS
requirements or real-time traffic
• RFC1752 and 2460
©cfi/dmu - 27 - CTEC1704 - Networks
IPv6 vs IPv4
• IPv6 does not allow fragmentation
– if a packet is too large to transmit, the router
returns an ICMP error message
●
RFC 4443 ICMPv6
– sending host must resubmit smaller datagrams
●
MTU is indicated in the ICMP error message
• IPv6 does not do a header check sum
– this is already done at link-layer and
transport-layer
●
saves processing time
©cfi/dmu - 28 - CTEC1704 - Networks
How to get an IP address
• How does a host get an IP address in
the first place?
• Two options:
– Static IP address assigned by an
administrator
– Dynamic IP address obtained through
Dynamic Host Configuration Protocol
– service that “leases” IP addresses to hosts
©cfi/dmu - 29 - CTEC1704 - Networks
Lecture Content
●
Network Layer services
●
Datagram networks
●
IP Addresses
●
IP protocol
●
Routers: forwarding
©cfi/dmu - 30 - CTEC1704 - Networks
IPv4 Datagrams
• Version number
• Header length (20
bytes w/o options)
• Type of service to
distinguish
different uses such
as for real-time
datagrams
• Datagram length
(total, in bytes),
max 65,535 bytes
(= 216 - 1)
©cfi/dmu - 31 - CTEC1704 - Networks
IPv4 Datagrams
• Identifier, flags,
fragmentation
offset
• time-to-live (TTL)
• ensures
datagrams do not
circulate forever
• decremented at
each router
©cfi/dmu - 32 - CTEC1704 - Networks
IPv4 Datagrams
• Protocol:
• Glue to the transport
layer
• TCP=6, UDP=17
• Header checksum
• Needs to be
recomputed at every
router
• Normal to discard
datagrams that are
corrupted
©cfi/dmu - 33 - CTEC1704 - Networks
IPv4 Datagrams
• Source and
Destination IP
addresses
• Options (used
rarely and not part
of IPv6)
• Data
• Normally contains
a transport layer
segment (TCP/UDP)
or ICMP message
©cfi/dmu - 34 - CTEC1704 - Networks
Lecture Content
●
Network Layer services
●
Datagram networks
●
IP Addresses
●
IP protocol
●
Routers: forwarding
©cfi/dmu - 35 - CTEC1704 - Networks
What is a Router?
●
Device that connects two or more packet-
switched networks or subnetworks
●
Two primary functions:
– manages traffic between these networks by
forwarding data packets to their intended IP
addresses
– allows multiple devices to use the same
Internet connection
●
Routing decision made by reference to a
routing table
©cfi/dmu - 36 - CTEC1704 - Networks
Example of forwarding tables
©cfi/dmu - 37 - CTEC1704 - Networks
Inside a Router
©cfi/dmu - 38 - CTEC1704 - Networks
Routing Protocols
●
Routing Information Protocol
●
Open Shortest Path First
●
Border Gateway Protocol
©cfi/dmu - 39 - CTEC1704 - Networks
Routing Protocols
●
Routing Information Protocol
●
Open Shortest Path First
●
Border Gateway Protocol
©cfi/dmu - 40 - CTEC1704 - Networks
Routing Protocols
●
Routing Information Protocol
●
Open Shortest Path First
●
Border Gateway Protocol
©cfi/dmu - 41 - CTEC1704 - Networks
Lecture Contents
• Network Layer services
• Datagram networks
• IP Addresses
• IP protocol
• Routers:
– forwarding
©cfi/dmu - 42 - CTEC1704 - Networks