0% found this document useful (0 votes)
29 views99 pages

Presentation 4

Uploaded by

Tegbaru Tamene
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views99 pages

Presentation 4

Uploaded by

Tegbaru Tamene
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 99

Information Technology

Wolkite University Information System


Collage of Computing & Informatics Computer Science
Software Engineering
Electrical and computer Engineering

Advance Computer Networks

Wendosen Z

The Network Layer

1
 the network layer is responsible for carrying a packet from
one computer to another; it is responsible for host-to-host
delivery
 position of the network layer

2
5.1 Internetworking
 internetworking refers to the logical gluing of heterogeneous
physical networks together to look like a single network to the
upper transport and application layers

 the above internetwork is made up of 5 networks: 4 LANs and


1 WAN
 Si: switch or router; fi: interface
 data sent from A to D passes through 3 links
 nomenclature:
 the source and the destinations are usually referred to as
hosts
 a router is referred to as a hop
3
 in each link, 2 physical and data link layers are involved
 problem:
 when data arrives at S1, how does it know that it should
be sent to S3?
 the physical and data link layers do not help S 1
 the frame does not carry any routing information, it
contains the MAC addresses of A as the source and that
of S1 as the destination (for a LAN or a WAN, delivery
means carrying the frame through one link, not beyond)

 the network layer is responsible for host-to-host delivery


and for routing the packets through the routers or switches

4
 network layer at source
 receives data from the transport layer
 adds the universal addresses of A and D
 makes sure the packet is of correct size for passage through
the next link, fragment it if necessary
 network layer at router or switch
 responsible for routing the packet using a routing table
 the packet may go through another fragmentation if need be
 network layer at destination
 address verification; error detection; reassembling the
fragments
 delivering to the transport layer

5
5.2 Addressing
 to uniquely and universally identify each device on the
Internet to allow global communication between all
devices
 analogous to the telephone system; the Department of
Computer Science: 251 011 1222922, wherever you are on
the globe
 each address belongs to a single host, but a single host
can have multiple addresses (if it has multiple
connections to the Internet)
 the identifier used in the network layer of the Internet
model is called the Internet address or IP address
 it is a 32-bit binary address (in IPv4)

6
 two common notations: binary notation and dotted-decimal
notation
 binary notation: one or more spaces inserted between
each octet (8 bits)
10000000 00001011 00000011 00011111

 dotted-decimal notation: to make it more compact and


easier to read (for humans)

 we will study IP addresses later

7
5.3 Routing, Routing Protocols and Multicasting
 making a decision and choosing one route whenever
there are multiple routes
 based on some criteria; how do you choose a route
when you drive? may be the condition of your car and
the road, the shortest one, the one that is not
congested, the one with less traffic lights, avoid
forbidden paths (American military packets may not
pass through Russia), ...
 it is the job of the network layer routing protocol; a
combination of rules and procedures that lets routers
in the internet inform one another of changes (to share
whatever they know about the internet or their
neighborhood); e.g. a failure of a network can be
communicated
 at the heart of such protocol is the routing algorithm
that determines the path for a packet

8
 routing requires a host or a router to have a routing table
which is constructed by the routing algorithm

 given big internetworks such as the Internet, the number of


entries in the routing table becomes large and table look
ups become inefficient; methods for reducing its size
required

9
 next-hop routing
 the routing table holds only the information that leads
to the next hop

 network-specific routing
 instead of having an entry for every host connected
to the same physical network, there is only one entry
to define the address of the network itself

10
 two kinds of routing algorithms (routing tables):
nonadaptive (static) and adaptive (dynamic)
 nonadaptive (static)
 routing decisions are not based on measurements or
estimates of the current topology or traffic
 the choice of a root is computed in advance, off-line, and
downloaded to the routers when the network is booted or
 an administrator enters the route for each destination into
the table; not automatically updated when there is a
change; may be used in a small internet, but not for big
internet like the Internet

11
 adaptive (dynamic)
 routing decisions are made periodically (every  sec) to
reflect changes in the topology, traffic, a shutdown of a
router, a break in the link, a better route has been created, ...
 metrics used
 a metric is a cost assigned for passing through a network
 the cost could be the level of congestion of a link (mean
queue length, transmission delay, average traffic),
bandwidth, the geographic distance traversed by the link,
number of hops, estimated transit time, communication
cost, ...
 cost may change with time
 which cost to choose depends on the application
 the total metric of a particular route is equal to the sum of
the metrics of networks that comprise the route
 a router chooses the route with the shortest (smallest)
metric

12
 interior and exterior routing (protocols)
 since an internet can be large, one routing protocol cannot
handle the task of updating the routing tables of all routers
 hence, an internet is divided into autonomous systems
 an autonomous system (AS) is a group of networks and
routers under the authority of a single administration
 routing inside an autonomous system is referred to as
interior routing; each AS can choose its own routing
protocol
 routing between autonomous systems is referred to as
exterior routing; one protocol is usually chosen to handle
routing between autonomous systems; usually used for
routing in the Internet

13
 R1, R2, R3, and R4 use both interior and exterior routing
protocols
 the rest use only interior routing protocols
 solid lines - communication between routers
 broken lines - communication between the routers that use an
exterior routing protocol

14
 why an exterior routing protocol apart from size of an
internet? - politics
 political - I hate country X hence I will not handle its
traffic
 security - my information is confidential and should not
pass through a unfriendly country
 economic
 it should not pass through a competitor’s network
 I am not paid for it and hence don’t want to carry a
transit packet
 such policies are typically manually configured into each
router and are not part of the protocol itself

15
 the optimality principle: the optimal route
 if router J is on the optimal path from I to K, then the optimal
path from J to K also falls along the same route
 why? if a route better than R2 existed from J to K, then the route
from I to K could be improved by concatenating it with R1

I R1 J R2 K
 the consequence of the optimality principle is that “the set of
optimal routes from all sources to a given destination form a
tree rooted at the destination”
 such a tree is called a sink tree

a subnet sink tree for router B


16
(distance metric is the number of hops)
 the sink tree is not necessarily unique; as a tree it does not
contain any loops;  each packet will be delivered within a finite
and bounded number of hops; at least in theory
 the goal of a routing algorithm is to discover the sink trees for all
routers
 the optimality principle and the sink tree serve as benchmarks to
measure routing algorithms
i. Shortest Path Routing (static) for unicast routing (by Dijkstra)
 aim: build a graph of the subnet - each node of the graph
representing a router and each arc representing a link; the
arcs are labeled as a function of any one of the metrics
discussed (distance, hop count, ...)
 to select a route between two routers, the algorithm finds the
“shortest” path between them on the graph

17
 how does the algorithm work to find the shortest path?
 each node is labeled with its distance from the source; initially
labeled  since no path is known
 a label may be tentative or permanent (when the shortest
possible path is found - filled-in circle)

 we want to find the


path from A to D
working node

 the shortest path is


ABEFHD

(10, H)
(10, H)

18
(g) (h)
ii. Flooding (static) for multicast and broadcast routing
 every incoming packet is sent out on every outgoing line
except the one it arrived on
 packets received a second time are discarded
 it generates too many duplicate packets
 some measures required to avoid having an infinite
number of packets; e.g. have a hop counter included in
the header of each packet; initially initialized by the
number of hops from source to destination; each hop
decrements it and the packet is discarded when the
counter is zero
 selective flooding is a variant; send only on those lines
that are going approximately in the right direction
 flooding is not mostly practical

19
 possible applications include
 to update all databases concurrently in a distributed
database system (multicast routing)
 in wireless networks where every station can listen
(broadcast routing)
 if there is a possibility of many routers being
destroyed such as in a military application (may be for
unicast transmission too)
 flooding always chooses the shortest path and can
serve as a benchmark for other routing algorithms

20
Unicast Routing Protocols

 Interior
i. RIP - Routing Information Protocol
 uses distance vector routing algorithm (dynamic)
 also called distributed Bellman-Ford routing algorithm or
Ford-Fulkerson algorithm
 each router maintains a table (one entry per router)
giving the best known distance to each destination

Destination Hop Count Next Router Other information


163.5.0.0 7 172.6.23.4
197.5.13.0 5 176.3.6.17
189.45.0.0 4 200.5.1.6
115.0.0.0 6 131.4.7.19
21
 the tables are updated by exchanging information with
neighbors
 in the general case, the metrics could be: number of
hops, time delay in milliseconds, total number of
packets queued along the path, ...
 it is the original ARPANET routing algorithm (using
queue length as a metric) and was used until 1979
 the distance metric used in RIP is the number of hops
all networks are treated as equals, i.e., the cost of passing
through each network is the same, it is one hop count

22
ii. OSPF - Open Shortest Path First
 became a standard in 1990 by the IETF (Internet Engineering
Task Force)
 aim: to simplify the implementation at the boundaries
between Autonomous Systems by having a standard for the
interior routing
Next Other
Network Cost
 IETF identified some requirements Router Information

 has to be published in the open N1 5 C


N2 7 D
literature - proprietary solutions
N3 10 B
are not good N4 11 D
 has to support a variety of N5 15 C

distance metrics (physical distance, delay, ...)


 it has to be dynamic
 has to do load balancing for better performance (the best
route is not always the best)

23
 has to support routing based on type of service
 support for hierarchical systems - routers are not
expected to know the entire topology - see later
 introduce security so that spoofing routers by sending
false routing information is avoided
 uses link state routing algorithm (dynamic)
 replaced distance vector routing in ARPANET
 since distance vector routing does not consider
bandwidth (no need initially since all lines were 56 Kbps;
later some lines were upgraded) and other metrics
 it uses Dijkstra’s algorithm to find the shortest path and
construct the routing table

24
 Exterior
BGP - Border Gateway Protocol
 first appeared in 1989
 it uses path vector routing algorithm (dynamic)
 problems with the other algorithms
 the route with the smallest hop count may not be the
preferred route (if an autonomous system in which a packet
passes is not secure, even though it is the shortest and for
other political reasons)
 they only announce the hop counts without actually
defining the path that leads to the destination
 in path vector routing, each entry in the routing table
contains the destination network, the next router, and the
path to reach the destination
Network Next Router Path
N01 R01 AS14, AS23, AS67
N02 R05 AS22, AS67, AS05, AS89
N03 R06 AS67, AS89, AS09, AS34
N04 R12 AS62, AS02, AS09 25
 Hierarchical Routing
 to limit the size of the routing table and the time for table
look-up
 the routers are divided into regions
 each router knows all the details in its region; but knows
nothing about the internal structure of the other regions

26
 disadv: a packet may not follow the shortest path (e.g. to 5C)
 for bigger networks, more hierarchies may be essential;
region, zone, woreda, ...
 how many levels? it has been shown that the optimal
number of levels for an N router subnet is lnN, requires a
total of e lnN entries per router

27
 Multicast Routing
 multicasting: delivery of data from one host to many
destinations; as a result of multimedia applications
 a one-to-many relationship
 a multicast router may forward a received packet through
several of its ports (or discard it if it is not in the multicast
path)

28
 it requires group membership management - to create and
destroy groups, to allow processes (loyal members) to join
and leave groups
 one such protocol is IGMP (Internet Group Management
Protocol)
 has various versions - we don’t deal with the details
 not a concern of the routing algorithm; routers should only
know which of their hosts belong to which groups
 a multicast router connected to a network has a list of
multicast addresses of the groups for which the router
distributes packets to groups with at least one loyal member in
that network
 for each group, there is one router which has the duty of
distributing the multicast packets destined for that group

29
30
 for multicasting, each router computes a spanning tree
covering all other routes
a. entire network with two groups where a node may belong to
a single group, two groups, or none (see the numbers on
the nodes)
b. a spanning tree for the left most router
c. pruned spanning tree for Group 1
d. pruned spanning tree for Group 2

31
 several ways of pruning the tree exist
 the simple one is if link state routing is used - each router is
aware of the complete topology, including which hosts belong
to which groups

Multicast Routing Protocols


 there are several multicast routing protocols (implemented or
proposed)
 DVMRP - Distance Vector Multicast Routing Protocol
 an extension of distance vector routing
 MOSPF - Multicast Open Shortest Path First
 an extension of the OSPF protocol
 CBT - Core-Based Tree
 it uses a core (center router or rendezvous router) as the
root of the tree
 an autonomous system is divided into regions, and a core
is chosen for each region

32
 PIM - Protocol Independent Multicast
 it has two varieties
 PIM-DM - Protocol Independent Multicast-Dense Mode
 used when there is a possibility that each router is
involved in multicasting
 PIM-SM - Protocol Independent Multicast-Sparse Mode
 used when there is a slight possibility that each router
is involved in multicasting
 multicasting has many applications
 access to distributed systems
 information dissemination
 distance learning
 multimedia communications (this will be covered in detail
later)

33
 Broadcast Routing Protocols
 sending a packet to all destinations simultaneously
 possible applications
 distributing weather reports, stock market updates, live
radio programmes
 the Internet does not explicitly support broadcasting
(creates a huge amount of traffic and needs a huge
bandwidth)
 methods
1. send the packet to each destination
 wastes bandwidth
 the source must have a complete list of all the
destinations - very big table
2. flooding
 generates too many packets and consumes too much
bandwidth

34
3. multidestination routing
 each packet contains either a list of destinations or a bit map -
major problem
 a router receiving a packet generates a new copy of the packet
for each output line to be used and includes in each packet
only those destinations that are to use the line
 after some hops, each packet will carry only one destination
and can be treated as a normal packet
4. using a spanning tree
 used by the originating router and the subsequent ones
 good use of bandwidth
 but each router must have a knowledge of some spanning tree
5. reverse path forwarding
 applicable even if routers do not have a knowledge of spanning
trees
 when a packet arrives, the router checks if it arrived on the line
that is normally used for sending packets to the source (the
shortest path)

35
 if so, it forwards it to the rest of the lines (it was probably the
first copy to arrive)
 otherwise, it is discarded (may be it was a duplicate)
 example
a. a subnet
b. a sink tree for router I
c. how the reverse path forwarding algorithm works; each
level shows the first, second, ... hops
 the broadcasting terminates after 5 hops and 24 packets
 if the spanning tree method was used, only 4 hops and 14
packets suffice

36
5.4 Packetizing and Fragmenting
 Packetizing: encapsulates packets received from upper-
layer protocols and makes new packets out of them;
done by the IP protocol in the Internet model
 Fragmenting: a datagram can travel through different
networks; each router decapsulates the IP datagram
from the received frame, processes it, and then
encapsulates it in another frame
 the format and size of the
 received frame depends on the protocol used by
the physical network from which the frame has just
arrived
 departing frame depends on the protocol used by
the physical network to which the frame is going

37
 Other Issues (of Internet that are not directly related to the
duties of the network layer)
 Address Resolution: the network layer provides only
host-to-host addressing whereas the data link layer
needs physical addresses for node-to-node delivery;
these addresses must be mapped; details later in the
Address Resolution Protocol
 Multicasting and Routing Protocols - covered earlier

38
6. The Network Layer in the Internet
 there are 5 network layer protocols in the TCP/IP protocol suite
(IP, ARP, RARP (DHCP), ICMP, and IGMP)
 the main protocol is IP, the glue that holds the whole Internet
together and responsible for host-to-host delivery
 it needs the services of other protocols
 ARP (Address Resolution Protocol) - maps an IP address to
a MAC address (of the next hop)
 RARP (Reverse ARP) - maps a MAC address to an IP
address; usually used in some situations such as when a
diskless host is booted; it gets the binary image of its
operating system from a remote file server but does not
know its IP address; obsolete, replaced by DHCP- Dynamic
Host Configuration Protocol
 ICMP (Internet Control Message Protocol) - to handle
unusual situations such as the occurrence of an error
 IGMP (Internet Group Management Protocol) - for
multicasting since IP is designed for unicast delivery; you
can read about it
40
6.1 IP v4 and Subnetting
 unlike the older ones, it was designed with
internetworking in mind
 it is unreliable and connectionless datagram protocol - a
best effort delivery service (no error control or flow
control); it only detects errors and discards the packet if
it is corrupted
 if reliability is important, it must be paired with a reliable
protocol such as TCP (at the transport layer); like the
post office, get your important mails registered
 an IP datagram consists of a header part and a text part
 the header has a 20-byte fixed part and a variable length
optional part
 it is transmitted in big endian order: from left to right,
with the high-order bit of the Version field going first
(SPARC is big endian; Pentium is little endian); software
conversion is required on little endian machines

41
 Version (4 bits): keeps track of which version of the protocol
the datagram belongs (for future transitions between new and
old versions); currently 4
 IHL (4 bits): length of the header in 32-bit words (minimum
value is 5, which applies when no options are present;
maximum value is 15, which limits the header to 60 bytes, and
thus the Options field to 40 bytes)
 Type of service (8 bits): designed to distinguish between
different classes of service - for various combinations of
reliability (e.g. file transfer) and speed (e.g. voice); mostly
ignored by current routers

42
The IPv4 header
 Total length (16 bits): of everything in the datagram - both
header and data (max. length is 216 = 65,536 bytes)
 Identification (16 bits): for the destination host to determine
which datagram a newly arrived fragment belongs to (all the
fragments of a datagram contain the same Identification value)
 DF (1 bit): Don’t Fragment; the destination is incapable of
putting the pieces back together; all machines are required to
accept fragments of 576 bytes or less
 MF (1 bit): More Fragments; all fragments except the last one
have this bit set to know when all fragments of a datagram have
arrived
 Fragment offset (13 bits): tells where in the current datagram
this fragment belongs; all fragments except the last one in a
datagram must be a multiple of 8 bytes; a maximum of 8192
fragments per datagram allowed (213) giving a maximum
datagram length of 65,536 bytes (8*8192)

43
 Time to live (8 bits): to prevent datagrams from wandering
around forever; is a counter used to limit packet lifetimes; a
maximum lifetime of 255 sec (in practice counts the number of
hops); set by a source host approximately 2 times the maximum
number of hops between any two hosts; decremented on each
hop and is supposed to be decremented multiple times when
queued for a long time in a router; when it is zero, the packet is
discarded and a warning packet is sent back to the source host
 Protocol (8 bits): which transport process to give it to (TCP,
UDP, ...)
 Header checksum (16 bits): verifies the header only; the sum of
all fields is assumed to be zero upon arrival; it must be
recomputed at each hop because at least one field always
changes (Time to live)
 Source address and Destination address: IP addresses for the
source and the destination - see later

44
 Options
 to allow subsequent versions of the protocol to include
information not present in the original design
 to permit experimenters to try out new ideas, and
 to avoid allocating header bits to information that is rarely
needed
 originally five options were defined

 Security: for a router to specify not to route through certain


countries; ignored by all routers in practice

45
 Strict source routing: gives the complete path from source to
destination as a sequence of IP addresses; useful for system
managers to send emergency packets when the routing tables
are corrupted, or for making timing measurements
 Loose source routing: requires the packet to traverse the list of
routers specified, and in the order specified; but may also pass
through other routers on the way; most useful when political or
economic considerations dictate passing through or avoiding
certain countries
 Record route: tells the routers along the path to append their IP
address to the option field; for system managers to track down
bugs in routing algorithms
 Timestamp: each router also records a 32-bit timestamp; mostly
for debugging routing algorithms

46
 IP Addresses
 every host and router on the Internet has an IP address (its
network number and host number)
 unique and universal for global communication (no 2 hosts
have the same address, but a host can have 2 IP addresses)
 32-bit in IPv4 written as 4 decimal numbers (128 in IPv6)
 with 32-bits there are 232 (4,294,267,296) hosts; assumed too
