cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
784
Views
0
Helpful
1
Replies

TCL script to enter some commands with Gig0/0 changes

dastrix80
Level 1
Level 1

Hi All

 

Took this sample from another user but its not working on my 3945

 

When my gig0/0 gets a new DHCP address, id like this commands entered (to fix NAT NVI issue)

 

 


scheduler allocate 20000 1000
event manager applet DHCP_ADDRESS_CHANGE
 event syslog pattern "GigabitEthernet0/0 assigned DHCP address"
 action 100 syslog msg "FIXING NVI NAT"
 action 125 cli command "enable"
 action 150 cli command "config t"
 action 200 cli command "ip nat source static tcp 192.168.0.141 80 interface GigabitEthernet0/0 6168"
 action 201 cli command "ip nat source static tcp 192.168.0.10 3389 interface GigabitEthernet0/0 6150"
 action 202 cli command "ip nat source static tcp 192.168.0.3 3001 interface GigabitEthernet0/0 3001"
 action 203 cli command "ip nat source static tcp 192.168.0.2 443 interface GigabitEthernet0/0 6164"
 action 204 cli command "ip nat source static tcp 192.168.0.4 3389 interface GigabitEthernet0/0 6169"
 action 205 cli command "ip nat source static tcp 192.168.0.3 3000 interface GigabitEthernet0/0 3000"
 action 206 cli command "ip nat source static tcp 192.168.0.3 22 interface GigabitEthernet0/0 6165"
 action 207 cli command "ip nat source static tcp 192.168.0.4 82 interface GigabitEthernet0/0 6166"
 action 208 cli command "ip nat source static tcp 192.168.0.3 8080 interface GigabitEthernet0/0 6170"
abitEthernet0/0 6170"

 

Doesnt appear to work :(

 

Any thoughts?

 

Thanks

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

Post the full syslog message when the interface gets a new DHCP lease.  Assuming your regex matches, it could also be that you have AAA command authorization configured, and EEM is being denied access to run the commands.  You can fix that by configuring "event manager session cli username USER" where USER is a user authorized to run all of those CLI commands; or by adding "auth bypass" to the end of the applet config statement.