Selasa, 14 Desember 2010

OSPF The OSPF Protocol

Open Shortest Path Routing (OSPF) is a shortest path first (SPF) or link-state protocol. OSPF is an interior gateway protocol that distributes routing information between routers in a single autonomous system. OSPF chooses the least cost path as the best path. Suitable for complex networks with a large number of routers, OSPF provides equal cost multipath routing where packets to a single destination can be sent via more than one interface simultaneously. In a link-state protocol, each router maintains a database describing the entire AS topology, which it builds out of the collected link state advertisements of all routers. Each participating router distributes its local state (i.e., the router's usable interfaces and reachable neighbors) throughout the AS by flooding. Each multiaccess network that has at least two attached routers has a designated router and a backup designated router. The designated router floods a link state advertisement for the multiaccess network and has other special responsibilities. The designated router concept reduces the number of adjacencies required on a multiaccess network.
OSPF allows networks to be grouped into areas. Routing information passed between areas is abstracted, potentially allowing a significant reduction in routing traffic. OSPF uses four different types of routes, listed in order of preference: intra-area, inter-area, type 1 external and type 2 external. Intra-area paths have destinations within the same area, inter-area paths have destinations in other OSPF areas and Autonomous System External (ASE) routes are routes to destinations external to the AS. Routes imported into OSPF as type 1 routes are supposed to be from igps whose external metrics are directly comparable to OSPF metrics. When a routing decision is being made, OSPF will add the internal cost to the AS Border router to the external metric. Type 2 ASEs are used for egps whose metrics are not comparable to OSPF metrics. In this case, only the internal OSPF cost to the AS Border router is used in the routing decision.
From the topology database, each router constructs a tree of the shortest paths with itself as the root. This shortest-path tree gives the route to each destination in the AS. Externally derived routing information appears on the tree as leaves. The link-state advertisement format distinguishes between information acquired from external sources and information acquired from internal routers, so there is no ambiguity about the source or reliability of routes. Externally derived routing information (for example, routes learned from EGP or BGP) is passed transparently through the autonomous system and is kept separate from OSPF's internally derived data. Each external route can also be tagged by the advertising router, enabling a passing of additional information between routers on the borders of the autonomous system.
OSPF optionally includes type of service (TOS) routing and allows administrators to install multiple routes to a given destination for each type of service (e.g. low delay or high throughput.) A router running OSPF uses the destination address and the type of service to choose the best route to the destination.
OSPF intra- and inter-area routes are always imported into the GateD routing database with a preference of 10. It would be a violation of the protocol if an OSPF router did not participate fully in the area's OSPF, so it is not possible to override this. Although it is possible to give other routes lower preference values explicitly, it is ill-advised to do so.
Hardware multicast capabilities are also used where possible to deliver link-status messages.
OSPF areas are connected by the backbone area, the area with identifier 0.0.0.0. All areas must be logically contiguous and the backbone is no exception. To permit maximum flexibility, OSPF allows the configuration of virtual links to enable the backbone area to appear contiguous despite the physical reality.
All routers in an area must agree on that area's parameters. A separate copy of the link-state algorithm is run for each area. Because of this, most configuration parameters are defined on a per area basis. All routers belonging to an area must agree on that area's configuration. Misconfiguration will lead to adjacencies not forming between neighbors, and routing information might not flow, or even loop.

Authentication

  All OSPF protocol exchanges are authenticated. Authentication guarantees that routing information is only imported from trusted routers, to protect the Internet and its users. A variety of authentication schemes can be used but a single scheme must be configured for each area. This enables some areas to use much stricter authentication than others.
OSPF protocol exchanges may be authenticated. Authentication guarantees that routing information is imported only from trusted routers, to protect the Internet and its users. There are two authentication schemes available. The first uses a simple authentication key of up to 8 characters and is standardized. The second is still experimental and uses the MD5 algorithm and an authentication key of up to 16 characters.
The simple password provides very little protection because in many cases it is possible to easily capture packets from the network and learn the authentication key. The experimental MD5 algorithm provides much more protection as it does not include the authentication key in the packet.
The OSPF specification currently specifies that the authentication type be configured per area with the ability to configure separate passwords per interface. This has been extended to allow the configuration of different authentication types and keys per interface. In addition it is possible to specify both a primary and a secondary authentication type and key on each interface. Outgoing packets use the primary authentication type, but incoming packets may match either the primary or secondary authentication type and key.

The OSPF Statement

 
 ospf  yes |  no |  on |  off [  {  
      defaults  {  
           preference  preference  ;  
           cost  cost  ;  
           tag [  as ]  tag  ;  
           type  1 |  2  ;  
      }  ;  
      exportlimit  routes  ;  
      exportinterval  time  ;  
      traceoptions  trace_options  ;  
      monitorauthkey  authkey  ;  
      monitorauth  none | ( [  simple |  md5 ]  authkey )  ;  
      backbone | (  area  area )  {  
           authtype  0 |  1 |  none |  simple  ;  
           stub [  cost  cost]  ;  
           networks  {  
                network [  restrict ]  ;  
                network  mask  mask [  restrict ]  ;  
                network  masklen  number [  restrict ]  ;  
                host  host [  restrict ]  ;  
           }  ;  
           stubhosts  {  
                host  cost  cost  ;  
           }  ;  
           interface  interface_list; [ cost  cost ]  {  
                interface_parameters  
           }  ;  
           interface  interface_list  nonbroadcast [ cost  cost ]  {  
                pollinterval  time  ;  
                routers  {  
                     gateway [  eligible ]  ;  
                }  ;  
                interface_parameters  
           }  ;  
           Backbone only:  
           virtuallink  neighborid  router_id  transitarea  area  {  
                interface_parameters  
           }  ;  
      }  ;  
 } ]  ;
The following are the interface_parameters referred to above. They may be specified on any class of interface and are described under the interface clause.
  enable |  disable  ;  
     retransmitinterval  time  ;  
     transitdelay  time  ;  
     priority  priority  ;  
     hellointerval  time  ;  
     routerdeadinterval  time  ;  
    [ secondary]  auth ( none| simple| md5| auth_key)  ;  
     authkey  auth_key  ;

    defaults
    These parameters specify the defaults used when importing OSPF ASE routes into the gated routing table and exporting routes from the gated routing table into OSPF ASEs.
    preference preference
    The preference is used to determine how OSPF routes compete with routes from other protocols in the gated routing table. The default value is 150.
    cost cost
    The cost is used when exporting a non-OSPF route from the GateD routing table into OSPF as an ASE. The default value is 1. This may be explicitly overridden in export policy.
    tag [ as ] tag
    OSPF ASE routes have a 32 bit tag field that is not used by the OSPF protocol, but may be used by export policy to filter routes. When OSPF is interacting with an egp, the tag field may be used to propagate AS path information, in which case the as keyword is specified and the tag is limited to 12 bits of information. If not specified, the tag is set to zero.
    type 1 | 2
    Routes exported from the GateD routing table into OSPF default to becoming type 1 ASEs. This default may be explicitly changed here and overridden in export policy.

    ASE export rate



    Because of the nature of OSPF, the rate at which ASEs are flooded must be limited. These two parameters can be used to adjust those rate limits.
    exportinterval time
    This specifies how often a batch of ASE link state advertisements will be generated and flooded into OSPF. The default is once per second.
    exportlimit routes
    This parameter specifies how many ASEs will be generated and flooded in each batch. The default is 100.

    traceoptions trace_options



    Specifies the tracing options for OSPF. (See Trace Statements and the OSPF specific tracing options below.)

    monitorauthkey authkey



    OSPF state may be queried using the ospf_monitor utility. This utility sends non-standard OSPF packets which generate a text response from OSPF. By default these requests are not authenticated, if an authentication key is configured, the incoming requests must match the specified authentication key. No OSPF state may be changed by these packets, but the act of querying OSPF can utilize system resources.

    backbone


    area area



    Each OSPF router must be configured into at least one OSPF area. If more than one area is configured, at least one must the be backbone. The backbone may only be configured using the backbone keyword, it may not be specified as area 0. The backbone interface may be a virtuallink.
    authtype 0 | 1 | none | simple
    OSPF specifies an authentication scheme per area. Each interface in the area must use this same authentication scheme although it may use a different authenticationkey. The currently valid values are none ( 0) for no authentication, or simple ( 1) for simple password authentication.
    stub [ cost cost]
    A stub area is one in which there are no ASE routes. If a cost is specified, this is used to inject a default route into the area with the specified cost.
    networks
    The networks list describes the scope of an area. Intra-area LSAs that fall within the specified ranges are not advertised into other areas as inter-area routes. Instead, the specified ranges are advertised as summary network LSAs. If restrict is specified, the summary network LSAs are not advertised. Intra-area LSAs that do not fall into any range are also advertised as summary network LSAs. This option is very useful on well designed networks in reducing the amount of routing information propagated between areas. The entries in this list are either networks, or a subnetwork/mask pair. See section 4.25.1 on route filtering for more detail about specifying ranges.
    stubhosts
    This lists specifies directly attached hosts that should be advertised as reachable from this router and the costs they should be advertised with. Point-to-point interfaces on which it is not desirable to run OSPF should be specified here. It is also useful to assign a additional address to the loopback interface (one not on the 127 network) and advertise it as a stub hosts. If this address is the same one used as the router-id it enables routing to OSPF routers by router-id, instead of by interface address. This is more reliable than routing to one of the routers interface addresses which may not always be reachable.

    interface interface_list [ cost cost ]



    This form of the interface clause is used to configure a broadcast (which requires IP multicast support) or a point-to-point interface. See section 4.8.2 on interface list specification for the description of the interface_list. Each interface has a cost. The costs of all interfaces a packet must cross to reach a destination are summed to get the cost to that destination. The default cost is one, but another non-zero value may be specified.
    Interface parameters common to all types of interfaces are:

    retransmitinterval time
    The number of seconds between link state advertisement retransmissions for adjacencies belonging to this interface.
    transitdelay time
    The estimated number of seconds required to transmit a link state update over this interface. Transitdelay takes into account transmission and propagation delays and must be greater than 0.
    priority priority
    A number between 0 and 255 specifying the priority for becoming the designated router on this interface. When two routers attached to a network both attempt to become designated router, the one with the highest priority wins. A router whose router priority is set to 0 is ineligible to become designated router.
    hellointerval time
    The length of time, in seconds, between Hello packets that the router sends on the interface.
    routerdeadinterval time
    The number of seconds not hearing a router's Hello packets before the router's neighbors will declare it down.
    [ secondary] auth ( none| simple| md5| auth_key)
    Specify the type of authentication scheme to use on this interface.
    authkey auth_key
    Used by OSPF authentication to generate and verify the authentication field in the OSPF header. The authentication key can be configured on a per interface basis. It is specified by one to eight decimal digits separated by periods, a one to eight byte hexadecimal string preceded by 0x, or a one to eight character string in double quotes.
    Point-to-point interfaces also support this additional parameter:

    nomulticast
    By default, OSPF packets to neighbors on point-to-point interfaces are sent via the IP multicast mechanism. Although, some implementations of IP multicasting for Unix have a bug that precludes the use of IP multicasting on these interfaces. Gated will detect this condition and fall back to using sending unicast OSPF packets to this point-to-point neighbor. If the use of IP multicasting is not desired because the remote neighbor does not support it, the nomulticast parameter may be specified to force the use of unicast OSPF packets. This option may also be used to eliminate warnings when Gated detects the bug mentioned above.

    interface interface_list nonbroadcast [ cost cost ]



    This form of the interface clause is used to specify a nonbroadcast interface on a non-broadcast multi-access (NBMA) media. Since an OSPF broadcast media must support IP multicasting, a broadcast capable media, such as Ethernet, that does not support IP multicasting must be configured as a non-broadcast interface. A non-broadcast interface supports any of the standard interface clauses listed above, plus the following two that are specific to non-broadcast interfaces:

    pollinterval time
    Before adjacency is established with a neighbor, OSPF packets are sent periodically at the specified pollinterval.
    routers
    By definition it is not possible to send broadcast packets to discover OSPF neighbors on a non-broadcast, so all neighbors must be configured. The list includes one or more neighbors and an indication of their eligibility to become a designated router.

    virtuallink neighborid router_id transitarea area



    Virtual links are used to establish or increase connectivity of the backbone area. The neighborid is the router_id of the other end of the virtual link. The transit area specified must also configured on this system. All standard interface parameters defined by the interface clause above may be specified on a virtual link.

Tracing options

In addition to the following OSPF specific trace flags, OSPF supports the state which traces interface and neighbor state machine transitions.

lsabuild
Link State Advertisement creation
spf
Shortest Path First (SPF) calculations
lsatransmit
Link State Advertisement (LSA) transmission. Non implemented.
lsareceive
LSA reception. Non implemented.
state
State transitions. Non implemented.
Packet tracing options (which may be modified with detail, send and recv):

hello
OSPF HELLO packets which are used to determine neighbor reachability.
dd
OSPF Database Description packets which are used in synchronizing OSPF databases.
request
OSPF Link State Request packets which are used in synchronizing OSPF databases.
lsu
OSPF Link State Update packets which are used in synchronizing OSPF databases.
ack
OSPF Link State Ack packets which are used in synchronizing OSPF databases.

The new OSPF Protocol

  Gated version 3_6Alpha_2 and higher includes a new implemetation of the OSPF protocol. The configuration syntax stays the same except:

  1. The export limit, exportinterval, monitorauthkey, monitorauth, networks, stubhosts statements are no longer available (they may be put back in the future).
  2. The bf simple authentication scheme is not implemented.
  3. The OSPF specific trace options available are: state, drelection, db, spf, flood As for the packet details, are available: hello, dd, lsr, lsu, lsa.

What Is a Subnet Mask?

You learned in Chapter 2, “Introduction to Microsoft Networking,” how the subnet
mask can be used to determine whether a host is a local or remote host. To review,
the IP address is ANDed with the subnet mask to extract the network ID for the local
network on which the host resides. The IP address that IP receives in the pseudo
header is now ANDed with the subnet mask to determine a network ID.
It is important to note that the network ID generated might be incorrect. If the host
attempting to send is a Class C host using 255.255.255.0 as the subnet mask, ANDing
generates an incorrect address if the remote host is a Class B. This does not matter,
however, because the network IDs will not match (remember the first octet differs,
depending on the class of network).
As you can see, therefore, the subnet mask enables you to extract the network ID.
This information is used to see whether the datagram is for the local network. If it is
not, the system needs to look at the remote IP address and use the routing table to
figure out where to send it.
Introduction to Routing
After the network IDs are known, they can be compared. The only case where they
should match is if the two hosts are on the same network. If the host that you are
trying to reach is on the same network, the IP layer finds that host and transmits the
data to it. If not, you need to look for a route to the host. This will be done in the
routing table. All devices that have IP have a routing table. The following is an
example of a routing table from an NT system:
Active Routes:
Network Address Netmask Gateway Address Interface Metric
0.0.0.0 0.0.0.0 206.51.250.69 206.51.250.69 1
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
206.51.250.0 255.255.255.0 206.51.250.69 206.51.250.69 1
206.51.250.69 255.255.255.255 127.0.0.1 127.0.0.1 1
206.51.250.255 255.255.255.255 206.51.250.69 206.51.250.69 1
224.0.0.0 224.0.0.0 206.51.250.69 206.51.250.69 1
255.255.255.255 255.255.255.255 206.51.250.69 206.51.250.69 1
If you want to look at your routing table, you can use the ROUTE command. The
syntax for the ROUTE command is as follows:

Manipulates network routing tables.
ROUTE [-f] [command [destination] [MASK netmask] [gateway] [METRIC metric]]
-f Clears the routing tables of all gateway entries. If this is
used in conjunction with one of the commands, the tables are
cleared prior to running the command.
-p When used with the ADD command, makes a route persistent across
boots of the system. By default, routes are not preserved
when the system is restarted. When used with the PRINT command,
displays the list of registered persistent routes. Ignored for
all other commands, which always affect the appropriate
persistent routes.
command Specifies one of four commands
PRINT Prints a route
ADD Adds a route
DELETE Deletes a route
CHANGE Modifies an existing route
destination Specifies the host.
MASK If the MASK keyword is present, the next parameter is
interpreted as the netmask parameter.
netmask If provided, specifies a sub-net mask value to be associated
with this route entry. If not specified, it defaults to
255.255.255.255.
gateway Specifies gateway.
METRIC specifies the metric/cost for the destination
All symbolic names used for destination are looked up in the network database
file NETWORKS. The symbolic names for gateway are looked up in the host name
database file HOSTS.
If the command is print or delete, wildcards may be used for the destination
and gateway, or the gateway argument may be omitted.
In the case of a host, the routing table generally does not contain actual routing
information, except for the default gateway (router) address. Any packet not on the
local network is normally sent to the default gateway. IP on the gateway then looks in
its routing table for a route to the remote network. Occasions will arise where you
have entries in the local host’s routing table. In those cases, this table is consulted to
find the first hop in the route.
A routing table contains the following five pieces of information:
u Network Address. The actual network ID to which the entry describes a
route. This is the real network ID, not the one generated earlier when checking,
if the host is local or remote.
u Netmask. The subnet mask that can be used to generate the network ID. The
system runs through the table and ANDs the IP address you are trying to reach
with each of the netmasks. Then it can compare the result to the Network
Address to see whether they match. If they match, a route has been found.
u Gateway Address. Where to send the packet if it is a remote network ID to
which the computer is sending.
u Interface. Which network interface to send the packet from. Normally you
only have one network card, and this is the same for all entries. (The exception
here is the loopback and multicasting addresses.)
u Metric. How far away this network is. This is the number of routers (gateways)
that the packet must travel through to get to the remote.
There will often be an entry for network 0.0.0.0 with a netmask of 0.0.0.0. This is the
entry for the default gateway and is checked last. If you work it out in binary, you will
see that all addresses match this one.