08-27-2025 03:03 AM
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:
How can the line "! TEST" be removed?
Which command can be used to insert a similar comment?
Thanks!
Solved! Go to Solution.
08-27-2025 10:35 AM - edited 08-27-2025 10:37 AM
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.
08-27-2025 03:06 AM
No ! TEST <<- ! Sometimes meaning description
MHM
08-27-2025 10:35 AM - edited 08-27-2025 10:37 AM
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.
08-28-2025 02:53 AM
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
08-28-2025 02:59 AM
Any statements after ! Is show in run config
Sometimes we use it to add some description
MHM
08-28-2025 05:02 AM
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
08-28-2025 05:18 AM
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
08-28-2025 06:14 AM
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
!
!
!
08-29-2025 01:49 AM
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.
08-29-2025 02:04 AM
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
08-29-2025 07:13 AM - edited 08-29-2025 07:51 AM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide