This post describes how to use EEM to monitor BGP changes and trigger automatic configurations to remediate failures.
Cisco IOS Embedded Event Manager (EEM) is a powerful and flexible subsystem that provides real-time network event detection and on-board automation. It supports more than 20 event detectors that are highly integrated with different IOS software components to trigger actions in response to network events creating policies aligned with the business logic
With EEM + HSRP running between two edge routers, network engineers can provide redundancy in case of any the following happens:
- Router failure.
- BGP peering failure / external interface failure.
- Internal interface failure.
- Default-route not received from the ISP
Key concepts:
- Two VLANs allow the Internet traffic segregation using different edge routers. Each router is the HSRP active router for a VLAN while the peer is the standby:
- Monitoring the BGP session using EEM is key for detecting changes on real time.
- For detecting default routes missing from the routing table, it’s as easy as leveraging on tracking objects checking the routing table.
- When any of the previous situations happen, the internal interfaces are automatically disabled, hence the outgoing traffic is forwarded throught the peer router.
- Once the BGP session is restored or the default route is back in the RIB, the internal interfaces are enabled again.
RTR-EDGE1 track timer ip route 5 track 1 ip route 0.0.0.0 0.0.0.0 reachability delay down 2 up 2 event track 1 state down event track 1 state up event manager applet ISP1_UP event syslog pattern "%BGP-5-ADJCHANGE: neighbor 10.0.0.1 Up" action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "interface gi0/1" action 4.0 cli command "no shutdown" action 5.0 cli command "end" event manager applet ISP1_Down event syslog pattern "%BGP-5-ADJCHANGE: neighbor 10.0.0.1 Down" action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "interface gi0/1" action 4.0 cli command "shutdown" action 5.0 cli command "end" event manager applet default-route-lost event track 1 state down action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "interface GigabitEthernet0/1" action 4.0 cli command "shutdown" action 5.0 cli command "end" event manager applet default-route-recovery event track 1 state up action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "interface GigabitEthernet0/1" action 4.0 cli command "no shutdown" action 5.0 cli command "end" RTR-EDGE2 track timer ip route 5 track 1 ip route 0.0.0.0 0.0.0.0 reachability delay down 2 up 2 event track 1 state down event track 1 state up event manager applet ISP2_Down event syslog pattern "%BGP-5-ADJCHANGE: neighbor 10.0.1.1 Down" action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "interface gi0/1" action 4.0 cli command "shutdown" action 5.0 cli command "end" event manager applet ISP2_UP event syslog pattern "%BGP-5-ADJCHANGE: neighbor 10.0.1.1 Up" action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "interface gi0/1" action 4.0 cli command "no shutdown" action 5.0 cli command "end" event manager applet default-route-lost event track 1 state down action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "interface GigabitEthernet0/1" action 4.0 cli command "shutdown" action 5.0 cli command "end" event manager applet default-route-recovery event track 1 state up action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "interface GigabitEthernet0/1" action 4.0 cli command "no shutdown" action 5.0 cli command "end"
No Comments