cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1819
Views
5
Helpful
6
Replies

EEM execution failing due to CLI nat question

mmantilla2008
Level 1
Level 1

Hi Community,

I am trying to execute the following script by using EEM and it is failing due to the line 30 command requesting an answer. What do I need to do to either reply yes to the question or force the cli to continue without asking the question. The script stops everytime in line 30 due to the no ip nat statement requesting yes/no answer to remove the nat rule.

Kind regards

 

Here is the script:

event manager applet PRIMARY_WAN_DISABLE
  event track 1 state down
  action 0 cli command "enable"
  action 10 cli command "configure terminal"
  action 20 cli command "no ip route 0.0.0.0 0.0.0.0 189.208.32.1″
  action 25 cli command "ip route 0.0.0.0 0.0.0.0 Dialer1"
  action 30 cli command "no ip nat inside source list NAT interface FastEthernet1 overload″ --> After this line the scripts stops due to the yes/no question.
  action 32 cli command "no ip nat inside source static tcp 10.0.42.240 80 interface FastEthernet1 5631″
  action 35 cli command "ip nat inside source list NAT interface Dialer1 overload″
  action 38 cli command "ip nat inside source static tcp 10.0.42.240 80 interface Dialer1 5631″
  action 40 cli command "interface Tunnel1″
  action 45 cli command "tunnel source Dialer1"
  action 50 cli command "interface Tunnel2"
  action 55 cli command "tunnel source Dialer1"
  action 60 cli command "end"
  action 65 cli command "write"
  action 70 syslog msg "Traffic has been routed through SECONDARY_WAN"

 

 

 

 

6 Replies 6

Joe Clarke
Cisco Employee
Cisco Employee

Change the action to:

 

action 30 cli command "no ip nat inside source list NAT interface FastEthernet1 overload" pattern "yes"

action 31 cli command "yes"

 

This assumes the prompt contains the word "yes".  If not, just replace the pattern with a keyword in the prompt.

Hi Joseph Clarke.

I have try it but eem don't work.

 

What is the actual prompt you get when you type the command manually?

Hi Joseph Clarke.

I get "Static entry in use, do you want to delete child entries? [no]:"

Then change the action to:

action 30 cli command "no ip nat inside source list NAT interface FastEthernet1 overload" pattern "no"


 

Hi Joseph Clarke.

EEM work.

Thank you so much.

Review Cisco Networking for a $25 gift card