modified on 21 May 2014 at 15:43 ••• 178,441 views

Manual:Routing/OSPF

From MikroTik Wiki

Jump to: navigation, search
Version.png

Applies to RouterOS: v3, v4 +


Contents

Summary

MikroTik RouterOS implements OSPF version 2 (RFC 2328). The OSPF protocol is the link-state protocol that takes care of the routes in the dynamic network structure that can employ different paths to its subnetworks. It always chooses shortest path to the subnetwork first.


Instance

Sub-menu: /routing ospf instance


Since v3.17 it is possible to run multiple OSPF instances. General OSPF configuration now is moved to instances.

Properties

Property Description
distribute-default (never | if-installed-as-type-1 | if-installed-as-type-2 | always-as-type-1 | always-as-type-2; Default: never) specifies how to distribute default route. Should be used for ABR (Area Border router) or ASBR (Autonomous System boundary router)
  • never - do not send own default route to other routers
  • if-installed-as-type-1 - send the default route with type 1 metric only if it has been installed (a static default route, or route added by DHCP, PPP, etc.)
  • if-installed-as-type-2 - send the default route with type 2 metric only if it has been installed (a static default route, or route added by DHCP, PPP, etc.)
  • always-as-type-1 - always send the default route with type 1 metric
  • always-as-type-2 - always send the default route with type 2 metric
domain-id (Hex|Address;) MPLS related parameter. Identifies OSPF domain of the instance. This value is attached to OSPF routes redistributed in BGP as VPNv4 routes as BGP extended community attribute, and used when BGP VPNv4 routes are redistributed back OSPF to determine whether to generate inter-area or AS-external LSA for that route. By default Null domain-id is used, as described in RFC 4577.
domain-tag (integer: 0..4294967295 ;) if set, then used in route redistribution (as route-tag in all external LSAs generated by this router), and in route calculation (all external LSAs having this route tag are ignored). Needed for interoperability with older Cisco systems. By default not set.
in-filter (string;) name of the routing filter chain used for incoming prefixes
metric-bgp (integer|auto; Default: 20) routes learned from the BGP protocol are redistributed with this metric. When set to auto, MED attribute value from BGP route will be used, if MED is not set then default value 20 is used.
metric-connected (integer; Default: 20) routes to directly connected networks are distributed with this metric
metric-default (integer; Default: 1) the default route is distributed with this metric
metric-other-ospf (integer|auto; Default: 20) routes learned from other OSPF instances are redistributed with this metric. If auto is configured, then the cost from previous instance is taken into account, otherwise cost is set to statically configured value.
metric-rip (integer; Default: 20) routes learned from the RIP protocol are redistributed with this metric
metric-static (integer; Default: 20) static routes are distributed with this metric
mpls-te-area (string;) the area used for MPLS traffic engineering. TE Opaque LSAs are generated in this area. No more than one OSPF instance can have mpls-te-area configured.
mpls-te-router-id (ip;) loopback interface from which to take IP address used as Router-ID in MPLS TE Opaque LSAs
out-filter (string;) name of the routing filter chain used for outgoing prefixes
redistribute-bgp (as-type-1 | as-type-2 | no; Default: no) redistribute routes learned by the BGP protocol
redistribute-connected (as-type-1 | as-type-2 | no; Default: no) redistribute connected routes, i.e. routes to directly reachable networks
redistribute-other-ospf (as-type-1 | as-type-2 | no; Default: no) redistribute routes learned by other OSPF instances
redistribute-rip (as-type-1 | as-type-2 | no; Default: no) redistribute routes learned by the RIP protocol
redistribute-static (as-type-1 | as-type-2 | no; Default: no) redistribute static routes
router-id (IP address; Default: 0.0.0.0) the OSPF Router ID. If not specified, OSPF use lowest IP address configured on an active interface is used.
routing-table (name of routing table;) the routing table this OSPF instance operates on
use-dn (yes | no;) Forces to use or ignore DN bit. Useful in some CE PE scenarios to inject intra area routes into VRF. If parameter is unset then DN bit is used according to RFC. Available since v6rc12.


Notes

OSPF protocol supports two types of metrics:

  • type1 - ospf metric is the sum of the internal OSPF cost and the external route cost
  • type2 - ospf metric is equal only to the external route cost.