many initially; now not sufficient due to a number of reasons
(mainly wastage)
 Classful Addressing
 address space is divided into 5 classes: A, B, C, D, and E
 the first few bits indicate the class of an address

in binary notation in dotted-decimal notation


47
 addresses in classes A, B, and C are for unicast
communication; a host needs to have at least one unicast
address to be able to send and receive
 addresses in class D are for multicast communication (only
as a destination); if a host belongs to a group or groups, it
can have one or more multicast addresses
 addresses in class E are reserved; the idea was to use them
for special purposes
 Netid and Hostid
 addresses in classes A, B, and C are divided into netid
(network) and hostid (host) of varying length from class to
class

48
 Classes and Blocks
 one problem with classful addressing is that each class is
divided into a fixed number of blocks with each block
having a fixed size
 Class A
 divided into 128 blocks, each block having a different
netid (the first bit of byte 1 is always 0)
 block 1: from 0.0.0.0 to 0.255.255.255 - netid 0
 block 2: from 1.0.0.0 to 1.255.255.255 - netid 1
.
.
 last block: from 127.0.0.0 to 127.255.255.255 - netid 127
 class A addresses were designed for large organizations
(up to 16 million hosts 224)

49
 e.g. organization X granted a block with netid 73
 the first address (73.0.0.0) is used to identify the organization
(called the network address)
 the last address is reserved for a special purpose
 total number of organizations that can be assigned class A
addresses is 126 (128-2) because all 0’s and 1’s are reserved
 the number of addresses in each block (16,777,214= 2 24-2) are
larger than the needs of almost all organizations
 millions of class A addresses are wasted

50
 Class B
 divided into 16,384 (214) blocks, each block having a different
netid (the first two bits of byte 1 are always 10)
 block 1: from 128.0.0.0 to 128.0.255.255 - netid 128.0
 block 2: from 128.1.0.0 to 128.1.255.255 - netid 128.1
.
.
 last block: from 191.255.0.0 to 191.255.255.255 - netid 191.255
 16 blocks are reserved for private addresses
 total number of organizations that can be assigned class B
addresses is 16,368 (16,384-16)
 class B addresses were designed for midsize organizations
(up to 65,534 = 216-2 hosts)
 the number of addresses in each block is larger than the
needs of most midsize organizations
 many class B addresses are wasted

51
52
 Class C
 divided into 2,097,152 (221) blocks, each block having a
different netid (the first three bits of byte 1 are always 110)
 block 1: from 192.0.0.0 to 192.0.0.255 - netid 192.0.0
 block 2: from 192.0.1.0 to 192.0.1.255 - netid 192.0.1
.
.
 last block: from 223.255.255.0 to 223.255.255.255 - netid
223.255.255
 256 blocks are used for private addresses
 total number of organizations that can be assigned class C
addresses is 2,096,902 (2,097,152-256)
 class C addresses were designed for small organizations (up
to 254 = 28-2 hosts)
 the number of addresses in each block is so limited that most
organizations do not want a block in this class

53
54
 Class D: there is just one block of class D addresses;
designed for multicasting
 Class E: there is just one block of class E addresses;
designed for use as reserved addresses; for research by IETF
(Internet Engineering Task Force) at http://www.ietf.org; it
develops Internet standards
 Network Address
 an address that defines the network itself
 it cannot be assigned to a host
 properties
 all hostid bytes are 0s; it is different from a netid, a
network address has both netid and hostid, with 0s for
the hostid
 it defines the network to the rest of the Internet; routing
to a host is based on the network address
 in classful addressing, the network address is the one
that is assigned to the organization

55
 network addresses are managed by a nonprofit
organization to avoid conflicts - ICANN (Internet
Corporation for Assigned Names and Numbers); it has
delegated parts of the address space to various regional
authorities, which then allocate IP addresses to ISPs and
other companies

56
 Special IP addresses
 an IP address with all 0s (hostid and/or netid) means this
network or this host
 an IP address with all 1s (netid and/or hostid) means all the
hosts on the indicated network for broadcasting

57
 Subnetting
 the netid is used by routers to route a packet destined for a
network
 IP addresses are designed with two levels of hierarchy (site
and host)

a network with two levels of hierarchy


 all the hosts in a network must have the same netid
 problem: does not allow dividing of a network into logical
groups (such as Departments in a University)

58
 solution 1: get netids for all groups; impossible
 solution 2: allow a network to be split into several parts for
internal use but still act like a single network to the outside
world (three levels of hierarchy: site, subnet, host)

a campus network consisting of LANs for various departments

59
a network with three levels of hierarchy

60
 the parts of the network are called subnetworks or subnets
(different from our previous definition of a subnet as the set of
all routers and communication lines in a network)
 routing of a datagram now involves three steps: delivery to the
site, delivery to the subnetwork, and delivery to to the host

addresses in a network with and without subnetting 61


 the IP hostid is divided into subnetid and hostid
 e.g., for class B addresses subnetid could be 6 bits (2 6=64
groups or subnets) and hostid could be 10 bits (2 10-2 = 1022
hosts in each subnet)
 this could be changed later if required (say if there are more
subnets) by the organization itself without any authorization,
say by ICANN
 note: the first and last host numbers in a subnet are reserved;
the first to identify the subnet itself; the last to broadcast within
the subnet

62
 Masking
 how can a router find the network address or subnet
address?
 a 32-bit number called the mask is used; routers outside the
organization use a default mask; routers inside the
organization use a subnet mask
 default mask: a 32-bit binary number that gives the network
address when ANDed with an address in the block; the
number of 1s is the same as the number of bits in the netid
( 8 for A, 16 for B, 24 for C); the rest are all 0
 slash notation: an alternative mask notation, a slash
followed by the number of 1s
In Dotted- Using
Class In Binary
Decimal Slash
A 11111111 00000000 00000000 00000000 255.0.0.0 /8

B 11111111 11111111 00000000 00000000 255.255.0.0 /16

C 11111111 111111111 11111111 00000000 255.255.255.0 /24 63


 e.g. a router outside the organization receives a packet
with destination address 190.240.7.91; how does it find the
network address to route the packet?
 the router follows three steps:
1. it looks the first byte of the address to find the class; it
is class B
2. the default mask for class B is 255.255.0.0; it ANDs
this mask with the address to get 190.240.0.0
3. it looks in its routing table to find out how to route the
packet to this destination

64
 subnet mask: change some of the leftmost 0s in the default
mask to 1s to make a subnet mask

 the number of subnets is determined by the number of 1s (2 n)


 conversely, if the number of subnets is n, the number of extra 1s
is log2n

65
 e.g. a router inside the organization receives a packet with
destination address 190.240.33.91; how does it find the
subnetwork address to route the packet?
 the router follows three steps:
1. the router must know the mask; assume it is /19 as in the
above figure
2. it applies the mask to the address; the subnet address is
190.240.32.0
3. it looks in its routing table to find out how to route the
packet to this destination

66
 Classless Addressing
 there is too much wastage of IP addresses in classful
addressing creating shortage of IP addresses
 classless addressing was announced in 1996
 the idea of variable-length blocks that belong to no class was
introduced to allocate the remaining IP addresses
 blocks of 2 addresses, 4 addresses, 64 addresses, ... can be
assigned to an organization based on size
 the number of addresses in a block must be a power of 2
 the whole address space (232 addresses) is divided into
blocks of different sizes
 the beginning address must be evenly divisible by the number of
addresses; if a site needs, say, 2000 addresses it is given a
block of 2048 addresses on a 2048 address boundary
 we can still use subnetting if there is a need
 an organization is given the beginning address of the block and
a mask (in slash notation)

67
 classeless addressing alleviates the depletion of addresses, but
we now need a new method of forwarding packets, called CIDR
(Classless InterDomain Routing)
 there is now a single routing table for all networks consisting of
an array of (IP address, subnet mask, outgoing line) triples
 when a packet comes in, its destination IP address is first
extracted; the routing table is then scanned entry by entry,
masking the destination address and comparing it to the table
entry looking for a match
 it is possible that multiple entries (with different subnet mask
lengths) match, in which case the longest mask is used; if there
is a match for a /20 mask and a /24 mask, the /24 entry is used

68
 consider the previous example; the table entries (in binary) for
the three universities are
Base (First) Address Mask
C: 11000010 00011000 00000000 00000000 11111111 11111111 11111000 00000000
E: 11000010 00011000 00001000 00000000 11111111 11111111 11111100 00000000
O: 11000010 00011000 00010000 00000000 11111111 11111111 11110000 00000000
 now consider what happens when a packet comes that is
addressed to 194.24.17.4, which in binary is represented as
11000010 00011000 00010001 00000100
 AND it with each mask and compare it with the base address
 first it is ANDed with the Cambridge mask to get
11000010 00011000 00010000 00000000; does not match the
Cambridge base address
 then the original address is ANDed with the Edinburgh mask to
get
11000010 00011000 00010000 00000000; does not match the
Edinburgh base address

69
 Oxford is tried next, yielding
11000010 00011000 00010000 00000000; it matches the Oxford
base
 if no longer matches are found farther down the table, the
Oxford entry is used and the packet is sent along the line named
in it

 Read about NAT - Network Address Translation

70
 IPv5
 is (was) there IPv5?
 yes, it was an experimental real-time stream protocol that was
never widely used
 was designed to coexist with IPv4, not a replacement

71
6.2 IPv6
 the major goals are
 Larger address space: to support billions of hosts, even
with inefficient address space allocation (2 128 of them - if
the entire earth, land and water, were covered with
computers, IPv6 would allow 7 x 1023 IP addresses per
square meter - Tannenbaum)
 Better header format: to simplify and speed-up the routing
process
 Better security: better encryption and authentication
options
 Support for resource allocation: to deal with the special
requirements of real-time data (audio and video)
 Allowance for extension: to allow the extension of the
protocol if required by new technologies or applications
in the future
 Coexistence: permit the old and new protocols to coexist
