Cisco IOS XR OSPF Configuration Examples (ASR 9000) - 夜莺博客

Cisco IOS XR OSPF Configuration Examples (ASR 9000)

OSPF configuration on Cisco IOS XR looks familiar to IOS engineers but works differently underneath: configuration is hierarchical, areas must be created explicitly, interfaces are bound to an area from inside area configuration mode, and nothing takes effect until you commit. Using the official ASR 9000 IOS XR routing guide examples, this article shows the minimal OSPFv2 setup, authentication, multi-area design and the commit workflow.

Minimal OSPFv2 Configuration

RP/0/RSP0/CPU0:router# configure
RP/0/RSP0/CPU0:router(config)# interface GigabitEthernet 0/3/0/0
RP/0/RSP0/CPU0:router(config-if)# ipv4 address 10.1.2.1 255.255.255.0
RP/0/RSP0/CPU0:router(config-if)# no shutdown
RP/0/RSP0/CPU0:router(config-if)# exit
RP/0/RSP0/CPU0:router(config)# router ospf 1
RP/0/RSP0/CPU0:router(config-ospf)# router-id 10.2.3.4
RP/0/RSP0/CPU0:router(config-ospf)# area 0
RP/0/RSP0/CPU0:router(config-ospf-ar)# interface GigabitEthernet 0/3/0/0
RP/0/RSP0/CPU0:router(config-ospf-ar-if)# exit
RP/0/RSP0/CPU0:router(config-ospf)# commit

Note two IOS XR quirks: area 0 must be configured explicitly (it is never implicit), and the interface is bound to the area by entering interface under the area - there is no network statement and no ip ospf keyword on the interface.

Interface Tuning Under the Area

OSPF interface parameters are configured hierarchically - area-level values are inherited by interfaces that do not override them:

RP/0/RSP0/CPU0:router(config)# router ospf 1
RP/0/RSP0/CPU0:router(config-ospf)# area 0
RP/0/RSP0/CPU0:router(config-ospf-ar)# interface GigabitEthernet 0/3/0/0
RP/0/RSP0/CPU0:router(config-ospf-ar-if)# cost 77
RP/0/RSP0/CPU0:router(config-ospf-ar-if)# hello-interval 10
RP/0/RSP0/CPU0:router(config-ospf-ar-if)# authentication message-digest
RP/0/RSP0/CPU0:router(config-ospf-ar-if)# message-digest-key 1 md5 0 test
RP/0/RSP0/CPU0:router(config-ospf-ar-if)# commit

Multi-Area Example

RP/0/RSP0/CPU0:router(config)# router ospf 1
RP/0/RSP0/CPU0:router(config-ospf)# router-id 10.2.3.4
RP/0/RSP0/CPU0:router(config-ospf)# area 0
RP/0/RSP0/CPU0:router(config-ospf-ar)# interface GigabitEthernet 0/3/0/0
RP/0/RSP0/CPU0:router(config-ospf-ar)# exit
RP/0/RSP0/CPU0:router(config-ospf)# area 1
RP/0/RSP0/CPU0:router(config-ospf-ar)# interface GigabitEthernet 0/3/0/1
RP/0/RSP0/CPU0:router(config-ospf-ar)# exit
RP/0/RSP0/CPU0:router(config-ospf)# commit

In IOS XR a single OSPF process can span multiple areas, and route summarization happens on the ABR with area <id> range. The process name can be a string up to 40 characters - engineers often name it after the role (for example router ospf core).

The Commit Workflow

IOS XR does not apply changes line by line: uncommitted changes sit in a candidate configuration. commit applies them, end prompts you to commit before exiting, and show configuration displays the pending diff. Verification uses classic commands:

RP/0/RSP0/CPU0:router# show ospf neighbor
RP/0/RSP0/CPU0:router# show ospf database
RP/0/RSP0/CPU0:router# show route ospf

Related Reading on This Site

Start with IOS XR CLI basics and command modes and see ASR9000 fabric troubleshooting for the hardware side.

原文链接:https://www.cisco.com/c/en/us/td/docs/routers/asr9000/software/710x/routing/configuration/guide/b-routing-cg-asr9000-710x/implementing-ospf.html