OSPF Routing - Setting up the Router

smashlizardsNetworking and Communications

Oct 29, 2013 (3 years and 5 months ago)

69 views

www.westermo.com
OSPF Routing - Configuring the router
www.westermo.com
Application Note
OSPF Routing
Configuring the router
AN-0181-ENG rev.1_1 Page 1
www.westermo.com
OSPF Routing - Configuring the router
www.westermo.com
Application Note
INTRODUCTION
This application note will detail the steps and options that are involved in configuring the Open
Shortest Path First or OSPF routing protocol on a DR or MR router. It is not a step by step “how-to
guide” and assumes the user is familiar with the OSPF routing protocol and has already configured
the relevant GRE Tunnels or ETH interfaces connected between the routers.
OSPF is a very useful routing protocol and can be implemented with minimal configuration and is
generally the preferred dynamic routing protocol within the control of a single routing policy. Border
Gateway Protocol or BGP could also be used if configured for exterior BGP but involves more
configuration but has the advantage of slightly less bandwidth requirements than OSPF as OSPF
will update the whole routing table on a change whereas BGP will only send the changes but on the
whole the bandwidth requirements for both OSPF and BGP is minimal.
Configuration file
The configuration of OSPF on a router is held in a separate text file, usually named ospf.conf. This
file will need to be manually created using a text editor then placed on to the router.
Below is an example ospf.conf file with two areas, please note that an interface can only exist in
one area. A '#' symbol is used to denote a comment, as can be seen from the example there are
three distinct sections to the config file.
The interfaces where you do not wish OSPF Hello status packets to be sent out of should be set to
passive as shown below and the metric is used a part of a cost algorithm to determine which route
is preferred whereby the smaller the metric the higher the preference.
Note - please ensure there is a carriage return (i.e. press enter) after the last '}”
AN-0181-ENG rev.1_1 Page 2
www.westermo.com
OSPF Routing - Configuring the router
www.westermo.com
Application Note
The sections of the configuration file are:
Macros - These are user defined variables that set values of parameters used in the rest of
the configuration.
Global configuration - Any of the area or interface configuration option can be set to a
default value here to help simplify the configuration.
Areas - At least one area must exist, an area groups interfaces together, any parameters
set in the areas will override any global options. Valid interfaces are ethx, pppx and tunx,
where the x is the interface number.
Please see section pages 6-8 for a complete list of all available commands and their functions.
Typical Configuration file
The following file has been used to ensure that an ADSL based GRE / IPSec Tunnel (tun0) is used
as the Primary link with a 3G to ADSL link is used as Backup (tun1). Apart from the router-id
having to be unique in each router the configuration file was basically the same at in both routers.
#Typical DR250 configuration
#global configuration
redistribute default
router-id 192.168.3.1
#areas
area 0.0.0.0 {
interface tun0 {
hello-interval 10
metric 5
}
interface tun1 {
hello-interval 10
metric 10
}
interface ppp1 {
passive
}
interface ppp3 {
passive
}
interface eth0 {
passive
}
}

AN-0181-ENG rev.1_1 Page 3
www.westermo.com
OSPF Routing - Configuring the router
www.westermo.com
Application Note
Web interface configuration
There is also a small amount of setup required, in the router's web interface, this can be found by
navigating to the following section:
Configure -> OSPF
The ID field is used by OSPF to identify itself with its Neighbours, this field is in the form of an IP
address but is actually an ID. For simplicity use the routers LAN IP address for the ID to make
identification easier. Enter the same ID in the ospf.conf configuration file for the router.
Once you are satisfied that OSPF is configured and running correctly the Debug
level can be turned off.
To view the debug output, connect to the Router via a serial connection and type debug x (where x
is the ASY port number e.g. 0,1,2 or 4), or debug t if you are connecting via Telnet. All of the OSPF
debug information will now be displayed, to stop the debug information, alter the debug level back
to off and disable and re-enable OSPF. To turn off other debug type “debug off”.
AN-0181-ENG rev.1_1 Page 4
www.westermo.com
OSPF Routing - Configuring the router
www.westermo.com
Application Note
Checking OSPF
There are a number of commands for checking the status of the OSPF routing process, the
commands and their functions are listed below
www.westermo.com
OSPF Routing - Configuring the router
www.westermo.com
Application Note
List of the ospf.conf parameters

The area ID shown above is a trunk network as it has the ID of 0.0.0.0 and this is
fine for most applications if all routers are within the same area or network.
AN-0181-ENG rev.1_1 Page 6
www.westermo.com
OSPF Routing - Configuring the router
www.westermo.com
Application Note
AN-0181-ENG rev.1_1 Page 7
www.westermo.com
OSPF Routing - Configuring the router
www.westermo.com
Application Note
Sweden
www.westermo.se
support.sverige@westermo.se
Phone: +46 (0)21 548 08 00
Fax: +46 (0)21 351850
France
www.westermo.fr
support@westermo.fr
Tél : +33 1 69 10 21 00
Fax : +33 1 69 10 21 01
United Kingdom
Web: www.westermo.co.uk
technical@westermo.co.uk
Telephone: +44 (0)1489 580585
Fax: +44 (0)1489 580586
Singapore
www.westermo.com
sales@westermo.com.sg
Phone: +65 6743 9801
Fax: +65 6745 0670
Germany
www.westermo.de
support@westermo.de
Tel: +49(0)7254 95400-0
Fax: +49(0)7254-95400-9
International
www.westermo.com
support@westermo.se
Phone: +46 (0)16 42 80 00
Fax: +46 (0)16 42 80 01
Westermo Teleindustri AB SE-640 40 Stora Sundby, Sweden
Westermo Web site: www.westermo.com
AN-0181-ENG rev.1_1 Page 8