Press "Enter" to skip to content

How to clear all static NAT entries with just one command?

Last updated on January 8, 2021

        I am using cisco 2901 Router with IOS version 15M. In the configuration of the router I am using lots of static NAT entries. And I need to change these entries when it is requested.
And a possible solution for this situation are the configuration files that I saved to the flash0: of the cisco 2901 router. However, by using configuration files, I can't delete existing NAT entries. But on the other hand, I can create a static NAT entry using these configuration files. Therefore, I am looking for a command that will clear all the static NAT entries. Then I will create static NAT entries using these configuration files. Notes:
  • I tried the following commands to clear the NAT entries, but these all are for dynamic NAT entries. Thus, they did not work.
clear ip nat translation * clear ip nat translation forced do clear ip nat translation * do clear ip nat translation forced
  • A possible solution (although it takes too much time): First create a configuration file that does not have any static NAT entry: copy running-config flash0:config_0_entry

Then copy this configuration to the startup-config and reboot. (These two command will wipe out all the static entries.)
copy flash0:config_0_entry startup-config
reload 
Then after reboot, load your configuration file into the router:
copy flash0:your_config_file running_config
I could use this method, but the reboot takes too much time. I cannot wait that long.

Be First to Comment

Leave a Reply

How to clear all static NAT entries with just one command?

Last updated on January 8, 2021

        I am using cisco 2901 Router with IOS version 15M. In the configuration of the router I am using lots of static NAT entries. And I need to change these entries when it is requested.
And a possible solution for this situation are the configuration files that I saved to the flash0: of the cisco 2901 router. However, by using configuration files, I can't delete existing NAT entries. But on the other hand, I can create a static NAT entry using these configuration files. Therefore, I am looking for a command that will clear all the static NAT entries. Then I will create static NAT entries using these configuration files. Notes:
  • I tried the following commands to clear the NAT entries, but these all are for dynamic NAT entries. Thus, they did not work.
clear ip nat translation * clear ip nat translation forced do clear ip nat translation * do clear ip nat translation forced
  • A possible solution (although it takes too much time): First create a configuration file that does not have any static NAT entry: copy running-config flash0:config_0_entry

Then copy this configuration to the startup-config and reboot. (These two command will wipe out all the static entries.)
copy flash0:config_0_entry startup-config
reload 
Then after reboot, load your configuration file into the router:
copy flash0:your_config_file running_config
I could use this method, but the reboot takes too much time. I cannot wait that long.

Be First to Comment

Leave a Reply

%d bloggers like this: