This article provides information on how to protect part of the configuration from being deleted when a delete command is used on the configuration.
Can I prevent some of the configuration from being deleted when the delete command is issued?
You can use the protect keyword to protect any part of the configuration. For example, to protect the default route from being accidentally deleted, which may lead to the networking being down, the following configuration can be used:
[edit] root@210-hm-4# show routing-options static { route 0.0.0.0/0 next-hop 4.2.2.2; route 192.168.1.1/32 next-hop 4.2.2.2; }
root@210-hm-4# protect routing-options static route 0/0
[edit] root@210-hm-4# show routing-options static { protect: route 0.0.0.0/0 next-hop 4.2.2.2; route 192.168.1.1/32 next-hop 4.2.2.2; }
[edit] root@210-hm-4# delete routing-options warning: [routing-options static route 0.0.0.0/0] is protected, 'routing-options static route 0.0.0.0/0' cannot be deleted [edit] root@210-hm-4# show routing-options static { protect: route 0.0.0.0/0 next-hop 4.2.2.2; }
root@210-LM2# set static route 0.0.0.0/0 next-hop 192.168.1.2warning: [routing-options static route 0.0.0.0/0] is protected,'routing-options static route 0.0.0.0/0 next-hop next-hop 192.168.1.2' cannot be createdroot@210-LM2# replace pattern 4.2.2.2 with 10.0.0.1warning: [routing-options static route 0.0.0.0/0] is protected,'routing-options static route 0.0.0.0/0 next-hop 192.168.1.1' cannot be renamed
[edit] root@210-hm-4# unprotect routing-options static route 0/0 [edit] root@210-hm-4# show routing-options static { route 0.0.0.0/0 next-hop 4.2.2.2; }
[edit] root@210-hm-4# delete routing-options [edit] root@210-hm-4# show routing-options [edit] root@210-hm-4#
2022-08-24: Article reviewed for accuracy. Article is valid and relevant. No changes required.2020-07-30: Article reviewed for accuracy. Reference link added.2017-12-17: Article reviewed for accuracy. Minor changes made, category list updated. Article is correct and complete.