C H A P T E R  16

Configuring Open Shortest Path First (OSPF)

This chapter describes how to configure OSPF.

This chapter contains the following topics:


Understanding Open Shortest Path First (OSPF)

Larger networks typically use Open Shortest Path First (OSPF) instead of RIP. To the administrator of a large and/or complex network, OSPF offers several benefits:

The top level of the hierarchy of an OSPF network is known as an autonomous system (AS) or routing domain, and is a collection of networks with a common administration and routing strategy. The AS is divided into areas: intra-area routing is used when a source and destination address are in the same area, and inter-area routing across an OSPF backbone is used when they are not. An inter-area router communicates with border routers in each of the areas to which it provides connectivity.

The Sun Netra CP3240 switch operating as a router and running OSPF will determine the best route using the assigned cost and the type of the OSPF route. The order for choosing a route if more than one type of route exists is as follows:



Note - External Type 1 is a route that is external to the AS. External Type 2 is a route that was learned from other protocols such as RIP.



Configuring OSPF via CLI

The examples in this section show you how to configure Sun Netra CP3240 switch, first as an inter-area router, and then as a border router. They show two areas, each with its own border router connected to one inter-area router.

The first diagram shows a network segment with an inter-area router connecting areas 0.0.0.2 and 0.0.0.3. The example script shows the commands used to configure a Sun Netra CP3240 switch as the inter-area router in the diagram by enabling OSPF on port 0/2 in area 0.0.0.2 and port 0/3 in area 0.0.0.3.

Example 1: Configuring an Inter-Area Router


FIGURE 16-1 SPF Example Network Diagram: Inter-area Router

Enable Routing for the Switch

The following command sequence enables ip routing for the switch.


CODE EXAMPLE 16-1 Enabling Routing for the Switch
config
  ip routing
exit

Assign IP Addresses for Ports

The following sequence enables routing and assigns IP addresses for ports 0/2 and 0/3:


CODE EXAMPLE 16-2 Assigning IP Addresses for Ports
config
  interface 0/2
    routing
    ip address 192.150.2.1 255.255.255.0
  exit
  interface 0/3 
    routing
    ip address 192.150.3.1 255.255.255.0
  exit
exit

Specify Router ID and Enable OSPF for the Switch

The following sequence specifies the router ID and enables OSPF for the switch. Disable 1583 compatibility to prevent the routing loop.


CODE EXAMPLE 16-3 Specifying Router ID and Enabling OSPF for the Switch
Config
  router ospf
    enable
    router-id 192.150.9.9
    no 1583compatibility
  exit
exit

Enable and Configure OSPF for the Ports

The following sequence enables OSPF and sets the OSPF priority and cost for the ports.


CODE EXAMPLE 16-4 Enabling and Configuring OSPF for the Ports
config
  interface 0/2
    ip ospf
    ip ospf areaid 0.0.0.2
    ip ospf priority 128
    ip ospf cost 32
  exit
  interface 0/3
    ip ospf
    ip ospf areaid 0.0.0.3
    ip ospf priority 255
    ip ospf cost 64
  exit
exit

Example 2: Configuring OSPF on a Border Router

The next diagram shows the same network segment with the Sun Netra CP3240 switch operating as the border router in area 0.0.0.2. The example script shows the commands used to configure the switch with OSPF enabled on port 1/0/2 for communication with the inter-area router in the OSPF backbone, and on ports 1/0/3 and 1/0/4 for communication with subnets within area 0.0.0.2.

FIGURE 16-2 OSPF Example Network Diagram: Border Router


Enable Routing for the Switch


CODE EXAMPLE 16-5 Enabling Routing for the Switch
config
  ip routing
exit

Enable Routing and Assign IP for Ports 1/0/2, 1/0/3, and 1/0/4


CODE EXAMPLE 16-6 Enabling Routing and Assigning IP Ports 1/0/2, 1/0/3, and 1/0/4
config
  interface 0/2
    routing
    ip address 192.150.2.2 255.255.255.0
  exit
  interface 0/3 
    routing
    ip address 192.130.3.1 255.255.255.0
  exit
interface 0/4
    routing
    ip address 192.64.4.1 255.255.255.0
  exit
exit

Specify Router ID and Enable OSPF for the Switch

Disable 1583 compatibility to prevent a routing loop.


CODE EXAMPLE 16-7 Specifying Router ID and Enabling OSPF for the Switch
config
  router ospf
    enable
    router-id 192.130.1.1
    no 1583compatibility
  exit
exit

Enable OSPF for the Ports

Enable OSPF for the ports and set the OSPF priority and cost for the ports.


CODE EXAMPLE 16-8 Enabling OSPF for the Ports
config
  interface 0/2
    ip ospf
    ip ospf areaid 0.0.0.2
    ip ospf priority 128
    ip ospf cost 32
  exit
  interface 0/3
    ip ospf
    ip ospf areaid 0.0.0.2
    ip ospf priority 255
    ip ospf cost 64
  exit
interface 0/4
    ip ospf
    ip ospf areaid 0.0.0.2
    ip ospf priority 255
    ip ospf cost 64
  exit
exit


Configuring OSPF via Web Interface

Similar configurations as described in the previous CLI sections can be performed using the Web interface.

Configuring an Inter-Area Router

Use the following screens to perform an inter-area router configuration using the Web interface:

Configuring a Border Router

Use the following screens to perform the same configuration using the Graphical User Interface: