Network Layer Services Explained
Network Layer Services Explained
18.1.1 Packetizing
Encapsulating the payload in a network-layer at the source and
decapsulating the payload from the network-layer packet at the
destination.
The source host receives the payload from an upper-layer protocol, adds
a header that contains the source and destination addresses and some
other information that is required by the network-layer protocol (as
discussed later) and delivers the packet to the data-link layer.
The destination host receives the network-layer packet from its data-link
layer, decapsulates the packet, and delivers the payload to the
corresponding upper-layer protocol.
If the packet is fragmented at the source or at routers along the path,
the network layer is responsible for waiting until all fragments arrive,
reassembling them, and delivering them to the upper-layer protocol.
The routers in the path are not allowed to decapsulate the packets they
received unless the packets need to be fragmented. The routers are not
allowed to change source and destination addresses.
Forwarding
If routing is applying strategies and running some routing protocols to
create the decision-making tables for each router, forwarding can be
defined as the action applied by each router when a packet arrives at
one of its interfaces.
The decision-making table a router normally uses for applying this action
is sometimes called the forwarding table and sometimes the routing
table.
When a router receives a packet from one of its attached networks, it
needs to forward the packet to another attached network (in unicast
routing) or to some attached networks (in multicast routing)
Flow Control
Flow control regulates the amount of data a source can send without
overwhelming the receiver. If the upper layer at the source computer produces
data faster than the upper layer at the destination computer can consume it,
the receiver will be overwhelmed with data. To control the flow of data, the
receiver needs to send some feedback to the sender to inform the latter that it
is overwhelmed with data.
Congestion Control
Congestion in the network layer may occur if the number of datagrams sent by
source computers is beyond the capacity of network or routers. The routers
may drop some of the datagrams. If more number of datagrams are dropped,
sender may send duplicates of the lost packets. If the congestion continues,
system collapses and no datagrams are delivered.
Quality of Service
As the Internet allowed multimedia communication, quality of service of
communication grows important. The Internet has thrived by providing better
quality of service to support these applications.
Security
The network layer was designed with no security provision. To provide security
for a connectionless network layer, IPSec is introduced. IPSec is the virtual
layer that changes the connectionless service to a connection oriented service.
Acknowledgement Packet
A special packet, called the acknowledgment packet, completes the
entries in the switching tables.
Teardown Phase
In the teardown phase, source A, after sending all packets to B, sends a
special packet called a teardown packet.
Destination B responds with a confirmation packet. All routers delete
the corresponding entries from their tables.
Notation
There are three common notations to show an IPv4 address: binary
notation (base 2), dotted-decimal notation (base 256), and hexadecimal
notation (base 16).
In binary notation, an IPv4 address is displayed as 32 bits. To make the
address more readable, one or more spaces are usually inserted
between each octet (8 bits). Each octet is often referred to as a byte.
To make the IPv4 address more compact and easier to read, it is usually
written in decimal form with a decimal point (dot) separating the bytes.
This format is referred to as dotted-decimal notation.
Hierarchy in Addressing
A 32-bit IPv4 address is also hierarchical, but divided only into two parts.
The first part of the address, called the prefix, defines the network; the
second part of the address, called the suffix, defines the node
(connection of a device to the Internet).
In class A, the network length is 8 bits, but since the first bit, which is 0,
defines the class, we can have only seven bits as the network identifier.
This means there are only 27 = 128 networks in the world that can have
a class A address.
In class B, the network length is 16 bits, but since the first two bits,
which are (10)2, define the class, we can have only 14 bits as the
network identifier. This means there are only 214 = 16,384 networks in
the world that can have a class B address.
In class C, the network length is 24 bits, but since three bits define the
class, we can have only 21 bits as the network identifier. This means
there are 221 = 2,097,152 networks in the world that can have a class C
address.
Class D is not divided into prefix and suffix. It is used for multicast
addresses. All addresses that start with 1111 in binary belong to class E.
As in Class D, Class E is not divided into prefix and suffix and is used as
reserve.
Address Depletion
Since the addresses were not distributed properly, the Internet was
faced with the problem of the addresses being rapidly used up, resulting
in no more addresses available for organizations and individuals that
needed to be connected to the Internet.
In class A, only 128 organizations can be assigned. Class B addresses
were designed for mid size organizations but also remains unused.
In Class C, number of addresses that can be used in each network was so
small, hence not comfortable to use that. Class E were almost never be
used.
Since the value of prefix length, n is given, following can be easily found out.
1. The number of addresses in the block is found as N = 232-n.
2. To find the first address, we keep the n leftmost bits and set the (32 - n)
rightmost bits all to 0s.
3. To find the last address, we keep the n leftmost bits and set the (32 - n)
rightmost bits all to 1s
Address Mask
Another way to find the first and last addresses in the block is to use the
address mask.
The address mask is a 32-bit number in which the n leftmost bits are set
to 1s and the rest of the bits (32 - n) are set to 0s.
A computer can easily find the address mask because it is the
complement of (232 - n - 1).
The reason for defining a mask in this way is that it can be used by a
computer program to extract the information in a block, using the three
bit-wise operations NOT, AND, and OR.
1. The number of addresses in the block N = NOT (mask) + 1.
2. The first address in the block = (Any address in the block) AND (mask).
3. The last address in the block = (Any address in the block) OR [(NOT (mask)]
Example 18.2 We repeat Example 18.1 using the mask. The mask in dotted-
decimal notation is [Link]. The AND, OR, and NOT operations can be
applied to individual bytes using calculators and applets at the book website.
Number of addresses in the block: N = NOT (mask) + 1= [Link] + 1 = 32
addresses
First address: First = (address) AND (mask) = [Link]
Last address: Last = (address) OR (NOT mask) = [Link]
Example 18.3 In classless addressing, an address cannot per se define the block
the address belongs to. For example, the address [Link] can belong to
many blocks. Some of them are shown below with the value of the prefix
associated with that block.
Prefix length:16 → Block: [Link] to [Link]
Prefix length:20 → Block: [Link] to [Link]
Prefix length:26 → Block: [Link] to [Link]
Prefix length:27 → Block: [Link] to [Link]
Prefix length:29 → Block: [Link] to [Link]
Prefix length:31 → Block: [Link] to [Link]
Network Address
The first address, the network address, is particularly important because
it is used in routing a packet to its destination network.
When a packet arrives at the router from any source host, the router
needs to know to which network the packet should be sent: from which
interface the packet should be sent out.
After the network address has been found, the router consults its
forwarding table to find the corresponding interface from which the
packet should be sent out.
Block Allocation
The responsibility of block allocation is given to Internet Corporation for
Assigned Names and Numbers.
Two restrictions need to be applied to the allocated block.
1. The number of requested addresses, N, needs to be a power of 2. The
reason is that N = 232 - n or n = 32 - log2N. If N is not a power of 2, we cannot
have an integer value for n.
Subnetting
A subnetwork can be divided into several sub-subnetworks. A sub-
subnetwork can be divided into several sub-sub-subnetworks, and so on.
Designing subnets
Assume the total number of addresses granted to organization is N, the
prefix length is n
The assigned number of addresses to each subnetwork is Nsub, the
prefix length is nsub.
To ensure proper operation of the subnetworks
The number of addresses in each subnetwork should be a power of 2
The prefix length for each subnetwork should be found using the
following formula:
nsub = 32 - log2Nsub
The starting address in each subnetwork should be divisible by the
number of
addresses in that subnetwork.
Address Aggregation
When blocks of addresses are combined to create a larger block, routing can
be done based on the prefix of the larger block. ICANN assigns a large block of
addresses to an ISP. Each ISP in turn divides its assigned block into smaller
subblocks and grants the subblocks to its customers.
Special Addresses
There are five special addresses.
this-host address, limited-broadcast address, loopback address, private
addresses, and multicast addresses.
This-host address
The only address in the block [Link]/32 is called the this-host address. It
is used whenever a host needs to send an IP datagram but it does not
know its own address to use as the source address.
LoopBack Address
The block [Link]/8 is called the loopback address. A packet with one
of the addresses in this block as the destination address never leaves the
host; it will remain in the host. Any address in the block is used to test a
piece of software in the machine.
Private Addresses
Four blocks are assigned as private addresses: [Link]/8, [Link]/12,
[Link]/16, and [Link]/16.
Multicast Address
The block [Link]/4 is reserved for multicast addresses.
The 64-byte option field has a dual purpose. It can carry either additional
information or some specific vendor information.
The server uses a number, called a magic cookie, in the format of an IP
address with the value of [Link]. When the client finishes reading
[Link] N, Dept of CSE, SVIT Page 21
Module 3 Network Layer
the message, it looks for this magic cookie. If present, the next 60 bytes
are options.
An option is composed of three fields: a 1-byte tag field, a 1-byte length
field, and a variable-length value field.
Option Format
There are several tag fields that are mostly used by vendors. If the tag field is
53, the value field defines one of the 8 message types.
Operation in DHCP
encapsulated in a UDP user datagram with the source port set to 68 and
the destination port set to 67.
The DHCP server or servers (if more than one) responds with a
DHCPOFFER message in which the your address field defines the offered
IP address for the joining host and the server address field includes the
IP address of the server. The message also includes the lease time for
which the host can keep the IP address. This message is encapsulated in
a user datagram with the same port numbers, but in the reverse order.
The joining host receives one or more offers and selects the best of
them. The joining host then sends a DHCPREQUEST message to the
server that has given the best offer. The fields with known value are set.
The message is encapsulated in a user datagram with port numbers as
the first message.
Finally, the selected server responds with a DHCPACK message to the
client if the offered IP address is valid. If the server cannot keep its offer
(for example, if the address is offered to another host in between), the
server sends a DHCPNACK message and the client needs to repeat the
process. This message is also broadcast to let other servers know that
the request is accepted or rejected.
Using FTP
The server does not send all of the information that a client may need
for joining the network.
In the DHCPACK message, the server defines the pathname of a file in
which the client can find complete information such as the address of
the DNS server.
The client can then use a file transfer protocol to obtain the rest of the
needed information.
Error Control
DHCP uses the service of UDP, which is not reliable. To provide error
control, DHCP uses two strategies.
First, DHCP requires that UDP use the checksum. The use of the
checksum in UDP is optional. Second, the DHCP client uses timers and a
retransmission policy if it does not receive the DHCP reply to a request.
Transition States
When the DHCP client first starts, it is in the INIT state (initializing state).
The client broadcasts a discover message.
When it receives an offer, the client goes to the SELECTING state. While
it is there, it may receive more offers. After it selects an offer, it sends a
request message and goes to the REQUESTING state.
If an ACK arrives while the client is in this state, it goes to the BOUND
state and uses the IP address. When the lease is 50 percent expired, the
client tries to renew it by moving to the RENEWING state. If the server
renews the lease, the client moves to the BOUND state again.
If the lease is not renewed and the lease time is 75 percent expired, the
client moves to the REBINDING state.
If the server agrees with the lease (ACK message arrives), the client
moves to the BOUND state and continues using the IP address;
otherwise, the client moves to the INIT state and requests another IP
address.
Note that the client can use the IP address only when it is in the BOUND,
RENEWING, or REBINDING state.
The above figure shows , the private network uses private addresses.
The router that connects the network to the global address uses one
private address and one global address. The private network is invisible
to the rest of the Internet; the rest of the Internet sees only the NAT
router with the address [Link].
Address Translation
All of the outgoing packets go through the NAT router, which replaces
the source address in the packet with the global NAT address. All
incoming packets also pass through the NAT router, which replaces the
destination address in the packet (the NAT router global address) with
the appropriate private address.
Translation Table
The reader may have noticed that translating the source addresses for
an outgoing packet is straightforward.
New options.
IPv6 has new options to allow for additional functionalities.
Each packet is composed of a base header followed by the payload. The base
header occupies 40 bytes, whereas payload can be up to 65,535 bytes of
information.
Version. The 4-bit version field defines the version number of the IP. For
IPv6, the value is 6.
Traffic class. The 8-bit traffic class field is used to distinguish different
payloads with different delivery requirements. It replaces the type-of-
service field in IPv4.
Flow label. The flow label is a 20-bit field that is designed to provide
special handling for a particular flow of data. We will discuss this field
later.
Payload length. The 2-byte payload length field defines the length of the
IP datagram excluding the header. Note that IPv4 defines two fields
related to the length: header length and total length. In IPv6, the length
of the base header is fixed (40 bytes); only the length of the payload
needs to be defined.
Next header. The next header is an 8-bit field defining the type of the
first extension header (if present) or the type of the data that follows the
base header in the datagram.
Hop limit. The 8-bit hop limit field serves the same purpose as the TTL
field in IPv4.
Source and destination addresses. The source address field is a 16-byte
(128-bit) Internet address that identifies the original source of the
datagram. The destination address field is a 16-byte (128-bit) Internet
address that identifies the destination of the datagram.
Payload. Compared to IPv4, the payload field in IPv6 has a different
format and meaning,
and so on). The payload can have as many extension headers as required
by the situation.
Each extension header has two mandatory fields, next header and the
length, followed by information related to the particular option.
22.2.2Extension Header
An IPv6 packet is made of a base header and some extension headers.
The length of the base header is fixed at 40 bytes. However, to give
more functionality to the IP datagram, the base header can be followed
by up to six extension headers.
Hop-By-Hop Option
The hop-by-hop option is used when the source needs to pass information to
all routers visited by the datagram. Only three hop-by-hop options have been
defined: Pad1, PadN, and jumbo payload.
Pad1. This option is 1 byte long and is designed for alignment purposes.
Some options need to start at a specific bit of the 32-bit word. If an
option falls short of this requirement by exactly one byte, Pad1 is added.
PadN. PadN is similar in concept to Pad1. The difference is that PadN is
used when 2 or more bytes are needed for alignment.
Jumbo payload. Recall that the length of the payload in the IP datagram
can be a maximum of 65,535 bytes. However, if for any reason a longer
payload is required, we can use the jumbo payload option to define this
longer length.
Destination Option
The destination option is used when the source needs to pass
information to the destination only. Intermediate routers are not
permitted access to this information. The format of the destination
option is the same as the hop-by-hop option.
Source Routing
The source routing extension header combines the concepts of the strict
source route and the loose source route options of IPv4.
Fragmentation
The concept of fragmentation in IPv6 is the same as that in IPv4. In IPv4,
the source or a router is required to fragment if the size of the datagram
is larger than the MTU of the network over which the datagram travels.
In IPv6, only the original source can fragment. A source must use a Path
MTU Discovery technique to find the smallest MTU supported by any
network on the path. The source then fragments using this knowledge.
Authentication
The authentication extension header has a dual purpose: it validates the
message sender and ensures the integrity of data. The former is needed
so the receiver can be sure that a message is from the genuine sender
and not from an imposter. The latter is needed to check that the data is
not altered in transition by some hacker.
❑ The record route option is not implemented in IPv6 because it was not used.
❑ The source route option is called the source route extension header in IPv6.
❑ The fragmentation fields in the base header section of IPv4 have moved to
the fragmentation extension header in IPv6.
20.1 INTRODUCTION
Unicast Routing
Unicast routing in the Internet, with a large number of routers and a
huge number of hosts, can be done only by using hierarchical routing:
routing in several steps using different routing algorithms.
An Internet As a Graph
To find the best route, an internet can be modeled as a graph. A graph in
computer science is a set of nodes and edges (lines) that connect the
nodes. To model an internet as a graph, we can think of each router as a
node and each network between a pair of routers as an edge. An
internet is, in fact, modeled as a weighted graph, in which each edge is
associated with a cost.
Least-Cost Trees
If there are N routers in an internet, there are (N - 1) least-cost paths
from each router to any other router. This means we need N × (N - 1)
least-cost paths for the whole internet. If we have only 10 routers in an
internet, we need 90 least-cost paths. A better way to see all of these
paths is to combine them in a least-cost tree.
The least-cost trees for a weighted graph can have several properties if they
are created using consistent criteria.
1. The least-cost route from X to Y in X’s tree is the inverse of the least-cost
route from Y to X in Y’s tree; the cost in both directions is the same. For
example, in Figure 20.2, the route from A to F in A’s tree is (A → B → E → F),
but the route from F to A in F’s tree is (F → E → B → A), which is the inverse of
the first route. The cost is 8 in each case.
.2 Routing Algorithms
Distance Vectors
The concept of a distance vector is the rationale for the name distance-
vector routing. A least-cost tree is a combination of least-cost paths from
the root of the tree to all destinations.
the name of the distance vector defines the root, the indexes define the
destinations, and the value of each cell defines the least cost from the
root to the destination. A distance vector does not give the path to the
destinations as the least-cost tree does; it gives only the least costs to
the destinations.
Count to Infinity
A problem with distance-vector routing is that any decrease in cost
(good news) propagates quickly, but any increase in cost (bad news) will
propagate slowly. For a routing protocol to work properly, if a link is
broken (cost becomes infinity), every other router should be aware of it
immediately, but in distance-vector routing, this takes some time.
Two-Node Loop
One example of count to infinity is the two-node loop problem
At the beginning, both nodes A and B know how to reach node X. But
suddenly, the link between A and X fails.
Node A changes its table. If A can send its table to B immediately,
everything is fine. However, the system becomes unstable if B sends its
forwarding table to A before receiving A’s forwarding table.
Node A receives the update and, assuming that B has found a way to
reach X, immediately updates its forwarding table. Now A sends its new
update to B.
Now B thinks that something has been changed around A and updates
its forwarding table. The cost of reaching X increases gradually until it
reaches infinity. At this moment, both A and B know that X cannot be
reached. However, during this time the system is not stable.
Node A thinks that the route to X is via B; node B thinks that the route to
X is via A. If A receives a packet destined for X, the packet goes to B and
then comes back to A.
Similarly, if B receives a packet destined for X, it goes to A and comes
back to B. Packets bounce between A and B, creating a two-node loop
problem.
Split Horizon
One solution to instability is called split horizon. In this strategy, instead
of flooding the table through each interface, each node sends only part
of its table through each interface.
If, according to its table, node B thinks that the optimum route to reach
X is via A, it does not need to advertise this piece of information to A;
the information has come from A (A already knows).
Taking information from node A, modifying it, and sending it back to
node A is what creates the confusion. In our scenario, node B eliminates
the last line of its forwarding table before it sends it to A. In this case,
node A keeps the value of infinity as the distance to X.
Later, when node A sends its forwarding table to B, node B also corrects its
forwarding table. The system becomes stable after the first update: both node
A and node B know that X is not reachable.
Poison Reverse
In the poison reverse strategy B can still advertise the value for X, but if
the source of information is A, it can replace the distance with infinity as
a warning.
Spanning Trees
In path-vector routing, the path from a source to all destinations is also
determined by the best spanning tree.
The best spanning tree, however, is not the least-cost tree; it is the tree
determined by the source when it imposes its own policy. If there is
more than one route to a destination, the source can choose the route
that meets its policy best.
A source may apply several policies at the same time. One of the
common policies uses the minimum number of nodes to be visited
(something similar to least-cost). Another common policy is to avoid
some nodes as the middle node in a route.
The above figure shows a small internet with only five nodes. Each
source has created its own spanning tree that meets its policy.
The policy imposed by all sources is to use the minimum number of
nodes to reach a destination. The spanning tree selected by A and E is
such that the communication does not pass through D as a middle node.
Similarly, the spanning tree selected by B is such that the
communication does not pass through C as a middle node.
The above diagram shows the path vector of node C after two events. In
the first event, node C receives a copy of B’s vector, which improves its
vector: now it knows how to reach node A. In the second event, node C
receives a copy of D’s vector, which does not change its vector.
Path-Vector Algorithm
Hierarchical Routing
Scalability problem means that the size of the forwarding tables
becomes huge, searching for a destination in a forwarding table
becomes time-consuming, and updating creates a huge amount of
traffic.
The administrator needs to have control in its system. The organization
must be able to use as many subnets and routers as it needs, may desire
that the routers be from a particular manufacturer, may wish to run a
specific routing algorithm to meet the needs of the organization, and
may want to impose some policy on the traffic passing through its ISP.
Hierarchical routing means considering each ISP as an autonomous
system (AS).
Each AS can run a routing protocol that meets its needs, but the global
Internet runs a global protocol to glue all ASs together.
The routing protocol run in each AS is referred to as intra-AS routing
protocol, intradomain routing protocol, or interior gateway protocol
(IGP); the global routing protocol is referred to as inter-AS routing
protocol, interdomain routing protocol, or exterior gateway protocol
(EGP).
Autonomous System
Each ISP is an autonomous system when it comes to managing networks
and routers under its control.
Hop Count
First, since a router in an AS needs to know how to forward a packet to
different networks (subnets) in an AS, RIP routers advertise the cost of
reaching different networks instead of reaching other nodes in a
theoretical graph. In other words, the cost is defined between a router
and the network in which the destination host is located. Second, to
make the implementation of the cost simpler (independent from
performance factors of the routers and links, such as delay, bandwidth,
and so on), the cost is defined as the number of hops, which means the
number of networks (subnets) a packet needs to travel through from the
source router to the final destination host.
Forwarding Tables
A forwarding table in RIP is a three-column table in which the first
column is the address of the destination network, the second column is
the address of the next router to which the packet should be forwarded,
and the third column is the cost (the number of hops) to reach the
destination network.
Although a forwarding table in RIP defines only the next router in the
second column, it gives the information about the whole least-cost tree
based on the second property of these trees, discussed in the previous
section. For example, R1 defines that the next router for the path to N4
is R2; R2 defines that the next router to N4 is R3; R3 defines that there is
no next router for this path. The tree is then R1 → R2 → R3 → N4.
RIP Implementation
RIP is a daemon process (a process running in the background), named
routed (abbreviation for route daemon and pronounced route-dee). This
means that, although RIP is a routing protocol to help IP route its
datagrams through the AS, the RIP messages are encapsulated inside
UDP user datagrams, which in turn are encapsulated inside IP
datagrams. In other words, RIP runs at the application layer, but creates
forwarding tables for IP at the network later.
RIP Messages
RIP Algorithm
RIP implements the same algorithm as the distance-vector routing
algorithm we discussed in the previous section. However, some changes
need to be made to the algorithm to enable a router to update its
forwarding table:
❑ Instead of sending only distance vectors, a router needs to send the whole
contents of its forwarding table in a response message.
❑ The receiver adds one hop to each cost and changes the next router field to
the address of the sending router. We call each route in the modified
forwarding table the received route and each route in the old forwarding table
the old route. The received router selects the old routes as the new ones
except in the following three cases:
1. If the received route does not exist in the old forwarding table, it should be
added to the route.
2. If the cost of the received route is lower than the cost of the old one, the
received route should be selected as the new one.
3. If the cost of the received route is higher than the cost of the old one, but
the value of the next router is the same in both routes, the received route
should be selected as the new one. This is the case where the route was
actually advertised by the same router.
4. The new forwarding table needs to be sorted according to the destination
route.
Timers in RIP
RIP uses three timers to support its operation. The periodic timer
controls the advertising of regular update messages. Each router has one
periodic timer that is randomly set to a number between 25 and 35
seconds (to prevent all routers sending their messages at the same time
and creating excess traffic). The timer counts down; when zero is
reached, the update message is sent, and the timer is randomly set once
again. The expiration timer governs the validity of a route. When a
router receives update information for a route, the expiration timer is
set to 180 seconds for that particular route. Every time a new update for
the route is received, the timer is reset. If there is a problem on an
internet and no update is received within the allotted 180 seconds, the
route is considered expired and the hop count of the route is set to 16,
which means the destination is unreachable. Every route has its own
expiration timer. The garbage collection timer is used to purge a route
from the forwarding table.
Performance
Update Messages. The update messages in RIP have a very simple
format and are sent only to neighbours; they are local. They do not
normally create traffic because the routers try to avoid sending them at
the same time.
Convergence of Forwarding Tables. RIP uses the distance-vector
algorithm, which can converge slowly if the domain is large, but, since
RIP allows only 15 hops in a domain (16 is considered as infinity), there is
normally no problem in convergence.
Robustness. Distance-vector routing is based on the concept that each
router sends what it knows about the whole domain to its neighbors.
This means that the calculation of the forwarding table depends on
information received from immediate neighbors, which in turn receive
their information from their own neighbors.
Metric
In OSPF, like RIP, the cost of reaching a destination from the host is
calculated from the source router to the destination network. An
interesting point about the cost in OSPF is that different service types
(TOSs) can have different weights as the cost.
Forwarding Tables
Each OSPF router can create a forwarding table after finding the
shortest-path tree between itself and the destination using Dijkstra’s
algorithm.
Areas
OSPF was designed to be able to handle routing in a small or large
autonomous system. However, the formation of shortest-path trees in
OSPF requires that all routers flood the whole AS with their LSPs to
create the global LSDB.
Although this may not create a problem in a small AS, it may have
created a huge volume of traffic in a large AS. To prevent this, the AS
needs to be divided into small sections called areas.
Each router in an area needs to know the information about the link
states not only in its area but also in other areas. For this reason, one of
Router link
A router link advertises the existence of a router as a node. A transient
link announces a link to a transient network, a network that is connected
to the rest of the networks by one or more routers. A stub link advertises
a link to a stub network, a network that is not a through network. A
point-to-point link should define the address of the router at the end of
the point-to-point line and the cost to get there.
Network link.
A network link advertises the network as a node. In addition to the
address of the designated router, this type of LSP announces the IP
address of all routers.
External link.
This is also done by an AS router to announce the existence of a single
network outside the AS to the backbone area to be disseminated into
the areas.
OSPF Implementation
OSPF is a very complex protocol; it uses five different types of messages.
Authentication:
This prevents a malicious entity from sending OSPF messages to a router
and causing the router to become part of the routing system to which it
actually does not belong.
OSPF Algorithm
1. After each router has created the shortest-path tree, the algorithm
needs to use it to create the corresponding routing algorithm.
Performance
Update Messages. The link-state messages in OSPF have a somewhat
complex format. They also are flooded to the whole area. If the area is
large, these messages may create heavy traffic and use a lot of
bandwidth.
Convergence of Forwarding Tables. When the flooding of LSPs is
completed, each router can create its own shortest-path tree and
forwarding table; convergence is fairly quick.
Robustness. The OSPF protocol is more robust than RIP because, after
receiving the completed LSDB, each router is independent and does not
depend on other routers in the area.
Introduction
The above figure shows the example of internet with four autonomous
system. AS2, AS3, and AS4 are stub autonomous systems; AS1 is a
transient one. In our example, data exchange between AS2, AS3, and
AS4 should pass through AS1.
Each autonomous system in this figure uses one of the two common
intra domain protocols, RIP or OSPF. Each router in each AS knows how
to reach a network that is in its own AS, but it does not know how to
reach a network in another AS.
R1-R5, R2-R6, and R4- R9. The connection between these pairs is established
over three physical WANs (N5, N6, and N7). However, there is a need for a
logical TCP connection to be created over the physical connection to make the
exchange of information possible. Each logical connection in BGP parlance is
referred to as a session.
There are two problems that need to be addressed:
1. Some border routers do not know how to route a packet destined for non
neighbor ASs. For example, R5 does not know how to route packets destined
for networks in AS3 and AS4. Routers R6 and R9 are in the same situation as
R5: R6 does not know about networks in AS2 and AS4; R9 does not know about
networks in AS2 and AS3.
2. None of the non border routers know how to route a packet destined for
any networks in other ASs.
The updating process does not stop here. For example, after R1 receives
the update message from R2, it combines the reachability information
about AS3 with the reachability information it already knows about AS1
and sends a new update message to R5. Now R5 knows how to reach
networks in AS1 and AS3. The process continues when R1 receives the
update message from R4.
All ASs are using RIP as the intradomain routing protocol. The shaded areas are
the augmentation injected by the BGP protocol; the default destinations are
indicated as zero.
Address Aggreagation
Path Attributes
In both intra domain routing protocols (RIP or OSPF), a destination is
normally associated with two pieces of information: next hop and cost.
The first one shows the address of the next router to deliver the packet;
the second defines the cost to the final destination. Inter domain routing
is more involved and naturally needs more information about how to
reach the final destination.
In BGP these pieces are called path attributes. BGP allows a destination
to be associated with up to seven path attributes. Path attributes are
divided into two broad categories: well-known and optional.
Route Selection
The router extracts the routes which meet the criteria in each step. If
only one route is extracted, it is selected and the process stops;
otherwise, the process continues with the next step.
Note that the first choice is related to the LOCAL-PREF attribute, which
reflects the policy imposed by the administration on the route.
BGP Messages
Open Message. To create a neighbourhood relationship, a router
running BGP opens a TCP connection with a neighbour and sends an
open message.
Update Message. The update message is the heart of the BGP protocol.
It is used by a router to withdraw destinations that have been advertised
previously, to announce a route to a new destination, or both.
Keepalive Message. The BGP peers that are running exchange keep alive
messages regularly (before their hold time expires) to tell each other
that they are alive.
Notification. A notification message is sent by a router whenever an
error condition is detected or a router wants to close the session.
Performance
BGP performance can be compared with RIP. BGP speakers exchange a
lot of messages to create forwarding tables, but BGP is free from loops
and count-to-infinity.