Status

Command /routing ospf monitor will display current OSPF status.
For multi instance OSPF you have to use following command: /routing ospf instance print status

Available read only properties:

Property Description
state (down | running) shows if OSPF is running or not
effective-router-id (IP address) Router-ID chosen by OSPF.
dijkstras (integer) shows how many times Dijkstra's algorithm was executed (i.e. OSPF routes were recalculated)
db-exchanges (integer) number of OSPF database exchanges currently going on
external-imports (integer) how many external routes were imported into OSPF from this router


Area

Sub-menu: /routing ospf area


Description

OSPF allows collections of routers to be grouped together. Such a group is called an area. Each area runs a separate copy of the basic link-state routing algorithm. This means that each area has its own link-state database and corresponding shortest path tree.

The structure of an area is invisible from other areas. This isolation of knowledge makes the protocol more scalable if multiple areas are used; routing table calculation takes less CPU resources and routing traffic is reduced.

However, multi-area setups create additional complexity. It is not recommended separate areas with fewer than 50 routers. The maximum number of routers in one area is mostly dependent on CPU power you have for routing table calculation.


Properties

Property Description
area-id (IP address; Default: 0.0.0.0) OSPF area identifier. If the router has networks in more than one area, then an area with area-id=0.0.0.0 (the backbone) must always be present. The backbone always contains all area border routers. The backbone is responsible for distributing routing information between non-backbone areas. The backbone must be contiguous, i.e. there must be no disconnected segments. However, area border routers do not need to be physically connected to the backbone - connection to it may be simulated using a virtual link.
default-cost (integer; Default: 1) specifies the cost for the default route originated by this stub area ABR. Applicable only for stub areas on ABRs
inject-summary-lsas (yes | no; Default: yes) specifies whether to flood summary LSAs in this stub area. Applicable only for stub areas on ABRs
name (string; Default: ) the name of the area
translator-role (translate-always | translate-candidate | translate-never; Default: translate-candidate) Parameter indicates which ABR will be used as translator from type7 to type5. Applicable only if area type is NSSA
  • translate-always - router will be always used as translator
  • translate-never - router will never be used as translator
  • translate-candidate - ospf ellects one of candidate routers to be a translator
type (default | nssa | stub; Default: default) area type

Status

/routing ospf area print status will show additional read-only properties

Property Description
interfaces (integer;) count of interfaces assigned to this area
active-interfaces (integer;) count of interfaces in operating state assigned to this area
neighbors (integer;) count of OSPF neighbors in this area
adjacent-neighbors (integer;) count of adjacent OSPF neighbors in this area


Area Range

Sub-menu: /routing ospf area range


Description

Prefix ranges are used to aggregate routing information on area boundaries. By default, ABR creates a summary LSA for each route in specific area, and advertises it in adjacent areas.

Using ranges allows to create only one summary LSA for multiple routes and send only single advertisement into adjacent areas, or to suppress advertisements altogether.

If a range is configured with 'advertise' parameter, a single summary LSA is advertised for each range if there are any routes under the range is the specific area. Else ('advertise' parameter disabled) no summary LSAs are created and advertised outside area boundaries at all.


Properties

Property Description
advertise (yes | no; Default: yes) whether to create summary LSA and advertise it to adjacent areas
area (string; Default: ) the OSPF area associated with this range
cost (integer | default; Default: default) the cost of the summary LSA this range will create
default - use the largest cost of all routes used (i.e. routes that fall within this range)
range (IP prefix; Default: ) the network prefix of this range


Icon-note.png

Note: For an active range (i.e. one that has at least one OSPF route from the specified area falling under it), a route with type 'unreachable' is created and installed in the routing table.



Network

Sub-menu: /routing ospf network


To start the OSPF protocol, you have to define the networks on which OSPF will run and associated area for each of these networks


Property Description
area (string; Default: backbone) the OSPF area to be associated with the specified address range
network (IP prefix; Default: ) the network prefix associated with the area. OSPF will be enabled on all interfaces that has at least one address falling within this range. Note that the network prefix of the address is used for this check (i.e. not the local address). For point-to-point interfaces this means the address of the remote endpoint.


Interface

Sub-menu: /routing ospf interface


Property Description
authentication (none | simple | md5; Default: none) specifies authentication method for OSPF protocol messages.
  • none - do not use authentication
  • simple - plain text authentication
  • md5 - keyed Message Digest 5 authentication
authentication-key (string; Default: "") authentication key to be used for simple or MD5 authentication
authentication-key-id (integer; Default: 1) key id is used to calculate message digest (used only when MD5 authentication is enabled). Value should match on all OSPF routers from the same region.
cost (integer: 1..65535; Default: 1) interface cost expressed as link state metric
dead-interval (time; Default: 40s) specifies the interval after which a neighbor is declared as dead. This interval is advertised in hello packets. This value must be the same for all routers on a specific network, otherwise adjacency between them will not form
hello-interval (time; Default: 10s) the interval between hello packets that the router sends out this interface. The smaller this interval is, the faster topological changes will be detected, but more routing traffic will ensue. This value must be the same for all routers on a specific network, otherwise adjacency between them will not form
interface (string | all; Default: all) the interface name
  • all - for all interfaces without specific configuration
network-type (broadcast | nbma | point-to-point | ptmp; Default: broadcast) the OSPF network type on this interface. Note that if interface configuration does not exist, the default network type is 'point-to-point' on PtP interfaces, and 'broadcast' on all other interfaces.
  • broadcast - network type suitable for Ethernet and other multicast capable link layers. Elects designated router
  • nbma - Non-Broadcast Multiple Access. Protocol packets are sent to each neighbors unicast address. Requires manual configuration of neighbors. Elects designated router
  • point-to-point - suitable for networks that consists only of two nodes. Does not elect designed router
  • ptmp - Point-to-Multipoint. Easier to configure than NBMA because it requires no manual configuration of neighbor. Does not elect designed router. This is the most robust network type and as such suitable for wireless networks, if 'broadcast' mode does not works good enough for them
passive (yes | no; Default: no) if enabled, do not send or receive OSPF traffic on this interface
priority (integer: 0..255; Default: 1) router's priority. Used to determine the designated router in a broadcast network. The router with highest priority value takes precedence. Priority value 0 means the router is not eligible to become designated or backup designated router at all.
retransmit-interval (time; Default: 5s) time between retransmitting lost link state advertisements. When a router sends a link state advertisement (LSA) to its neighbor, it keeps the LSA until it receives back the acknowledgment. If it receives no acknowledgment in time, it will retransmit the LSA
transmit-delay (time; Default: 1s) link state transmit delay is the estimated time it takes to transmit a link state update packet on the interface


Status

/routing ospf interface print status will show additional information about used interfaces

Property Description
ip-address (IP address;) Ip address assigned to this interface
state (backup | designated-router | point-to-point | passive;) current interface state
instance (instance name;) OSPF instance that is using this interface
area (area name;) area to which interface is assigned
neighbors (integer;) count of OSPF neighbors found on this interface
adjacent-neighbors (integer;) count of OSPF neighbors found on this interface that have formed adjacencies
designated-router (IP address;) router-ID of elected designated router (DR)
backup-designated-router (IP address;) router-ID of elected backup designated router (BDR)

NBMA Neighbor

Sub-menu: /routing ospf nbma-neighbor


Manual configuration for non-broadcast multi-access neighbors. Required only if interfaces with 'network-type=nbma' are configured.


Property Description
address (IP address; Default: ) the unicast IP address of the neighbor
poll-interval (time; Default: 2m) how often to send hello messages to neighbors which are in "down" state (i.e. there is no traffic from them)
priority (integer: 0..255; Default: 0) assumed priority value of neighbors which are in "down" state


Virtual Link

Sub-menu: /routing ospf virtual-link

Description

As stated in OSPF RFC, the backbone area must be contiguous. However, it is possible to define areas in such a way that the backbone is no longer contiguous. In this case the system administrator must restore backbone connectivity by configuring virtual links. Virtual link can be configured between two routers through common area called transit area, one of them should have to be connected with backbone. Virtual links belong to the backbone. The protocol treats two routers joined by a virtual link as if they were connected by an unnumbered point-to-point network


Properties

