cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
330
Views
4
Helpful
10
Replies

Non-removable comment in IOS XR configuration

bassomarco1998
Level 1
Level 1

Hi guys,

For the past few days, I’ve been trying to solve the issue mentioned in the subject. On an ASR 9902 running IOS XR 7.11.21, I applied a configuration by copy/pasting from an old ASR9006. Among the commands, there was also a comment that I would now like to remove. This is the configuration:

 

!
router ospf 10
 router-id 2.2.2.2
log adjacency changes detail
 area 0
  interface GigabitEthernet0/0/0/0
   network point-to-point
   passive enable
   ! TEST
  !
 !
!

I have 2 questions that I haven’t been able to find an answer to:

  1. How can the line "! TEST" be removed?

  2. Which command can be used to insert a similar comment?

Thanks!

 

1 Accepted Solution

Accepted Solutions

Harold Ritter
Spotlight
Spotlight

Hi @bassomarco1998 ,

> Which command can be used to insert a similar comment?

You need to enter the comment and then the configuration line to which you want the comment to apply, for example:

 

RP/0/RP0/CPU0:R1(config)#! This is the core ospf process

RP/0/RP0/CPU0:R1(config)#router ospf 10

RP/0/RP0/CPU0:R1(config-ospf)#commit

Wed Aug 27 16:44:05.309 UTC

RP/0/RP0/CPU0:R1(config-ospf)#do sh runn router ospf

Wed Aug 27 16:44:16.561 UTC

! This is the core ospf process

router ospf 10

 log adjacency changes detail

 router-id 2.2.2.2

 area 0

  interface GigabitEthernet0/0/0/0

   network point-to-point

> How can the line "! TEST" be removed?

You need to enter the "clear comment" command and the the configuration line to which it is attached, for example:

 

RP/0/RP0/CPU0:PE1(config)#clear comment 

RP/0/RP0/CPU0:R1(config)#router ospf 10

RP/0/RP0/CPU0:R1(config-ospf)#commit

Wed Aug 27 16:46:39.472 UTC

RP/0/RP0/CPU0:R1(config-ospf)#do sh runn router ospf

Wed Aug 27 16:46:43.834 UTC

router ospf 10

 log adjacency changes detail

 router-id 2.2.2.2

 area 0

  interface GigabitEthernet0/0/0/0

   network point-to-point

   passive enable

As you can see, the comment always precedes the command it is attached to. In your specific configuration, the comment does not seem to be attached to any specific line. It might be a bug. A possible workaround would be to remove the entire ospf configuration, reapply it and commit. This is not ideal, but it will work. For instance in your case, you would do the following:

RP/0/RP0/CPU0:R1(config)#no router ospf 10

RP/0/RP0/CPU0:R1(config)#router ospf 10

RP/0/RP0/CPU0:R1(config-ospf)# router-id 2.2.2.2

RP/0/RP0/CPU0:R1(config-ospf)#log adjacency changes detail

RP/0/RP0/CPU0:R1(config-ospf)# area 0

RP/0/RP0/CPU0:R1(config-ospf-ar)#  interface GigabitEthernet0/0/0/0

RP/0/RP0/CPU0:R1(config-ospf-ar-if)#   network point-to-point

RP/0/RP0/CPU0:R1(config-ospf-ar-if)#   passive enable

RP/0/RP0/CPU0:R1(config-ospf-ar-if)#commit

 

This should not cause sessions to go down, reconvergence or anything like that as you replace the existing configuration with the existing config without the comment line.

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

View solution in original post

10 Replies 10

No ! TEST  <<- ! Sometimes meaning description 

MHM

Harold Ritter
Spotlight
Spotlight

Hi @bassomarco1998 ,

> Which command can be used to insert a similar comment?

You need to enter the comment and then the configuration line to which you want the comment to apply, for example:

 

RP/0/RP0/CPU0:R1(config)#! This is the core ospf process

RP/0/RP0/CPU0:R1(config)#router ospf 10

RP/0/RP0/CPU0:R1(config-ospf)#commit

Wed Aug 27 16:44:05.309 UTC

RP/0/RP0/CPU0:R1(config-ospf)#do sh runn router ospf

Wed Aug 27 16:44:16.561 UTC

! This is the core ospf process

router ospf 10

 log adjacency changes detail

 router-id 2.2.2.2

 area 0

  interface GigabitEthernet0/0/0/0

   network point-to-point

> How can the line "! TEST" be removed?

You need to enter the "clear comment" command and the the configuration line to which it is attached, for example:

 

RP/0/RP0/CPU0:PE1(config)#clear comment 

RP/0/RP0/CPU0:R1(config)#router ospf 10

RP/0/RP0/CPU0:R1(config-ospf)#commit

Wed Aug 27 16:46:39.472 UTC

RP/0/RP0/CPU0:R1(config-ospf)#do sh runn router ospf

Wed Aug 27 16:46:43.834 UTC

router ospf 10

 log adjacency changes detail

 router-id 2.2.2.2

 area 0

  interface GigabitEthernet0/0/0/0

   network point-to-point

   passive enable

As you can see, the comment always precedes the command it is attached to. In your specific configuration, the comment does not seem to be attached to any specific line. It might be a bug. A possible workaround would be to remove the entire ospf configuration, reapply it and commit. This is not ideal, but it will work. For instance in your case, you would do the following:

RP/0/RP0/CPU0:R1(config)#no router ospf 10

RP/0/RP0/CPU0:R1(config)#router ospf 10

RP/0/RP0/CPU0:R1(config-ospf)# router-id 2.2.2.2

RP/0/RP0/CPU0:R1(config-ospf)#log adjacency changes detail

RP/0/RP0/CPU0:R1(config-ospf)# area 0

RP/0/RP0/CPU0:R1(config-ospf-ar)#  interface GigabitEthernet0/0/0/0

RP/0/RP0/CPU0:R1(config-ospf-ar-if)#   network point-to-point

RP/0/RP0/CPU0:R1(config-ospf-ar-if)#   passive enable

RP/0/RP0/CPU0:R1(config-ospf-ar-if)#commit

 

This should not cause sessions to go down, reconvergence or anything like that as you replace the existing configuration with the existing config without the comment line.

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

Thank you so much, Harold!

One last thing, just to confirm, is it only possible to add a comment to a single command?
For example, after entering the following configuration, when running “show run router ospf” I won’t actually see the comment “! OSPF CONFIGURATION,” correct?

! OSPF CONIGURATION
router ospf 10
area 0
int lo0
passive enable
commi

 

Any statements after ! Is show in run config

Sometimes we use it to add some description 

MHM

I tried entering the commands below, but the comment does not appear in the running configuration. I assume that you can only associate a comment with a single command and then commit the configuration.

! OSPF CONIGURATION
router ospf 10
area 0
int lo0
passive enable
commi

RP/0/RP0/CPU0:XR# configure
RP/0/RP0/CPU0:XR(config)# comment === HELLO THIS IS MY NOTE ===
RP/0/RP0/CPU0:XR(config)# commit

!! === HELLO THIS IS MY NOTE === <<- this must be how it look when you do show run, you can see !! add 

You are very welcome @bassomarco1998 .

For example, after entering the following configuration, when running “show run router ospf” I won’t actually see the comment “!

I just tried this very same sequence and it worked.

 

RP/0/RP0/CPU0:R1(config)#! OSPF CONIGURATION

RP/0/RP0/CPU0:R1(config)#router ospf 10

RP/0/RP0/CPU0:R1(config-ospf)#area 0

RP/0/RP0/CPU0:R1(config-ospf-ar)#int lo0

RP/0/RP0/CPU0:R1(config-ospf-ar-if)#passive enable

RP/0/RP0/CPU0:R1(config-ospf-ar-if)#commi

Thu Aug 28 13:07:09.162 UTC

RP/0/RP0/CPU0:PE1(config-ospf-ar-if)#do sh runn router ospf

Thu Aug 28 13:07:16.961 UTC

! OSPF CONIGURATION

router ospf 10

 area 0

  interface Loopback0

   passive enable

  !

 !

!

 

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

Thank you, Harold, for the feedback!
I tried entering those commands on an ASR9006 running IOS XR release 6.7.3, but the comment did not appear in the "show run". Perhaps the behavior of comments depends on the software release.

Why you confuse 

In your post there are two cases 

1- add description under sub config mode' like ""! TEST"" which is add under sub config ospf mode

2- add in global mode here ypu need to use comment

MHM

Hi @bassomarco1998 ,

Yes, I definitely think it could be be related to the version you are running. In my case, I tested with 24.4.1.

Regards,
Harold Ritter, CCIE #4168 (EI, SP)