for years
72
 IPv6 header has 8 fields (40 bytes long)
 Version (4 bits): is always 6 for IPv6 (and 4 for IPv4)
 Traffic class (4 bits): used to distinguish between packets
with different real-time delivery requirements
 Flow label (24 bits): to provide special handling for a
particular flow of data; for example, to reserve bandwidth
because of some delay requirements

The IPv4 header

73
The IPv6 header
 Payload length (16 bits): the total length of the IP datagram
excluding the 40-byte base header
 Next header (8 bits): defines the header that follows the base
header; either one of the optional extension headers
(currently six) or the header for an upper-layer protocol such
as UDP or TCP
 Hop limit (8 bits): same as the Time to live field in IPv4; a
counter used to limit packet lifetimes
 Source address and Destination address: IP addresses for
the source and the destination; 16 bytes each

74
 IPv6 addresses notation
 hexadecimal colon notation: written as eight groups (each 2
bytes) of four hexadecimal digits with colons between the
groups
8000:0000:0000:0000:0123:4567:89AB:CDEF
 many addresses usually will have many zeros
 three abbreviation methods
 leading zeros (not the trailing ones) within a group can be
omitted; 0123 can be written as 123
 one or more groups of 16 zero bits can be replaced by a
pair of colons; the above address now becomes
8000::123:4567:89AB:CDEF
 it is allowed only once per address (if there are two runs
of zero sections, only one of them can be abbreviated)
 IPv4 addresses can be written as a pair of colons and an
old dotted decimal number, for example
::192.31.20.46

75
 Categories of Addresses
 IPv6 defines 3 types
 Unicast, Multicast
 Anycast: defines a group of computers with addresses that
have the same prefix; such a packet must be delivered to
exactly one of the members of the group - the closest or the
most easily accessible
 transition from IPv4 to IPv6
 it can not happen suddenly; smooth transition is required
 three strategies designed: dual stack, tunneling, and header
translation
1.Dual Stack
 all hosts should run both IPv4 and IPv6 simultaneously
until all the Internet uses IPv6
 to determine which version to use when sending a packet,
the source queries the DNS; if the DNS returns an IPv4
address, the source sends an IPv4 packet; if it returns an
IPv6 address, the source sends an IPv6 packet
76
2.Tunneling
 when two computers using IPv6 want to communicate
with each other and the packet must pass through a
region that uses IPv4
 the packet must also have an IPv4 address; hence the
IPv6 packet is encapsulated in an IPv4 packet when it
enters the region, and the IPv6 packet leaves its capsule
when it exits the region

77
3.Header Translation
 necessary when the majority of the Internet has moved to
IPv6
 the sender wants to use IPv6, but the receiver does not
understand IPv6
 the header of the IPv6 packet is converted to an IPv4
header

78
6.3 Address Resolution
 the data link layer hardware does not understand IP
addresses
 e.g., every Ethernet board comes with a 48-bit Ethernet
address (issued by a central authority to avoid conflicts);
such boards send and receive frames based on 48-bit
Ethernet addresses; they know nothing about 32-bit IP
addresses
 a MAC address is a local address
 delivery of a packet to a host or a router requires two
levels of addressing: IP and MAC
 a mapping of IP addresses to MAC addresses is required
 two types of mapping: static and dynamic

79
 Static Mapping
 create a table that associates an IP address with a MAC
address, stored in each machine on a network
 network performance is degraded to update the table
periodically (a machine could change its network card; in
some LANs such as LocalTalk of apple, the MAC address
changes every time the computer is turned on; a mobile
computer can move from one physical network to another)
 Dynamic Mapping
 each time a machine knows one of the two addresses, it can
use a protocol to find the other one
 two protocols: ARP (maps an IP address to a MAC address)
and RARP (maps a MAC address to an IP address; obsolete,
replaced by DHCP- Dynamic Host Configuration Protocol)

80
 ARP (Address Resolution Protocol)
 a host or a router looking for a MAC address broadcasts an
ARP query packet - it includes the MAC (physical) and IP
addresses of the sender and the IP address of the receiver
 only the intended recipient sends back an ARP response
packet (it contains the recipient’s IP and physical
addresses); it is unicast

81
 DHCP (Dynamic Host Configuration Protocol)
 each computer connected to the Internet must have the
following information
 its IP address
 its subnet mask
 the IP address of a router
 the IP address of a name server
 such information can be saved in a configuration file of the
client; but what if
 it is diskless or
 it is booting for the first time or
 it has moved to another subnet
 DHCP is a client-server program for assigning network
addresses
 IP addresses, default routers
 it is an extension of BOOTP (that replaced RARP) that maps IP
addresses to Ethernet addresses; but it requires manual
configuration of the table by an administrator when a new host
is added - static

82
 DHCP allows both manual and automatic IP address assignment
 a DHCP server has two databases
 one that statically binds physical addresses to IP addresses
 the second holds a list of unassigned IP addresses that
makes DHCP dynamic
 computers contact the DHCP server at boot-up time
 the server checks its static database; if there is an entry that
