07 Network Data
07 Network Data
Application Application
Message M M
Transport Transport
Segment Ht M Ht M
Network Network
Datagram Hn Ht M Hn Ht M Hn Ht M Hn Ht M
Data Link Data Link
Frame Hl Hn Ht M Hl Hn Ht M Hl Hn Ht M H l H n Ht M
Physical Physical
2
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
Sidebar: Network Neutrality
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
Sidebar: Network Neutrality
4
Communication at the Network Layer
Network layer provides a logical
connection between hosts
• Transport segments from source to
destination
• Sender: encapsulates segment from
transport layer into datagrams, passes
to data link layer (called packetization)
• Receiver: reassembles datagrams,
delivers segments to transport layer
6
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
Sidebar: Network Neutrality
Packet Switching
Routers
• Examine header fields in all IP datagrams passing through it
• Moves datagrams from input ports to output ports to transfer datagrams
along end-to-end path
A router creates a connection between an input port and an output
port (or a set of output ports)
Two approaches for packet switching:
• Datagram approach (connectionless service)
• Virtual-circuit approach (connection-oriented service)
8
Connectionless Packet-Switched Network
Datagram approach
• Earlier when Internet started, to make it simple, network layer was designed
to provide a connectionless service (treats each packet independently, with
no relationship to any other packet)
• Network layer is only responsible for delivery of packets from source to
destination
• Packets in a message may or may not travel the same path to their
destination
10
What is Inside a Router?
High-level view of generic router architecture:
• Input and output ports
• Switching fabric: transfer packet from input link to appropriate output link
routing, management
routing control plane (software)
processor operates in millisecond
time frame
forwarding data plane
(hardware) operates
in nanosecond
timeframe
high-speed
switching
fabric
11
lookup,
data link
layer forwarding
line switching
termination protocol fabric
(receive)
queueing
physical layer:
bit-level reception
Decentralized switching:
data link layer: Using header field values, lookup output port using
e.g., Ethernet forwarding table in input port memory
Need to complete input port processing at ‘line speed’
Forward based on header field values
Input port queuing: if datagrams arrive faster than
forwarding rate into switch fabric
ELEC 8560 - Computer Networks - Dr. Sakr 12
12
Performance of Network Layer
Performance of a network can be measured in terms of
• Bandwidth: How much data could theoretically be transferred (bps)
• Throughput: How much data was actually transferred (bps)
• Latency (or Delay): How long it takes for an entire message to arrive
• Four types: processing, queueing, transmission, and propagation
• Packet loss: When a queue is full, next packets dropped
• For example, arrival rate > transmission rate
• Bandwidth-delay product
• Jitter
• and more ..
13
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
Sidebar: Network Neutrality
14
Network Layer in the Internet
Network layer in the Internet has gone through several versions, but
only two versions have survived:
• Internet Protocol Version 4 (IPv4)
• Internet Protocol Version 6 (IPv6)
15
16
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• IPv4
Sidebar: Network Neutrality
17
IPv4 Addressing
128.11.1.1
IP address:
128.11.2.1
• 32-bit identifier used in the IP layer of
128.11.1.2
the TCP/IP protocol suite 128.11.1.4 128.11.2.9
18
Address Space
Address space is the total number of addresses used by the protocol
IPv4 uses 32-bit addresses, which means that the address space is 232
or 4,294,967,296 (more than four billion)
If there were no restrictions, more than 4 billion devices could be
connected to the Internet
19
Subnets
IPv4 divided into two parts (i.e., hierarchy):
• Prefix, high order bits to define the network (subnet)
• Suffix, low order bits to define the connection to node (host)
subnet 223.1.1.0/24
223.1.1.1 subnet 223.1.2.0/24
223.1.2.1
223.1.1.2
Example: 223.1.1.4 223.1.2.9
20
Example: Define Subnets 223.1.1.2
subnet 223.1.1/24
List all subnets in the given network. 223.1.1.1
Assume /24 subnet masks 223.1.1.4
Solution: 223.1.1.3
Detach each interface from its host or router
223.1.9.2 223.1.7.0
Each isolated network is a subnet subnet 223.1.7/24
subnet 223.1.9/24
223.1.9.1 223.1.7.1
223.1.8.1 223.1.8.0
21
Subnet Addressing
Classful Addressing:
• When the Internet started, IPv4
address space was divided into
five classes with fixed-length prefix
Classless Addressing:
• With the growth of the Internet, larger address space was needed
• Use variable-length blocks that belong to no class (instead of only 5 classes)
22
Slash Notation (CIDR) for Classless Addressing
CIDR: Classless Inter-Domain Routing (pronounced “cider”)
• Subnet portion of address of variable length
• Address format: a.b.c.d/n, where n is number of bits in subnet portion of
address
Octet
• Examples:
• 12.24.76.5/8
• 23.14.67.92/12
• 220.8.24.255/25
23
• Last address: keep n leftmost bits, set (32-n) rightmost bits all to 1s
Note:
• First and last address are not usable (network address and broadcasting)
24
Example: CIDR
A classless address is given as 167.199.170.82/27. Find the number of addresses in
the block, the first address, and the last address.
Solution:
Number of address in the block = 232-27 = 32
Address: 167.199.170.82/27 10100111 11000111 10101010 01010010
First address: 167.199.170.64/27 10100111 11000111 10101010 01000000
Last address: 167.199.170.95/27 10100111 11000111 10101010 01011111
25
Subnet Mask
Another way for classless addressing is to use the subnet mask
• A 32-bit number with n leftmost bits set to 1s and the rest of (32-n) set to 0s
Example:
• /27 is equivalent to 11111111 11111111 11111111 1110000 =
255.255.255.224
26
Example: Subnet Mask
A classless address is given as 167.199.170.82 and subnet mask 255.255.255.224.
Find the number of addresses in the block, the first address, and the last address.
Solution:
Mask: 11111111 11111111 11111111 11100000
Number of addresses in the block = 25 = 32 addresses
First address: = (address) AND (mask)
= 10100111 11000111 10101010 01010010 AND
11111111 11111111 11111111 11100000
= 10100111 11000111 10101010 01000000
= 167.199.170.64
Last address: = (address) OR (NOT mask)
= 10100111 11000111 10101010 01010010 OR
00000000 00000000 00000000 00011111
= 10100111 11000111 10101010 01011111
= 167.199.170.95
27
28
Network Address
Internet Corporation for Assigned Names and Numbers (ICANN)
assigns a large block of addresses to an ISP
Network gets allocated portion of its provider ISP address space
ISP can then allocate out its address space for smaller subnets
• e.g., 1 block, 2 blocks, 4 blocks, etc.
29
30
Designing a Subnet
Number of addresses Nsub in any subnetwork must be a power of 2
Prefix length nsub of a subnetwork = 32 – log2Nsub
Start by assigning address to larger subnetworks
31
32
Example: Designing a Subnet (cont.)
b. Number of addresses in the second largest subblock, which requires 60
addresses, is not a power of 2, we allocate 64 addresses
• subnet mask for this subnet can be found as n2 = 32 − log2 64 = 26
• first address in this block is 14.24.74.128/26; last address is 14.24.74.191/26
c. Number of addresses in the smallest subblock, which requires 10 addresses, is
not a power of 2, we allocate 16 addresses
• subnet mask for this subnet can be found as n1 = 32 − log2 16 = 28
• first address in this block is 14.24.74.192/28; the last address is 14.24.74.207/28
We only allocated 208 addresses, which means 48 addresses are left in reserve
• first address in this range is 14.24.74.208.; last address is 14.24.74.255
33
Address Aggregation
After assigning small blocks of addresses to organizations by the ISP:
• ISP combines subblocks into one single block and advertises the larger block
to the rest of the world
• Any packet destined for this larger block should be sent to this ISP
• ISP to forward the packet to the appropriate organization
34
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• DHCP
Sidebar: Network Neutrality
35
36
Dynamic Host Configuration Protocol (DHCP)
DHCP is an application-layer protocol
When a host joins network, DHCP server automatically assigns IP
address (and other communication parameters) to the host using a
client-server architecture
• Host broadcasts DHCP discover msg [optional]
• DHCP server responds with DHCP offer msg [optional]
• Host requests IP address: DHCP request msg
• DHCP server sends address: DHCP ack msg
Typically, DHCP server will be co-located in router, serving all subnets
to which router is attached
• Allows reuse of addresses (only hold address while host is connected)
• Support for mobile users who join/leave network
ELEC 8560 - Computer Networks - Dr. Sakr 37
37
Example: DHCP
Use ipconfig in Windows and show if DHCP is enables.
Solution:
C:\Users\admin>ipconfig /all
38
DHCP Client-Server Scenario
39
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• NAT
Sidebar: Network Neutrality
40
Network Address Translation (NAT)
In most situations, only a portion of computers in a small network
need access to the Internet simultaneously
NAT allows all devices in a local network to
• Share one (or few) IPv4 address for communication with the rest of the world
• Use a set of private addresses for internal communication
41
NAT (cont.)
All devices in local network have 32-bit addresses in a private IP
address space (10/8, 172.16/12, 192.168/16 prefixes) that can only
be used in local network
Advantages:
• Just one IP address needed from provider ISP for all devices
• Helps ipv4 address space exhaustion
• Can change addresses of host in local network without notifying outside
world
• Can change ISP without changing addresses of devices in local network
• Security: devices inside local network not directly addressable or visible by
outside world
42
Address Translation
NAT router must (transparently):
• Outgoing datagrams:
• Replace (source IP address, port no.) of every outgoing datagram to (NAT IP address, new
port no.)
• Remote clients/servers will respond using (NAT IP address, new port no.) as destination
address
• Remember (in NAT translation table) every (source IP address, port no.) to
(NAT IP address, new port no.) translation pair
• Incoming datagrams:
• Replace (NAT IP address, new port no.) in destination fields of every incoming datagram
with corresponding (source IP address, port no.) stored in NAT table
43
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
10.0.0.1
1
S: 138.76.29.7, 5001
2 D: 128.119.40.186, 80 10.0.0.4
10.0.0.2
138.76.29.7 S: 128.119.40.186, 80
D: 10.0.0.1, 3345
4
S: 128.119.40.186, 80 10.0.0.3
D: 138.76.29.7, 5001 3
❸ reply arrives, destination
address: 138.76.29.7, 5001 ❹ NAT router changes datagram
destination address from
138.76.29.7, 5001 to 10.0.0.1, 3345
ELEC 8560 - Computer Networks - Dr. Sakr 44
44
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• IPv4 datagram format
Sidebar: Network Neutrality
45
46
IPv4 Datagram Header
Customary to be shown in 4-byte sections
• VER: version number (4 for IPv4)
• HLEN: header length in 4-byte words (i.e., length in bytes divided by 4)
• Total length: header + data in bytes (i.e., data length = Total length - HLEN × 4)
• Identification, flags, fragmentation offset: related to fragmentation (later)
• Time-to-live: max no. of hops (routers) visited by the datagram, then discard
• Protocol: protocol using payload
• e.g., ICMP: 01, UDP: 17, TCP: 06,
IGMP:02, OSPF: 89, etc.
• Checksum: for error detection
• IP addresses
• Options: for testing, debugging,
etc.
47
Example: IP Packet
An IPv4 packet has arrived with the first 8 bits as (01000010)2. The receiver discards
the packet. Why?
Solution:
The 4 leftmost bits (0100)2 show the version, which is correct
The next 4 bits (0010)2 show an invalid header length (2 × 4 = 8 bytes)
• The minimum number of bytes in the header must be 20
The packet has been corrupted in transmission
48
Example: Bytes of Option
In an IPv4 packet, the value of HLEN is (1000)2. How many bytes of options are
being carried by this packet?
Solution:
The HLEN value is 8, which means the total number of bytes in the header is 8 ×
4, or 32 bytes
The first 20 bytes are the base header, the next 12 bytes are the options
49
50
Example: TTL and Protocol
An IPv4 packet has arrived with the first few hexadecimal digits as shown.
(45000028000100000102…)16
How many hops can this packet travel before being dropped? The data belong to
what upper-layer protocol?
Solution:
To find the time-to-live field, we skip 8 bytes (16 hexadecimal digits)
• Time-to-live field is the ninth byte, which is (01)16
This means the packet can travel only one hop
Protocol field is the next byte (02)16, which means that the upper-layer protocol is
IGMP
51
Concept of Checksum
Checksum is used in the Internet by several protocols for error
checking
Main idea:
• In addition to sending our data, e.g., the set of numbers is (7, 11, 12, 0, 6), we
send (7, 11, 12, 0, 6, 36), where 36 is the sum of the original numbers
• The receiver adds the five numbers and compares the result with the sum
• If the two are the same, assume no error, accept the five numbers, and discard the sum
• Otherwise, there is an error somewhere and the data are not accepted
• To make it easier for the receiver, we can send the negative (complement) of
the sum, called the checksum, e.g., we send (7, 11, 12, 0, 6, −36)
• The receiver can add all the numbers received (including the checksum)
• If the result is 0, it assumes no error; otherwise, there is an error
52
Header Checksum Calculation
Checksum is calculated over the header only
Example: checksum calculation for an IPv4 header without options
• Header is divided into 16-bit sections
• Sections are added
• If a carry (leftmost digit) occurs, add carry to sum
• Sum is complemented
• Result is inserted in the checksum field
Note:
• F = (1111)2 complement = (0000)2 = 0
• 4 = (0100)2 complement = (1011)2 = B
• 3 = (0011)2 complement = (1100)2 = C
ELEC 8560 - Computer Networks - Dr. Sakr 53
53
Note:
• IP is not a reliable protocol, does not check
if payload is corrupted during transmission
• Only header added by IP is checked
• Other protocols are responsible for their own
data
54
Fragmentation
A datagram can travel through different networks
Each router decapsulates the IP datagram from the frame it receives,
processes it, and then encapsulates it in another frame
• Format and size of the received frame depend on the protocol used by the
physical network through which the frame has just traveled
• Format and size of the sent frame depend on the protocol used by the
physical network through which the frame is going to travel
For example, if a router connects a LAN to a WAN, it receives a frame
in the LAN format and sends a frame in the WAN format
55
Fragmentation (cont.)
Each link-layer protocol has its own frame format
Each frame format has maximum size of the payload that can be
encapsulated in a frame
• Total size of the datagram must be less than the maximum size (called
maximum transfer unit)
• For current technology, this size is much less than 65,535 bytes
56
Fragmentation (cont.)
Fragmentation is dividing the payload of the IP datagrams to make it
possible to pass through networks
• Datagram can be fragmented several times before reaching destination
• Can be fragmented by source host or any router in the path
• Needs to be reassembled at the destination host
57
Fragmentation (cont.)
Fields in IP datagram related to fragmentation:
• Identification: identifies datagram originating from the source host (counter)
• Flags field: defines three flags
• Leftmost bit is reserved
• D: 1 means do not fragment, 0 means fragment if necessary
• M: 1 means more fragments coming, 0 means last (or only) fragment
• Fragmentation offset field: relative position of this fragment with respect to
the whole datagram (in 8 bytes)
58
Example: Fragmentation
Remarks:
• Fragments can be fragmented
• Identification field is the same for all
fragments belonging to same
datagram
• M bit of Flags field is 1 except for
last fragment
• Offset is always relative to the
original datagram
• Destination can reassemble even
though fragments are out of order
59
Example 1: Flags
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?
Solution:
If the M bit is 0, it means that there are no more fragments; the fragment is the
last one
We cannot say if the original packet was fragmented or not
A non-fragmented packet is considered the last fragment
60
Example 2: Flags
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?
Solution:
If the M bit is 1, it means that there is at least one more fragment
This fragment can be the first one or a middle one, but not the last one
We do not know if it is the first one or a middle one; we need more information
(e.g., the value of the fragmentation offset)
61
Example 1: Offset
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?
Solution:
Because the M bit is 1, it is either the first fragment or a middle one
Because the offset value is 0, it is the first fragment
62
Example 2: Offset
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?
Solution:
To find the number of the first byte, we multiply the offset value by 8
This means that the first byte number is 800
We cannot determine the number of the last byte unless we know the length of
the data
63
Example 3: Offset
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?
Solution:
To find the number of the first byte, we multiply the offset value by 8
This means that the first byte number is 800
The total length is 100 bytes, and the header length is 20 bytes (5 × 4), which
means that there are 80 bytes in this datagram
If the first byte number is 800, the last byte number must be 879
64
Options
The header of the IPv4 datagram is made of two parts:
• Fixed part: 20 bytes long
• Variable part: options that can be a maximum of 40 bytes (in multiples of 4
bytes) to preserve the boundary of the header
Examples:
• Record Route: record addresses of routers that handle the datagram
• Useful for debugging and management
• Strict Source Route: predetermine a route for the datagram to travel through
• All routers defined must be visited by the datagram, no other router not on the list
• Timestamp: record time of datagram processing by a router
• Useful to track behavior of different routers
• End-of-Option: 1-byte option used for padding at the end of the option field
65
66
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• ICMPv4
Sidebar: Network Neutrality
67
68
Internet Control Message Protocol version 4 (ICMPv4)
ICMPv4 is designed to compensate for the above two deficiencies
• ICMP messages carried in IP datagrams (i.e., Protocol field is set to 1)
• Used by hosts and routers to communicate network-level information
ICMP messages divided into two broad categories:
• Error-reporting messages: report problems that a router or a host
(destination) may encounter when it processes an IP packet
• Query messages: help a host or a network manager get specific information
from a router or another host
• Nodes can discover their neighbor, hosts can discover and learn about routers on their
network, and routers can help a node redirect its messages
69
70
Error-Reporting Messages
IP is an unreliable protocol
ICMP reports errors to the original source (does not correct errors)
ICMP forms an error packet, which is then encapsulated in an IP
datagram
• Example: access a web page and server is down send Destination
Unreachable (Type 3) and Host Unreachable (Code 1) ICMP message
• Data section is IP header + first 8 bytes of datagram causing error
71
Query Messages
Used to test liveliness of hosts or routers, find one-way or round-trip
time between two devices, etc.
Query messages come in pairs: request and reply
• Examples: ICMP echo request (Type 8) and ICMP echo reply (Type 0)
There are several debugging tools that use query messages in the
Internet
• ping program is used to find if a host is alive and is responding
• Source sends echo-request message, if destination alive, respond with echo-reply
message
• traceroute (or tracert in Windows) can be used to trace the path of a packet
from a source to the destination
72
Example: ping
Send a ping message to the ahmedsakr.com site and show output.
Solution:
C:\Users\admin> ping ahmedsakr.com
Note:
• TTL is the max no. of routers a packet can go through before being discarded (default 64)
• Ping calculates the round-trip time (rrt): insert sending time in data section of the message,
when packet arrives, subtract arrival time from departure time to get rtt
73
Traceroute or Tracert
A program provides delay measurement from source to router along
end-end Internet path towards destination
Find the IP addresses of all the routers that are visited along the path
For all Ri:
• sends three packets that will reach router i on path towards destination (with
time-to-live field value of Ri)
• router Ri will return packets to sender
• sender measures time interval between transmission and reply
3 probes 3 probes
3 probes
74
Example: tracert
Use tracert in Windows and show output for eurecom.fr site.
Solution:
C:\Users\admin>tracert eurecom.fr
6 22 ms 22 ms 22 ms tcore4-toronto12_39.net.bell.ca [64.230.52.178]
7 * * * Request timed out. probe lost, router not responding
8 27 ms 23 ms 22 ms tcore4-chicagocp-bundle-ether15.net.bell.ca [142.124.127.174]
9 20 ms 20 ms 21 ms bx10-chicagodt_ae1.net.bell.ca [64.230.78.175]
10 28 ms 24 ms 25 ms bx10-chicagodt_et-8/1/2_ae8.net.bell.ca [184.150.181.36] trans-oceanic link
11 116 ms 113 ms 115 ms et-3-3-0.cr2-par7.ip4.gtt.net [213.200.119.214]
12 113 ms 113 ms 114 ms renater-gw-th2.gtt.net [77.67.123.210]
13 119 ms 120 ms 119 ms te-0-1-0-14-ren-nr-lyon2-rtr-091.noc.renater.fr [193.51.180.55]
14 120 ms 120 ms 120 ms xe-0-0-14-marseille2-rtr-131.noc.renater.fr [193.51.180.105]
15 118 ms 117 ms 117 ms xe-1-0-10-marseille1-rtr-131.noc.renater.fr [193.51.180.121]
16 122 ms 124 ms 122 ms te0-2-0-0-ren-nr-sophia-rtr-091.noc.renater.fr [193.51.177.21]
17 122 ms 122 ms 122 ms eurocom-valbonne-gi9-7-sophia-rtr-021.noc.renater.fr [193.51.187.17]
75
ICMP Checksum
Checksum is calculated over the entire message (header and data)
Example: checksum calculation for a simple echo-request message
• Message is divided into 16-bit (2-byte) words
• Words are added and the sum is complemented
• Sender puts value in checksum field
76
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• Mobile IP
Sidebar: Network Neutrality
77
78
Mobile IP (cont.)
For mobile hosts, the solution is to use two IP addresses:
• Home address: permanent, associates host to home network
• Care-of address: temporary, changes when a host moves from a foreign
network to a foreign network
79
Mobile IP (cont.)
To make change of address transparent to the Internet requires
• Home agent: router attached to home network
• Stores information about mobile hosts whose permanent home address is in the home
agent's network
• Acts on behalf of the mobile host when a remote host sends a packet to the mobile host
• Receives the packet and send it to the foreign agent
• Foreign agent: router attached to foreign network
• Stores information about mobile
nodes visiting its network
• Receives and delivers packets sent Home
by the home agent to the mobile Subscriber
Home Network Server Mobility
host Manager
Foreign Network
Mobility
Manager Home Foreign
Agent
Home gateway Agent
Public or Private
Internet
ELEC 8560 - Computer Networks - Dr. Sakr 80
80
Remote Host and Mobile Host Communication
To communicate with a remote host, a mobile host goes through
three phases:
• Agent discovery
• Host learns the address of home agent
before leaving home network
• Host learns the address of foreign agent
and care-of address after moving to a
foreign network
Note:
• Home and foreign agents advertise their presence on the network to which they are attached
• If a mobile host does not receive this ad, it can initiate an agent solicitation
• Mobile IP uses the existing ICMP router advertisement (Type 9) and router solicitation (Type
10) messages
81
82
Remote Host and Mobile Host Communication (cont.)
To communicate with a remote host, a mobile host goes through
three phases:
• Data transfer
• Movement of mobile host is transparent to
the rest of the Internet (i.e., unaware)
• Remote hosts send packets using the home
address of the mobile host as destination
• Remote hosts receive packets with the
home address of the mobile host as source
83
Data Transfer
❶ From remote host to home agent
• Remote host uses home address of mobile host as the destination address to send packets
• Packets intercepted by the home agent
Foreign Network
Mobility
Manager Home Foreign
Agent
Home gateway Agent
Public or Private
Internet
❶
84
Data Transfer
❷ From home agent to foreign agent
• Home agent redirects (tunnel) packets to foreign agent encapsulated in a new IP packet
85
Data Transfer
❸ From foreign agent to mobile host
• Foreign agent extracts original packet and changes destination address to the care-of address
Foreign Network
Mobility
Manager Home Foreign
Agent
Home gateway Agent
Public or Private
Internet
86
Data Transfer
❹ From mobile host to remote host
• Mobile host uses its home address as the source address to send packets directly to remote
host
Foreign Network
Mobility
Manager Home Foreign
Agent
Home gateway Agent
Public or Private ❹
Internet
87
Communication Inefficiency
Communication involving mobile IP can be inefficient, for example,
• Triangle routing (or dog-leg routing): moderate case
• When remote host sends packets to a mobile host that moved to another network
• Home agent can solve by sending updates to remote hosts with the care-of addresses
• Double crossing (or 2X): severe case
• When remote host sends packets to a mobile host that moved to the same network
• Packets travel the Internet twice
88
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• Forwarding of IP packets
Sidebar: Network Neutrality
89
Forwarding of IP Packets
As discussed, forwarding means to deliver packet to the next hop
• Can be the final destination or an intermediate connecting device
Forwarding can be
• Destination-based forwarding: based of destination IP address,
connectionless
• Generalized forwarding: other header fields can determine an action,
connection-oriented
forwarding table
values in arriving
packet header
0111 1
2
3
ELEC 8560 - Computer Networks - Dr. Sakr 90
90
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• Destination-Based Forwarding
Sidebar: Network Neutrality
91
92
Example: Destination-Based Forwarding Table
Make a forwarding table for router R1 using the configuration below.
Solution:
Network address/mask Next hop Interface
180.70.65.192/26 — m2
180.70.65.128/25 — m0
201.4.22.0/24 — m3
201.4.16.0/22 — m1
Default 180.70.65.200 m2
93
94
Example: Longest Prefix Match Algorithm
Figure below shows a simple example of searching in a forwarding table using the
longest mask algorithm.
Solution:
Forwarding algorithm gets destination
address of the packet
Search the mask column for each entry by
apply the mask to find destination network
address
Then, check network addresses in the table
until it finds the match
Router then extracts the next-hop address
and the interface number to be delivered
to the data-link layer
ELEC 8560 - Computer Networks - Dr. Sakr 95
95
96
Address Aggregation
In classful addressing, there is only one entry in the forwarding table
for each site outside the organization
• When a packet arrives at the router, the router checks the corresponding
entry and forwards the packet accordingly
In classless addressing, it is likely that the number of forwarding table
entries (and search time) will increase
• Due to dividing the address space into smaller blocks
To alleviate the problem, the idea of address aggregation was
designed
97
98
Longest Mask Addressing
What happens if Organization 4 cannot be connected to R1 (e.g., not
geographically close)?
• We can still use address aggregation with other three organizations
Longest mask addressing states that forwarding tables must be sorted
from the longest mask to the shortest mask
• Say packet destined to 140.24.7.200
• This way R2 will apply first mask and
forward data to Organization 4 on m1
• Applying /24 mask first would have
resulted in incorrect routing to R1
99
Hierarchical Routing
Creating a hierarchy can also solve the problem of gigantic forwarding
tables
For example, regional ISP is granted addresses divides into
subblocks and assigns to local ISPs divides into subblocks and
assigns to organization subnetting …
This way the rest of the Internet does not have to be aware of this
division
• All customers of the local ISP are defined as a.b.c.d/n to the regional ISP
• All customers of the regional ISP are defined as e.f.g.h/m to the rest of
Internet
100
Example: Hierarchical Routing with ISPs
A regional ISP is granted 16,384 addresses starting from 120.14.64.0. The regional
ISP divided this block into 4 subblocks, each with 4096 addresses. Three subblocks
are assigned to three local ISPs, the second subblock is reserved, and the first
subblock is assigned into 8 smaller blocks with 128 households. Show the hierarchy.
Solution:
16,384 = 214 120.14.64.0/18
Note:
• Mask of each block of local ISPs is /20
because the original block with mask /18
is divided into 4 blocks
• Mask of each block of small ISPs is /23
because the local ISP block with mask /20
is divided into 8 blocks
• Mask of each household is /30 because
the small ISP block with mask /23
is divided into 128 blocks
ELEC 8560 - Computer Networks - Dr. Sakr 101
101
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• Label-Based Forwarding
Sidebar: Network Neutrality
102
Forwarding Based on Label
In a connectionless network (datagram approach), a router forwards a
packet based on the destination address in the header of the packet
In a connection-oriented network (virtual-circuit approach), a switch
forwards a packet based on the label attached to the packet
Routing is normally based on searching the contents of a table
Switching can be done by accessing a table using an index (from label)
103
104
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• MPLS
Sidebar: Network Neutrality
105
106
MPLS-capable Routers
Sometimes called label-switched router
Forward packets to outgoing interface based only on label value
• Do not inspect IP address
• MPLS forwarding table distinct from IP forwarding tables
Flexibility: MPLS forwarding decisions can differ from those of IP
• Use destination and source addresses to route flows to same destination
differently (traffic engineering)
• Re-route flows quickly if link fails: pre-computed backup paths
107
R6
D
IP router
R4 R3
R5
A
R2 R1
ELEC 8560 - Computer Networks - Dr. Sakr 108
108
MPLS vs. IP Paths
IP routing:
• path to destination determined by destination address alone
MPLS routing:
• path to destination can be based on source and destination address
• flavor of generalized forwarding
• fast re-route: precompute backup routes in case of link failure
MPLS-capable entry router (R4) can use different MPLS
routes to A (e.g., based on IP source address or other fields)
R6
D
IP router
R4 R3
R5
IP/MPLS router
A
R2 R1
ELEC 8560 - Computer Networks - Dr. Sakr 109
109
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• IPv6
Sidebar: Network Neutrality
110
Internet Protocol version 6 (IPv6)
Sometimes called IP new generation (IPng)
Main motivations:
• Address depletion of the 32-bit IPv4 addresses
• Fast processing/forwarding (fixed-length header)
111
IPv6 Addressing
An IPv6 address is 128 bits or 16 bytes, four times the address length
in IPv4
Representation
Notation IP Address
Binary 11111110111101101011 … 1111111100000000
Colon Hexadecimal FEF6:BA98:7654:3210:ADEF:BBFF:2922:FF00
112
Address Space Allocation
Similar to IPv4, address space of IPv6 is divided into several blocks of
varying size and each block is allocated for a special purpose
Most of the blocks are still unassigned and have been set aside for
future use
113
114
Ethernet MAC Address Mapping
Defined by Ethernet
Link layer addressing scheme for mapping the 48-bit MAC address
into 64-bit interface identifier
• Split MAC address into two pieces
• Insert 16 bits (15 ones + 1 zero or FFFE16) in between
• Invert local/global (7th leftmost) bit from 0 to 1 (local to global)
115
116
Example: Subnet Identifier
An organization is assigned the block 2000:1456:2474/48. What is the CIDR
notation for the blocks in the first and second subnets in this organization.
Solution:
Assume n=48, m=16, and q=64 bits
Assume subnet identifiers (0001)16 and (0002)16
The blocks are
• 2000:1456:2474:0001/64
• 2000:1456:2474:0002/64
117
11110111
F7A9:23EF:0714:7AD2
EUI-64 Interface ID of the Host
118
Example 2: Interface Identifier
Find the interface identifier if the physical MAC address is
(F5−A9−23−14−7A−D2)16
using the format we defined for Ethernet addresses.
Solution:
We need to change the seventh bit of the first octet from 0 to 1, insert FFFE16,
and change the format to colon hex notation
The result is F7A9:23FF:FE14:7AD2 MAC Address of the Host
F5−A9−23−14−7A−D2
F5−A9−23−FF−FE−14−7A−D2
11110101
11110111
F7A9:23FF:FE14:7AD2
EUI-64 Interface ID of the Host
ELEC 8560 - Computer Networks - Dr. Sakr 119
119
120
Autoconfiguration
In IPv4, hosts and routers can originally be configured manually and
DHCP allocates IPv4 addresses to hosts that join the network
In IPv6, DHCP protocol can still be used to allocate an IPv6 address to
a host, but a host can also configure itself
• First, host creates a link local address for itself
• 128 bits: 10-bit link local prefix (1111 1110 10) + 54 zeroes + 64-bit interface identifier
• Host test the link local address to see if it is unique (not used by other hosts)
• If unique, host stores this address as its link local address, and sends a router
solicitation message to get global unicast prefix
• Host receives router advertisement message that announces the combination
of global unicast prefix and subnet identifier
• Host appends its interface identifier to this prefix to find and store its global
unicast address
ELEC 8560 - Computer Networks - Dr. Sakr 121
121
Example: Autoconfiguration
Assume a host with Ethernet address (F5−A9−23−11−9B−E2)16 has joined the
network. What would be its global unicast address if the global unicast prefix of the
organization is 3A21:1216:2165 and the subnet identifier is A245:1232.
Solution:
The interface identifier is F7A9:23FF:FE11:9BE2
The host then creates its link-local address as FE80::F7A9:23FF:FE11:9BE2
Assume the address is unique, the host sends a router solicitation message and
receives the router advertisement message that announces the combination of
global unicast prefix and the subnet identifier as
3A21:1216:2165:A245:1232
The host then appends its interface identifier to this prefix to find and store its
global unicast address as
3A21:1216:2165:A245:1232:F7A9:23FF:FE11:9BE2
ELEC 8560 - Computer Networks - Dr. Sakr 122
122
Renumbering
Each site is given a prefix by ISP to which it is connected
To allow sites to change ISP, renumbering of the address prefix was
built into IPv6 addressing
• If the site changes the provider, the address prefix needs to be changed
A router to which the site is connected can advertise a new prefix and
let the site use the old prefix for a short time before disabling it
• During the transition period, a site has two prefixes
123
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• IPv6 datagram format
Sidebar: Network Neutrality
124
IPv6 Datagram Format
Each packet is composed of a base header followed by the payload
• Version: version number (6 for IPv6)
• Traffic class: priority among datagrams
• Flow label: identify datagrams in the same “flow”
• Payload length: datagram length (excluding header) in bytes
• Next header: type of next extension header or Protocol in IPv4
• Hop limit: similar to TTL in IPv4
• IP addresses
125
126
Concept of Flow and Priority in IPv6
IP protocol was originally designed as a connectionless protocol
However, the tendency is to use is as a connection-oriented protocol
• e.g., MPLS technology described earlier allows us to encapsulate an IPv4
packet in an MPLS header using a label field
In version 6, the flow label has been directly added to the format of
the IPv6 datagram to allow us to use IPv6 as a connection-oriented
protocol
Flow is a sequence of packets that share the same characteristics
• e.g., travelling same path, same kind of security, etc.
A router uses a flow label table to route packets based on flow label
127
128
Fragmentation and Reassembly
There is still fragmentation and reassembly of datagrams in the IPv6
protocol, but there is a major difference in this respect
IPv6 datagrams can be fragmented only by the source and the
reassembly takes place at the destination
• Routers are not allowed to perform fragmentation to speed up processing
• If a packet it too long (i.e., larger than MTU), drop and send a packet-too-big
ICMPv6 error message
129
Extension Header
An IPv6 packet is made of a base header and some extension headers
• Length of the base header is fixed at 40 bytes
To give more functionality, base header can be followed by up to six
extension headers
• Many of these headers are options in IPv4
• Six types of extension headers have been defined: hop-by-hop option, source
routing, fragmentation, authentication, encrypted security payload, and
destination option
130
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• ICMPv6
Sidebar: Network Neutrality
131
132
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
• Transition from IPv4 To IPv6
Sidebar: Network Neutrality
133
IPv6 Adoption
Percentage of users that access Google over IPv6
40%
30%
20%
10%
0%
2010 2020
ELEC 8560 - Computer Networks - Dr. Sakr 134
134
Transition from IPv4 To IPv6
Transition must be smooth to prevent any problems between IPv4
and IPv6 systems
• Not all routers can be upgraded simultaneously
Three strategies have been devised for transition:
• Dual stack
• Tunneling
• Header translation
One or all of these three strategies can be implemented during the
transition period
135
Dual Stack
It is recommended that all hosts, before migrating completely to
version 6, have a dual stack of protocols during the transition
In other words, a station must run IPv4 and IPv6 simultaneously until
all the Internet uses IPv6
136
Example: Dual Stack
Use ipconfig in Windows and show your IPv4 and IPv6 link control addresses.
Solution:
C:\Users\admin>ipconfig /all
137
Tunneling
Tunneling is a strategy used when two computers using IPv6 want to
communicate with each other and the packet must pass through a
region that uses IPv4
To pass through this region, the packet must have an IPv4 address
So the IPv6 packet is encapsulated in an IPv4 packet when it enters
the region, and it leaves its capsule when it exits the region
• IPv6 datagram carried as payload in IPv4 datagram among IPv4 routers
IPv6 datagram
ELEC 8560 - Computer Networks - Dr. Sakr IPv4 datagram 138
138
Tunneling (cont.)
IPv6 packet goes through a tunnel at one end and emerges at the
other end
To make it clear that the IPv4 packet is carrying an IPv6 packet as
data, the protocol value is set to 41
Tunneling used extensively in other contexts (4G/5G)
139
Header Translation
Header translation is converting header of an IPv6 packet to an IPv4
header
Header translation is necessary when the majority of the Internet has
moved to IPv6 but some systems still use IPv4
• The sender wants to use IPv6, but the receiver does not understand IPv6
Tunneling does not work in this situation because the packet must be
in the IPv4 format to be understood by the receiver
In this case, the header format must be totally changed through
header translation
140
Outline
Communication at the network layer
Packet-switched networks
Internet Protocol (IP)
Sidebar: Network Neutrality
141
142
Summary
We covered:
• Packet-switched networks
• IPv4, IPv6, DHCP, NAT, ICMP
• Forwarding of IP packets
143