Reverse lookup of OSPF router IDs

If you store the reverse mapping for the routers’ loopback interfaces in DNS or configure the name-to-address mappings with the ip host commands, you can use the ip ospf name-lookup global configuration command to display the OSPF router IDs as router names.

For example, I’ve configured names of all provider routers’ loopback interfaces in one of my MPLS VPN labs:

P#show run | inc host
ip host PE-A 10.0.1.1
ip host PE-B 10.0.1.2
ip host PE-C 10.0.1.5
ip host P 10.0.1.6

After that, I’ve configured the ip ospf name-lookup command and the OSPF show commands started printing names instead of IP addresses:

P#show ip ospf database

            OSPF Router with ID (10.0.1.6) (Process ID 1)

                Router Link States (Area 0)

Link ID    ADV Router   Age   Seq#       Checksum Link count
10.0.1.1   PE-A         56    0x80000002 0x000C1F 3
10.0.1.2   PE-B         57    0x80000002 0x003FD8 3
10.0.1.5   PE-C         59    0x80000002 0x0027CF 3
10.0.1.6   P            53    0x80000003 0x00B675 7

Unfortunately, this functionality does not implement its full potential. For example, when examining router link states, the router ID is displayed as name, but the adjacent router IDs are not. Too bad, you still have to know the router IDs by heart .

P#show ip ospf database router 10.0.1.6

            OSPF Router with ID (10.0.1.6) (Process ID 1)

                Router Link States (Area 0)

  LS Type: Router Links
  Link State ID: 10.0.1.6
  Advertising Router: P
  LS Seq Number: 80000003

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 10.0.1.5
     (Link Data) Router Interface address: 10.0.7.30
      Number of MTID metrics: 0
       TOS 0 Metrics: 64

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 10.0.1.2
     (Link Data) Router Interface address: 10.0.7.18
      Number of MTID metrics: 0
       TOS 0 Metrics: 64

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 10.0.1.1
     (Link Data) Router Interface address: 10.0.7.10
      Number of MTID metrics: 0
       TOS 0 Metrics: 64 

2 comments:

  1. Could be interesting to have a feature request for this. It should not be a big deal to modify the source code to get adj RID names.
    Do you see a technical reason why it has not be not already implemented ?

    ReplyDelete
  2. I don't see a good technical reason. If you inspect OSPF database, you have to do reverse lookup on all router IDs anyway. Probably someone forgot to change all the instances of router ID printout in the code.

    ReplyDelete

You don't have to log in to post a comment, but please do provide your real name/URL. Anonymous comments might get deleted.

Ivan Pepelnjak, CCIE#1354, is the chief technology advisor for NIL Data Communications. He has been designing and implementing large-scale data communications networks as well as teaching and writing books about advanced technologies since 1990. See his full profile, contact him or follow @ioshints on Twitter.