COMP313 - Computer Systems IP Routing Notes
COMP313 - Computer Systems IP Routing Notes
IP Routing Notes
The following set of notes were extracted from Wikipedia (http://www.wikipedia.com), and covers
the following topics:
• Routing Tables (RIB)
• Interior Gateway Protocols
◦ Routing Information Protocol (RIP)
◦ Open Shortest Path First (OSPF)
◦ Intermediate System to Intermediate System (IS-IS)
• Exterior Gateway Protocols
◦ Border Gateway Protocol (BGP)
• Address Resolution Protocol (ARP)
Introduction
When a URL, such as http://www.moodle.cs.ukzn.ac.za/cs, is requested by a web browser, a
number of Internet protocols are involved in delivering IP packets from the source to the
destination. In this particular case, the destination is a webserver hosted by a computer system on
one of the UKZN LANs, and is, therefore not likely to be on LAN the URL was requested from.
(e.g. your home PC)
The first protocol involved in delivering IP packets, is the Domain Name System (DNS). It is used
by the browser to look up the destination IP address that has been registered for the
www.moodle.cs.ukzn.ac.za domain name. Once the IP address has been obtained (e.g.
146.230.90.21), and it has been determined that the destination address is on a remote LAN, the IP
packets are routed to the next gateway, or hop, along the route to the destination LAN. On the
source system, this is called the default gateway. One or more hops, or gateways, might need to be
traversed in order for the IP packets to arrive at their destination LAN.
The TCP/IP protocol is the second protocol involved, as it is used to establish a socket-based
connection to the webserver. The contents of the IP packets sent over the connection will be the
HTTP protocol messages to request the 'cs' resource from the webserver. HTTP is a text-based
protocol, and is the third protocol involved in our example scenario.
Throughout the routing process, each router along the way determines if the IP packet is destined
for a local network (which it is directly connected to), or a remote LAN. This calculation is done by
looking at the destination network address (e.g. 146.230.90.0), which is extracted from the
destination IP address of the IP packet by use of the network mask (e.g. 255.255.255.0) of the LAN.
If the destination is a remote LAN, the router performs a Routing Information Base (RIB), query to
deternine the next router to forward the IP packets to. This process is repeated until the packets
arrive at their destination network.
At this point the IP routing process is over, and all that needs to be done is to resolve the destination
IP Address to the hardware address of the destination system on the LAN. This is done via the
Address Resolution Protocol (ARP), which is the fourth protocol in our scenario, and the packets
are delivered to their destination.
There are other protocols involved, however, but they do not necessarily take place during the
actual routing of packets. They are the routing protocols, and are usually run between routers of
MANs and WANs periodically. In order for our HTTP scenario to work, we say that the routing
protocols need to have stabilised at time of the web URL query – i.e. the routing protocols occur
before the HTTP query, but not in any particular order. The remainder of these notes describe the
routing protocols, all of which are centered around a common data structure – the routing table, or
routing information base.
• The columns Network Destination and Netmask together describe the Network id as
mentioned earlier. For example, destination 192.168.0.0 and netmask 255.255.255.0 can be
written as network id 192.168.0.0/24.
• The Gateway column contains the same information as the Next hop, i.e. it points to the
gateway through which the network can be reached.
• The Interface indicates what locally available interface is responsible for reaching the
gateway. In this example, gateway 192.168.0.1 (the internet router) can be reached through
the local network card with address 192.168.0.100.
• Finally, the Metric indicates the associated cost of using the indicated route. This is useful
for determining the efficiency of a certain route from two points in a network. In this
example, it is more efficient to communicate with the computer itself through the use of
address 127.0.0.1 (called “localhost”) than it would be through 192.168.0.100 (the IP
address of the local network card).
Routing tables are generally not used directly for packet forwarding in modern router architectures;
instead, they are used to generate the information for a smaller forwarding table. A forwarding table
contains only the routes which are chosen by the routing algorithm as preferred routes for packet
forwarding. It is often in a compressed or pre-compiled format that is optimized for hardware
storage and lookup.
This router architecture separates the Control Plane function of the routing table from the
Forwarding Plane function of the forwarding table. This separation of control and forwarding
provides uninterrupted performance.
Neighbor relationships
Routers in the same broadcast domain or at each end of a point-to-point telecommunications link
form adjacencies when they have detected each other. This detection occurs when a router identifies
itself in a hello OSPF protocol packet. This is called a two-way state and is the most basic
relationship. The routers in an Ethernet or frame relay network select a designated router (DR) and
a backup designated router (BDR) which act as a hub to reduce traffic between routers. OSPF uses
both unicast and multicast to send "hello packets" and link state updates.
As a link state routing protocol, OSPF establishes and maintains neighbor relationships in order to
exchange routing updates with other routers. The neighbor relationship table is called an adjacency
database in OSPF. Provided that OSPF is configured correctly, OSPF forms neighbor relationships
only with the routers directly connected to it. In order to form a neighbor relationship between two
routers, the interfaces used to form the relationship must be in the same area. Generally an interface
is only configured in a single area, however you can configure an interface to belong to multiple
areas. In the second area, such an interface must be configured as a secondary interface. (A
neighbor state simulation shows how neighbor state changes from Down to Full Adjacency
progressively with exchanging Hello, DD, Request, Update, and Ack packets).
Uses
Most Internet service providers must use BGP to establish routing between one another (especially
if they are multihomed).[citation needed] Therefore, even though most Internet users do not use it
directly, BGP is one of the most important protocols of the Internet.[citation needed] Compare this
with Signaling System 7 (SS7), which is the inter-provider core call setup protocol on the PSTN.
[citation needed]
Very large private IP networks use BGP internally. An example would be the joining of a number of
large OSPF (Open Shortest Path First) networks where OSPF by itself would not scale to size.
Another reason to use BGP is multihoming a network for better redundancy, either to multiple
access points of a single ISP or to multiple ISPs.
Operation
BGP neighbors, called peers, are established by manual configuration between routers to create a
TCP session on port 179. A BGP speaker sends 19-byte keep-alive messages every 30 seconds to
maintain the connection. Among routing protocols, BGP is unique in using TCP as its transport
protocol.
When BGP runs between two peers in the same autonomous system (AS), it is referred to as
Internal BGP (iBGP or Interior Border Gateway Protocol). When it runs between different
autonomous systems, it is called External BGP (EBGP or Exterior Border Gateway Protocol).
Routers on the boundary of one AS exchanging information with another AS are called border or
edge routers or simply eBGP peers and are typically connected directly, while iBGP peers can be
interconnected through other intermediate routers. Other deployment topologies are also possible,
such as running eBGP peering inside a VPN tunnel, allowing two remote sites to exchange routing
information in a secure and isolated manner. The main difference between iBGP and eBGP peering
is in the way routes that were received from one peer are propagated to other peers. For instance,
new routes learned from an eBGP peer are typically redistributed to all other iBGP peers as well as
all eBGP peers (if transit mode is enabled on the router). However, if new routes were learned on an
iBGP peering, then they are re-advertised only to all other eBGP peers. These route-propagation
rules effectively require that all iBGP peers inside an AS are interconnected in a full mesh.
Filtering routes learned from peers, their transformation before redistribution to peers or before
plumbing them into the routing table is typically controlled via route-maps mechanism. These are
basically rules which allow to apply certain actions to routes matching certain criteria on either
ingress or egress path. These rules can specify that the route is to be dropped or, alternatively, its
attributes are to be modified. It is usually the responsibility of the AS administrator to provide the
desired route-map configuration on a router supporting BGP.
In the simplest arrangement all routers within a single AS and participating in BGP routing must be
configured in a full mesh: each router must be configured as peer to every other router. This causes
scaling problems, since the number of required connections grows quadratically with the number of
routers involved. To alleviate the problem, BGP implements two options: route reflectors (RFC
4456) and BGP confederations (RFC 5065). The following discussion of basic UPDATE processing
assumes a full iBGP mesh.
Route selection
The BGP standard specifies a number of decision factors, more than are used by any other common
routing process, for selecting NLRI (Network Layer Reachability Information) to go into the Loc-
RIB (Routing Information Base). The first decision point for evaluating NLRI is that its next-hop
attribute must be reachable (or resolvable). Another way of saying the next-hop must be reachable is
that there must be an active route, already in the main routing table of the router, to the prefix in
which the next-hop address is reachable.
Next, for each neighbor, the BGP process applies various standard and implementation-dependent
criteria to decide which routes conceptually should go into the Adj-RIB-In. The neighbor could
send several possible routes to a destination, but the first level of preference is at the neighbor level.
Only one route to each destination will be installed in the conceptual Adj-RIB-In. This process will
also delete, from the Adj-RIB-In, any routes that are withdrawn by the neighbor.
Whenever a conceptual Adj-RIB-In changes, the main BGP process decides if any of the neighbor's
new routes are preferred to routes already in the Loc-RIB. If so, it replaces them. If a given route is
withdrawn by a neighbor, and there is no other route to that destination, the route is removed from
the Loc-RIB, and no longer sent, by BGP, to the main routing table manager. If the router does not
have a route to that destination from any non-BGP source, the withdrawn route will be removed
from the main routing table.
Operating scope
The Address Resolution Protocol is a request and reply protocol that runs encapsulated by the line
protocol. It is communicated within the boundaries of a single network, never routed across
internetwork nodes. This property places ARP into the Link Layer of the Internet Protocol Suite,[2]
while in the Open Systems Interconnection (OSI) model, it is often described as residing between
Layers 2 and 3, being encapsulated by Layer 2 protocols. However, ARP was not developed in the
OSI framework.
Packet structure
The Address Resolution Protocol uses a simple message format that contains one address resolution
request or response. The size of the ARP message depends on the upper layer and lower layer
address sizes, which are given by the type of networking protocol (usually IPv4) in use and the type
of hardware or virtual link layer that the upper layer protocol is running on. The message header
specifies these types, as well as the size of addresses of each. The message header is completed with
the operation code for request (1) and reply (2). The payload of the packet consists of four
addresses, the hardware and protocol address of the sender and receiver hosts.
The principal packet structure of ARP packets is shown in the following table which illustrates the
case of IPv4 networks running on Ethernet. In this scenario, the packet has 48-bit fields for the
sender hardware address (SHA) and target hardware address (THA), and 32-bit fields for the
corresponding sender and target protocol addresses (SPA and TPA). Thus, the ARP packet size in
this case is 28 bytes. The EtherType for ARP is 0x0806.
Example
For example, the computers Matterhorn and Washington are in an office, connected to each other on
the office local area network by Ethernet cables and network switches, with no intervening
gateways or routers. Matterhorn wants to send a packet to Washington. Through DNS, it determines
that Washington's IP address is 192.168.0.55. In order to send the message, it also needs to know
Washington's MAC address. First, Matterhorn uses a cached ARP table to look up 192.168.0.55 for
any existing records of Washington's MAC address (00:eb:24:b2:05:ac). If the MAC address is
found, it sends the IP packet on the link layer to address 00:eb:24:b2:05:ac via the local network
cabling. If the cache did not produce a result for 192.168.0.55, Matterhorn has to send a broadcast
ARP message (destination FF:FF:FF:FF:FF:FF MAC address which is accepted by all computers)
requesting an answer for 192.168.0.55. Washington responds with its MAC address (and its IP).
Washington may insert an entry for Matterhorn into its own ARP table for future use. The response
information is cached in Matterhorn's ARP table and the message can now be sent.
Because ARP does not provide methods for authenticating ARP replies on a network, ARP replies
can come from systems other than the one with the required Layer 2 address. An ARP proxy is a
system which answers the ARP request on behalf of another system for which it will forward traffic,
normally as a part of the network's design, such as for a dialup internet service. By contrast, in ARP
spoofing the answering system, or spoofer, replies to a request for another system's address with the
aim of intercepting data bound for that system. A malicious user may use ARP spoofing to perform
a man-in-the-middle or denial-of-service attack on other users on the network. Various software
exists to both detect and perform ARP spoofing attacks, though ARP itself does not provide any
methods of protection from such attacks.