09-30-2020 09:55 PM
Hello,
I have CISCO1941/K9 routers which are running version Version 15.7(3)M6 & only have a 4g cellular interface as a WAN link. The signal or link drops ever so often & doesn't connect unless a shut/no shut is done on the cell interface. When it drops the interface shows up/up but loses it's IP address so I have created the following EEM script. The issue I have found is that when it does lose the IP address it kicks in but doesn't seem to actually shut/ no shut the interface, it only comes good when we manually do this.
+++++++++++++++++
event manager applet Cell_IP_CHECK authorization bypass
event timer cron name Cell_IP_CHECK cron-entry "*/6 * * * *"
action 1.0 cli command "enable"
action 2.0 cli command "show interface Cellular0/0/0 | inc address"
action 2.1 string match "*Internet address is 10.0.*" "$_cli_result"
action 3.0 if $_string_result eq "1" goto 5.0
action 4.0 cli command "enable"
action 4.1 cli command "configure terminal"
action 4.2 cli command "int Cellular0/0/0"
action 4.3 cli command "shut"
action 4.4 wait 1
action 4.5 cli command "no shut"
action 4.6 cli command "end"
action 5.0 cli command "exit"
!
end
++++++++++++++++++++++++
Here's the log output when when cell was down, it seemed to go into config t mode but only came up in the end when we consoled in & did the shut/ no shut.
Appreciate any feedback on the script
*Sep 29 09:12:01.125 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 09:18:01.125 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 09:24:01.125 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 09:30:01.125 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 09:36:01.125 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 09:42:01.125 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 09:48:01.125 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 09:54:01.125 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 10:00:01.125 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 10:06:01.125 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 10:12:01.125 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 10:18:01.125 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 10:24:01.129 EST: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:Cell_IP_CHECK)
*Sep 29 10:25:08.621 EST: %LINK-5-CHANGED: Interface Cellular0/0/0, changed state to administratively down
*Sep 29 10:25:48.641 EST: %LINK-3-UPDOWN: Interface Cellular0/0/0, changed state to down
*Sep 29 10:26:04.161 EST: %SYS-5-CONFIG_I: Configured from console by User0 on console
*Sep 29 10:26:08.665 EST: %CELLWAN-2-BEARER_UP: Instance id=0, Default bearer (bearer_id=5) in Cellular0/0/0 is now UP
*Sep 29 10:26:10.769 EST: %LINK-3-UPDOWN: Interface Cellular0/0/0, changed state to up
*Sep 29 10:26:11.769 EST: %LINEPROTO-5-UPDOWN: Line protocol on Interface Cellular0/0/0, changed state to up
*Sep 29 10:26:47.833 EST: %BGP-5-ADJCHANGE: neighbor 10.0.2.2 Up
09-30-2020 11:54 PM
Hello,
try and simplify the entire operation by using an IP SLA and an EEM script. This would look like below:
track 1 ip sla 1 reachability
!
ip route 8.8.8.8 255.255.255.255 Cellular0/0/0
!
ip sla 1
icmp-echo 8.8.8.8 source-interface Cellular0/0/0
threshold 1000
timeout 1000
frequency 1
!
ip sla schedule 1 life forever start-time now
!
event manager applet CELL_SHUT_NO_SHUT
event track 1 state down
action 1.0 cli command "enable"
action 2.0 cli command "conf t"
action 3.0 cli command "interface Cellular0/0/0"
action 4.0 cli command "shut"
action 5.0 cli command "no shut"
action 6.0 cli command "end"
10-01-2020 03:03 AM
Thanks Georg , However I found that the IP Base software does not support ip sla feature.
It needs the Security or Data License to use this feature. So I'm stuck with the EEM feature.
10-01-2020 03:17 AM
Hello,
what is the actual log showing when the Cellular interface loses connectivity ?
10-01-2020 04:47 PM
Hi Georg , Unfortunately I can't see the actual log prior to this as it was rebooted, but basically the 4G tower disconnects from the device & the cellular interface loses it's IP address showing "Internet address will be negotiated using IPCP".
That's why I put in the EEM to 'shut/No shut' the cellular interface which it doesn't show "*Internet address is 10.0.*" Thxs
10-02-2020 02:05 AM
Hello,
you can use the below workaround and use EEM to send a ping every 10 seconds. If that ping fails, another EEM script runs and ecexutes a shut/no shut of the interface. You need to turn on icmp debugging for this to work. In order for the successful pings not cluttering your log and console, use a logging discriminator:
debug ip icmp
!
event manager applet PING
event timer countdown time 10 maxrun 31536000
action 1.0 cli command "enable"
action 2.0 cli command "ping 8.8.8.8 source Cellular 0/0/0"
action 3.0 cli command "end"
!
event manager applet PING
event syslog pattern "time exceeded rcvd"
action 1.0 cli command "enable"
action 2.0 cli command "interface Cellular 0/0/0"
action 3.0 cli command "shut"
action 4.0 cli command "no shut"
action 5.0 cli command "end"
!
logging discriminator ICMP msg-body drops echo reply rcvd
logging buffered discriminator ICMP
logging console discriminator ICMP
logging monitor discriminator ICMP
10-03-2020 11:01 AM
Change the string commands to regexp. Here is an example using a loopback interface.
event manager applet Cell_IP_CHECK authorization bypass
event none
action 1.0 cli command "enable"
action 2.0 cli command "show interface Loopback2 | inc address"
action 2.1 regexp "Internet address is ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)" "$_cli_result" match cellIp
action 3.0 if $_regexp_result eq "0"
action 3.1 syslog msg "No IP present on loopback2"
action 4.0 cli command "enable"
action 4.1 cli command "configure terminal"
action 4.2 cli command "int loopback2"
action 4.3 cli command "shut"
action 4.4 wait 1
action 4.5 cli command "no shut"
action 4.6 else
action 4.7 syslog msg "Loopback2 has IP $cellIp"
action 4.8 end
C1111#event manager run Cell_IP_CHECK
Oct 3 17:55:42.808: %HA_EM-6-LOG: Cell_IP_CHECK: No IP present on loopback2
C1111#
C1111#conf t
Enter configuration commands, one per line. End with CNTL/Z.
C1111(config)#int loopback2
C1111(config-if)#ip add 2.2.2.2 255.255.255.255
C1111(config-if)#end
C1111#event manager run Cell_IP_CHECK
C1111#
Oct 3 17:56:12.292: %HA_EM-6-LOG: Cell_IP_CHECK: Loopback2 has IP 2.2.2.2
C1111#
10-06-2020 04:15 PM
Thanks Daniel Frey, I'm hoping to get a test unit shortly so will give this a try also .. Cheers
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