Here is a EEM Scenario Question:
Provide a solution that provides failover capabilities from the primary link to the backup link and failback capabilities from the backup link to the primary link. You must send a syslog message stating "Failed over to the Backup Link" during failover and a syslog message "Failed Back to the Primary Link" when failing back.
Requirements:
- You cannot use IP SLA
- You cannot use dynamic routing on R1
- You cannot modify the current routing configuration on R2 and R4
- You cannot use static floating routes on R1
Configuration 
R1
__
interface FastEthernet0/0
 ip address 192.168.1.1 255.255.255.0
!
interface Serial1/0
 ip address 10.0.1.1 255.255.255.0
!
interface Serial1/1
 ip address 10.0.0.1 255.255.255.0
R2
__
interface FastEthernet0/0
 ip address 192.168.0.2 255.255.255.0
!
interface Serial1/0
 ip address 10.0.1.2 255.255.255.0
router rip
 version 2
 passive-interface default
 no passive-interface FastEthernet0/0
 network 10.0.0.0
 network 192.168.0.0
 no auto-summary
!
ip route 192.168.1.0 255.255.255.0 Serial1/0
R4
__
interface FastEthernet0/0
 ip address 192.168.0.4 255.255.255.0
!
interface Serial1/0
 ip address 10.0.0.4 255.255.255.0
!
router rip
 version 2
 passive-interface default
 no passive-interface FastEthernet0/0
 network 10.0.0.0
 network 192.168.0.0
 no auto-summary
!
ip route 192.168.1.0 255.255.255.0 Serial1/0
Give it a try --- Solution Below
############################
Solution
############################
There are many ways to tackle an issue and in this case I choose to leverage object tracking and EEM (Embedded Event Manager provides real-time network event detection and automation)
track 1 interface Serial1/0 line-protocol
ip route 0.0.0.0 0.0.0.0 Serial1/0
event manager applet Primary-Backup
 event syslog pattern "1 interface Se1/0 line-protocol Up->Down"
 action 1.0 cli command "enable"
 action 2.0 cli command "configure terminal"
 action 3.0 cli command "no ip route 0.0.0.0 0.0.0.0 serial 1/0"
 action 4.0 cli command "ip route 0.0.0.0 0.0.0.0 serial 1/1"
 action 50.0 cli command "end"
 action 99.0 syslog msg "Failed over to the Backup Link"
event manager applet Backup-Primary
 event syslog pattern "1 interface Se1/0 line-protocol Down->Up"
 action 1.0 cli command "enable"
 action 2.0 cli command "configure terminal"
 action 3.0 cli command "no ip route 0.0.0.0 0.0.0.0 serial 1/1"
 action 4.0 cli command "ip route 0.0.0.0 0.0.0.0 serial 1/0"
 action 50.0 cli command "end"
 action 99.0 syslog msg "Failed Back to the Primary Link"
###########################
Explanation
###########################
track 1 interface Serial1/0 line-protocol - (this tracks the line protocol of the interface, we could have used IP SLA but the requirements prohibited us from doing so)
ip route 0.0.0.0 0.0.0.0 Serial1/0 - (Default route using the primary link)
event manager applet Primary-Backup - (Name of the EEM Applet)
 event syslog pattern "1 interface Se1/0 line-protocol Up->Down" - (Syslog message generated from object tracking 1 configuration")
 action 1.0 cli command "enable" - (command to put the applet into enable mode)
 action 2.0 cli command "configure terminal" - (command to put the applet into global configuration mode)
 action 3.0 cli command "no ip route 0.0.0.0 0.0.0.0 serial 1/0" - (command to remove the default route pointing to the primary link)
 action 4.0 cli command "ip route 0.0.0.0 0.0.0.0 serial 1/1" - (command to add the default route pointing to the backup link)
 action 50.0 cli command "end"
 action 99.0 syslog msg "Failed over to Backup Link" - (Create syslog message based on the requirements)
event manager applet Backup-Primary - (Name of the EEM Applet)
 event syslog pattern "1 interface Se1/0 line-protocol Down->Up" - (Syslog message generated from object tracking 1 configuration")
 action 1.0 cli command "enable" - (command to put the applet into enable mode)
 action 2.0 cli command "configure terminal" - (command to put the applet into global configuration mode)
 action 3.0 cli command "no ip route 0.0.0.0 0.0.0.0 serial 1/1"   - (command to remove the default route pointing to the backup link)
 action 4.0 cli command "ip route 0.0.0.0 0.0.0.0 serial 1/0"  - (command to add the default route pointing to the primary link)
 action 50.0 cli command "end"
 action 99.0 syslog msg "Failed Back to the Primary Link" - (Create syslog message based on the requirements)
We run two types of integration tests before shipping a *netlab* release: 
*device* integration tests that check whether we correctly implemented 
*netlab*...
5 hours ago






0 comments:
Post a Comment