permanent address is returned
 otherwise it dynamically assigns an IP address for a fixed
period of time
 i.e., addresses are “leased” for some time; when the time
expires the client must request a renewal
 this allows sharing of address space
 results in more efficient use of address space

83
 a DHCP relay agent is needed on each LAN since the
DHCP server may not be reachable by broadcasting

Operation of DHCP

84
 ICMP (Internet Control Message Protocol)
 IP has no error reporting and error correcting mechanisms; if
something goes wrong
 it lacks a mechanism for host and management queries (is a
router or a host alive?)
 ICMP is a companion to the IP designed to compensate these
two deficiencies
 two type of ICMP messages: error-reporting and query
messages
 Error Reporting
 always reports error messages to the original source (the
only information included in the datagram is the source
and destination addresses)

85
 Destination unreachable: when a router cannot locate the
destination or when a packet with the DF bit cannot be
delivered because a ‘‘small-packet’’ network stands in the way;
the datagram is discarded
 Source quench: to slow down a source since IP is
connectionless and lacks flow control and congestion control;
rarely used because when congestion occurs, these packets
tend to aggravate it; congestion control in the Internet is
handled in the transport layer
 Time exceeded: sent when a packet is dropped because its
counter (Time to live) has reached zero (a symptom that
packets are looping) or when all fragments that make up a
message do not arrive at the destination host within a certain
time limit
 Parameter problem: indicates that an illegal value has been
detected in a header field
 Redirection: when a router notices that a packet seems to be
routed wrong
86
 Query Messages
 to diagnose some network problems

 Echo request and Echo reply: used to see if a given destination


is reachable and alive; when a destination receives an Echo
request message, it is expected to send an Echo reply message
back
 Timestamp request and Timestamp reply: to determine the
round-trip time needed for an IP datagram to travel between two
machines; and also to synchronize their clocks; can also be
used to measure network performance
 Address Mask Request and Address Mask Reply: a host may
know its IP address but not the parts that define the network
address, the subnet address, and the host identifier; it requests
a router
87
BGP
88

AS-1
AS-3

Interior
Routers
AS-2

BGP
Routers
AS Numbers
89

• Each AS identified by an ASN number


• 16-bit values (latest protocol supports 32-bit ones)
• 64512 – 65535 are reserved
• Currently, there are > 20000 ASNs
• AT&T: 5074, 6341, 7018, …
• Sprint: 1239, 1240, 6211, 6242, …
• Northeastern: 156
• North America ASs  ftp://ftp.arin.net/info/asn.txt
Inter-Domain Routing

• Global connectivity is at stake!


• Thus, all ASs must use the same protocol
• Contrast with intra-domain routing
• What are the requirements?
• Scalability
• Flexibility in choosing routes
• Cost
• Routing around failures
• Question: link state or distance vector?
• Trick question: BGP is a path vector protocol

90
BGP

• Border Gateway Protocol


• De facto inter-domain protocol of the Internet
• Policy based routing protocol
• Uses a Bellman-Ford path vector protocol
• Relatively simple protocol, but…
• Complex, manual configuration
• Entire world sees advertisements
• Errors can screw up traffic globally
• Policies driven by economics
• How much $$$ does it cost to route along a given path?
• Not by performance (e.g. shortest paths)

91
BGP Relationships
92

Provider
Peer 2 has no incentive to
Peers do not
route 1 3
pay each other

Customer
Peer 1 Provider
Peer 2 Customer
Peer 3

Customer pays
provider
Customer
Tier-1 ISP Peering

Inteliquent Centurylink

Verizon
AT&T Business

Level 3 Sprint

XO Communications
93
Peering Wars
95

Peer Don’t Peer


• Reduce upstream costs • You would rather have
• Improve end-to-end customers
performance • Peers are often
• May be the only way to competitors
connect to parts of the • Peering agreements
Internet require periodic
renegotiation

Peering struggles in the ISP world are extremely contentions,


agreements are usually confidential
Two Types of BGP Neighbors
96

Exterior
routers also
IGP speak IGP

eBGP eBGP
iBGP iBGP
Full iBGP Meshes

• Question: why do we need

eBGP
iBGP?
• OSPF does not include BGP
iBGP policy info
• Prevents routing loops within
the AS
• iBGP updates do not trigger
announcements

97
Path Vector Protocol
98

• AS-path: sequence of ASs a route traverses


• Like distance vector, plus additional information
• Used for loop detection and to apply policy
AS 4
• Default choice: route with fewest # of ASs 120.10.0.0/16

AS 3
130.10.0.0/16 AS 5
AS 2 110.10.0.0/16

120.10.0.0/16: AS 2  AS 3  AS 4
AS 1 130.10.0.0/16: AS 2  AS 3
110.10.0.0/16: AS 2  AS 5
BGP Operations (Simplified)

Establish
session on TCP
port 179
AS-1

Exchange active
routes

n
sio
es
AS-2

PS
Exchange

BG
incremental
updates 99

You might also like