Property Description
authentication (none | simple | md5; Default: none) specifies authentication method for OSPF protocol messages.
authentication-key (string; Default: "") authentication key to be used for simple or MD5 authentication
authentication-key-id (integer; Default: 1) key id used in MD5 authentication
neighbor-id (IP address; Default: 0.0.0.0) specifies router-id of the neighbour
transit-area (string; Default: (unknown)) a non-backbone area the two routers have in common


Icon-note.png

Note: Virtual link should be configured on both routers. Virtual links can not be established through stub areas.



LSA

Sub-menu: /routing ospf lsa


Read only properties:

Property Description
instance (string) Instance name where LSA is used.
area (string)
type (string)
id (IP address) LSA record ID
originator (IP address) LSA record originator
sequence-number (string) Number of times the LSA for a link has been updated.
age (integerr) How long ago (in seconds) the last update occurred
checksum (string) LSA checksum
options (string)
body (string)


Neighbor

Sub-menu: /routing ospf Neighbor


Read only properties:

Property Description
router-id (IP address) neighbor router's RouterID
address (IP address) IP address of neighbor router that is used to form OSPF connection
interface (string) interface that neighbor router is connected to
priority (integer) priority configured on neighbor
dr-address (IP address) IP address of Designated Router
backup-dr-address (IP address) IP address of Backup Designated Router
state (down | attempt | init | 2-way | ExStart | Exchange | Loading | full)
  • Down - No Hello packets has been received from neighbor.
  • Attempt - Applies only to NBMA clouds. State indicates that no recent information was received from neighbor.
  • Init - Hello packet received from the neighbor, but bidirectional communication is not established (Its own RouterID is not listed in Hello packet).
  • 2-way - This state indicates that bi-directional communication is established. DR and BDR election occur during this state, routers build adjacencies based on whether router is DR or BDR, link is point-to-point or a virtual link.
  • ExStart - Routers try to establish the initial sequence number that is used for the packets information exchange. Router with higher ID becomes the master and starts the exchange.
  • Exchange - Routers exchange database description (DD) packets.
  • Loading - In this state actual link state information is exchanged. Link State Request packets are sent to neighbors to request any new LSAs that were found during Exchange state.
  • Full - Adjacency is complete, neighbor routers are fully adjacent. LSA information is synchronized between adjacent routers. Routers achieve the full state with their DR and BDR only, exception is P2P links.
state-changes (integer) Total count of OSPF state changes since neighbor identification
ls-retransmits (integer)
ls-requests (integer)
db-summaries (integer)
adjacency (time) Elapsed time since adjacency was formed

OSPF Router

Sub-menu: /routing ospf ospf-router


List of all area border routers (ABRs).

Read only properties:

Property Description
area (string)
router-id (IP address)
state (string)
gateway (IP address)
cost (integer)


Route

Sub-menu: /routing ospf route


Read only properties:

Property Description
instance (string) Which OSPF instance route belongs to
dst-address (IP prefix) Destination prefix
state (intra-area | inter-area | ext-1 | ext-2 | imported-ext-1 | imported-ext-2) State representing origin of the route
gateway (IP address) used gateway
interface (string) used interface
cost (integer) Cost of the route
area (external | backbone | <other area>) Which OSPF area this route belongs to


Sham link

Sub-menu: /routing ospf sham-link


Description

A sham-link is required between any two VPN sites that belong to the same OSPF area and share an OSPF backdoor link. If there is no intra-area link between the CE routers, you do not need to configure an OSPF sham link.

Sham link configuration example

Sham link must be configured on both sides.

For a sham link to be active, two conditions must be met:

  • src-address is a valid local address with /32 netmask in OSPF instance's routing table.
  • there is a valid route to dst-address in the OSPF instance's routing table.

When the sham link is active, hello packets are sent on it only until the neighbor reaches full state. After that, hello packet sending on the sham link is suppressed.

RouterOS does not support periodic LSA refresh suppression on sham-links yet.


Properties

Property Description
area (area name) name of area that shares an OSPF backdoor link
cost (integer: 1..65535 ) cost of the link
dst-address (IP address) loopback address of link's remote router
src-address (IP address) loopback address of link's local router



See More

[ Top | Back to Content ]