COMP30023 – Computer Systems
Internet (Network) Layer – IP Addresses and Packet Switching
Dr Lachlan Andrew
© University of Melbourne 2020
Recap
Covered Application and Transport Layers
© University of Melbourne 2021
2
Next four lectures
• Network / Internet layer
• Addresses and Packet switching
• Subnets and network address translation (NAT) • Routing
• Internet layer control protocols
© University of Melbourne 2021
3
Summary
• Initial look at the Internet Layer
• High level discussion of Quality of Service
• IP addressing
© University of Melbourne 2021
4
Internet (network) Layer
• Role: get data from the source all the way to the destination • May not be in a single hop (point-to-point link)
• Traffic must be routed efficiently
• This is performed by network devices called routers
• Nodes must be given names (addresses)
• “Internet” is a network of networks
• “Internet Layer” is a sublayer at the top of the network layer
• In an internet, the source and destination may be in different networks. A “hop” is a whole network.
© University of Melbourne 2021
5
Internetworking and Routing
• Connecting multiple networks
© University of Melbourne 2021
6
Network Layer
• Most Network Layer code runs on routers
• We will refer to the protocol data units as packets
• What types of services does the Network Layer provide?
• Connectionless
• Packet switching (Internet Protocol – IP)
• Minimum required service: “send packet” • Called “datagram” network
• Connection-oriented
• (virtual) Circuit Switching
• Asynchronous Transfer Mode – ATM • MultiProtocol Label Switching MPLS
• Called “virtual circuit” network
• These usually act as a single “link” of an IP network
© University of Melbourne 2021
7
Store-and-Forward Packet Switching
• The internet is a packet switched network
• Host H1 wants to send a packet to H2
1. Transmits it to the nearest router (A)
2. The packet is buffered while it is arriving, and the checksum is verified
3. If valid, the packet is stored until the outgoing interface is free
4. The router forwards the packet onto the next router in the path
5. Repeat 2-4
© University of Melbourne 2021
8
Packet forwarding – Connectionless
Paths can change for packets in
the same transport layer connection
Forwarding tables (also called routing tables)
© University of Melbourne 2021
9
Packet forwarding – Connection-oriented
Forwarding table:
“In”: connection ID “Out”: next hop and new connection number
Connection number is local to a hop
© University of Melbourne 2021
10
Internet Layer
• Connection-oriented vs Connectionless
Issue
Datagram Network
Virtual Circuit
Type
Connectionless
Connection-oriented
Addressing
(-) Each packet has full source and destination
(+) Each packet contains a short VC number
State
+ Routers do not hold state information about connections
– Each VC requires router table space.
– Router reboots a problem.
Routing
Each packet independently
Defined at set-up
Quality of Service
– Difficult
+ Easy if enough resources
Congestion control
– Difficult
+ Easy if enough resources
Link failure recover
+ Simple
– Extra work
© University of Melbourne 2021
11
MultiProtocol Label Switching
• Widely deployed Virtual Circuit (connection-oriented) Network Layer Protocol (below the internet sublayer)
• MPLS network is one IP hop
• Primary purpose is Quality of Service
• Prioritising traffic
• Service Level Agreements for network performance • Reliable connectivity with known parameters
• Popular with businesses that want to connect multiple sites and phone companies carrying voice traffic
• Expensive: Price roughly 20-100 times more per Mbps than a standard internet connection. (Cost is much more similar.)
• https://www.networkworld.com/article/2222196/why-does-mpls-cost- so-much-more-than-internet-connectivity-.html
© University of Melbourne 2021
12
Quality of Service
• Why is Quality of Service (QoS) important?
• Not all services are equally important or robust to network delay • VoIP vs file downloads
• VPN connections vs web browsing
• Within your own network, or within a single administered network (ISP), services can be prioritised
• Own network – typically explicitly
• Shared network – typically implicitly (ISP traffic shaping)
• In the case of explicit prioritisation, the Differentiated Services header can be used to define classes of traffic
• Useful in an office building with a network that carries both internet and telephony traffic
© University of Melbourne 2021
13
Network Layer
• Be aware that
• connection-oriented services exist, and
• the concept of Quality of Service is important
• Our focus will be on the connectionless Internet Protocol that forms the backbone of the internet
© University of Melbourne 2021
14
Internet Protocol
• Designed with a number of principles in mind, including:
– SomethingthatworksOKisbetterthananidealstandard“inprogress” • Standard of “OK” has gone up as the Internet has become vital
– Keepitsimple–Occam’sRazor
– Bestrictwhensendingandtolerantwhenreceiving
• E.g., web browsers handle pages with invalid HTML
– Makeclearchoices–don’thavedifferentapproachesinastandard
– Avoid static options and parameters – negotiate them at runtime
– (New principle: Think about scalability)
• “Best effort”, not guaranteed performance
© University of Melbourne 2021
16
Internet Protocol
• Responsible for moving the packets through the various networks from source to destination host
• Multiple paths through the network – Importantforredundancy
• Routing algorithms are used to determine best path – Wewilllookintothesemorenextweek
• Nothing guaranteed – just “best effort”
© University of Melbourne 2021
17
IP Version 4 Protocol (IPv4)
Field
Version
IHL
Usage
Protocol version 4
(This field is also in IPv6)
IP header
Differentiated services
Total length
Identification, DF, MF, Fragment Offset
Time to live (TTL)
Protocol
Source and Destination
Options
Header length in 32 bit words; min 5, max 15
6 bits for service class, 2 bits for congestion control (ECN)
Including payload, max 65,535
Used in the handling of fragmentation
Countdown of hops, at zero packet is discarded
Transport layer service (TCP/UDP/SCTP/DCCP/etc.)
IPv4 address
Rarely used and poorly supported
© University of Melbourne 2021
18
IPv4 Addresses
• 32-bit number
• Expressed in decimal notation, each byte is shown as a
decimal, separated by a period, 172.22.44.10 (0xAC162C0A)
• 0.0.0.0 is lowest, 255.255.255.255 is highest
• Overall IP allocation responsibility of Internet Corporation for Assigned Names and Numbers (ICANN) by delegation to IANA and Regional Internet Registries (RIR’s)
• IP addresses are given to interfaces not hosts, i.e. a host with multiple network cards will have multiple IP addresses
• Supply of IPv4 addresses has basically been exhausted
© University of Melbourne 2021
19
Types of address
• Unicast: One destination (“normal” address)
• Broadcast: Send to everyone
• Multicast: Send to a particular set of nodes – Usedforstreamingvideoofliveevents
• Anycast: Send to any one of a set of addresses – Usedfordatabasequeries,likeDNS,NTP
• Geocast: Send to all users in a geographic area – “Locationaware”services
– Sendadtothoseinstore
– Sendwarningtothosenearahazard
Were thought to be the only types
Not widely used. To show that
the above aren’t all
© University of Melbourne 2021
20
IPv4 Addresses – Classes
(no longer used, but spoken of)
• Originally IP addresses were allocated based on classes
• Routing was performed based on the class, which could be derived from the first part of the address
© University of Melbourne 2021
21
IP Addresses – CIDR
• Classes simplify routing
– sizeof“network”fieldisimplicitintheaddress
• Wasteful. Networks often much bigger than needed
– Networkwith260nodesmustbeclassBwith65,536addresses
• Classless InterDomain Routing
– Eachinterface/routeexplicitlyspecifieswhichbitsarethe
“network” field
– Networkwith260nodesonlyneeds9bitsfor“host”field
512 addresses
Can have 128 times as many of these networks as class B networks
© University of Melbourne 2021
22
IP Addresses – CIDR
• Hierarchical – encodes the network and host number – Networkintopbits
– Hostinbottombits
• Assigned to networks in blocks, the network part will be the
same for all hosts on that network
– AnetworkcorrespondstoacontiguousblockofIPaddressspace, called a prefix
– PrefixesarewrittenasthelowestIPaddressfollowedbyaslashand the size of the network portion – 192.0.2.0/24
© University of Melbourne 2021
23
IP Addresses – Blocks
• In the case of 192.0.2.0/24
– 24bitsareforthenetwork192.0.2.0
– Leaving8bitsforhosts–upto256addresses
• In the case of 10.0.0.0/8 (reserved private block)
– 8bitsareforthenetwork10.0.0.0
– Leaving24bitsforhosts–upto16,777,216addresses
• Can also be written as a subnet mask, a binary mask of 1’s – Inthecaseof/24:thesubnetmaskis255.255.255.0
© University of Melbourne 2021
24
IP Addresses – Prefixing
• Network number = network mask (bitwise-AND) IP address
• This is crucial for efficient routing on the internet
– Sincenetworksareassignedinblocks,intermediaryroutersneed only maintain routes for the prefixes, not every individual host
– Onlywhenthepacketarrivesatthedestinationnetworkdoesthe host portion need to be read
© University of Melbourne 2021
25
IP Addresses – Route aggregation
• Aggregation is performed automatically
• Currently it roughly halves the size of the routing table
• Prefixes can overlap, in which case the longest matching prefix is selected
© University of Melbourne 2021
26
Special IP Addresses
Private address range
10.0.0.0 – 10.255.255.255
Prefix & Mask
10.0.0.0/8 (255.0.0.0)
Available Addresses
16,777,216
172.16.0.0 – 172.31.255.255
172.16.0.0/12 (255.240.0.0)
1,048,576
192.168.0.0 – 192.168.255.255
Link local / zero config
169.254.0.0 – 169.254.255.255
192.168.0.0/16 (255.255.0.0)
169.254.0.0/16 (255.255.0.0)
65,536
65,536
/Placeholder for “invalid” address
© University of Melbourne 2021
27
Important ones
IPv6
• Designed over 20 years ago to address the problem of exhausting the IPv4 address space
• Whilst solving that problem some other changes were made
– Simplerheader–allowsfasterprocessing
– Improvedsecurity–nowback-portedtoIPv4 – FurtherQualityofServicesupport
• IPv6 addresses are 128 bits – Unlikelyevertorunout…
– …unlessnewwastefulallocationschemesareused.
© University of Melbourne 2021
31
IPv6 Header
Field
Usage
Version
6
Differentiated services
6 bits for service class, 2 bits for congestion control (ECN)
Flow label
Pseudo-Virtual Circuit identifier
Payload length
Bytes after the 40 byte header
Next header
Used to specify additional headers or Protocol (TCP/UDP)
Hop limit
Same as TTL (Time To Live)
Source and Destination
16 bytes IPv6 addresses
© University of Melbourne 2021
32
IPv6 Addressing
• Written as 8 groups of (up to) 4 hex digits – 8000:0000:0000:0000:0123:4567:89AB:CDEF
• Can be optimised by stripping one group of consecutive 0’s – 8000::123:4567:89AB:CDEF
• Backwards compatibility with IPv4 is achieved with
– ::ffff:192.31.2.46 (note the mix of hex with decimal)
• Still not widely deployed
– GooglemeasuresIPv6requests–stillaround34%globally,
(~24% in Australia)
• Fairly widely supported – likely to see a sudden growth in the next few years
© University of Melbourne 2021
33
And finally…
• One of the disadvantages of a hierarchical address space is that it can be quite wasteful if not carefully assigned, i.e. large parts of the address space unused if blocks badly assigned
• Combined with the scarcity (exhaustion) of available IP addresses, they have become a valuable commodity
• Not intended to be sold, should really be returned to the assigning body for reallocation
• Early adopters of IPv6 were able to sell their IPv4 address space at a premium
© University of Melbourne 2021
34
Acknowledgement
• The slides are based on slides prepared by Chris Culnane based on material developed previously by: Michael Kirley, Zoltan Somogyi, Rao Kotagiri, James Bailey and Chris Leckie.
• Some of the images included in the notes were supplied as part of the teaching resources accompanying the text books listed in lecture 1.
© University of Melbourne 2021
35