Using EEM and IP sla add the network statement.

Q. R1-host is a server.I want to config R2 such that if icmp to R1-host not work it should stop advertising network 12.x.x.X/29 to nei. I tried using IP SLA but not working.

the solution is VERY easy, in this case I have configured an IP SLA to send ICMP echo messages to 12.1.1.1 and I am also tracking this process. Then I configured an EEM to say if that IP address is not reachable then remove the network statement from EIGRP, then I had to write another EEM to say if the IP address is reachable, add the network statement to the EIGRP. My topology is similar to yours but I used different IP addresses:

R1(S1/2) 12.1.1.1/24 —— 12.1.1.2/24 (S1/1) R2 (S1/3) 23.1.1.2/24 ——

23.1.1.3/24 (S1/2) R3 (S1/4) 34.1.1.3 —– 34.1.1.4/24 (S1/3) R4

On R1:

R1#sh run int s1/2 | B inter

interface Serial1/2

ip address 12.1.1.1 255.255.255.0

clock rate 64000

router eigrp 1

network 12.1.1.1 0.0.0.0

On R2:

R2#sh run int s1/1 | b inter

interface Serial1/1

ip address 12.1.1.2 255.255.255.0

R2#sh run int s1/3 | b inter

interface Serial1/3

ip address 23.1.1.2 255.255.255.0

clock rate 64000

router eigrp 1

network 12.1.1.2 0.0.0.0

network 23.1.1.2 0.0.0.0

On R3:

R3#sh run int s1/2 | b inter

interface Serial1/2

ip address 23.1.1.3 255.255.255.0

R3#sh run int s1/4 | b inter

interface Serial1/4

ip address 34.1.1.3 255.255.255.0

clock rate 64000

R3#sh run | s router eigrp

router eigrp 1

network 23.1.1.3 0.0.0.0

network 34.1.1.3 0.0.0.0

On R4:

R4#sh run int s1/3 | b inter

interface Serial1/3

ip address 34.1.1.4 255.255.255.0

R4#sh run | s router

router eigrp 1

network 34.1.1.4 0.0.0.0

To verify the configuration:

On R4:

R4#Show ip route eigrp | b Gate

Gateway of last resort is not set

12.0.0.0/24 is subnetted, 1 subnets

D       12.1.1.0 [90/21536000] via 34.1.1.3, 00:10:23, Serial1/3

23.0.0.0/24 is subnetted, 1 subnets

D       23.1.1.0 [90/21024000] via 34.1.1.3, 00:15:57, Serial1/3

NOW, let’s configure R2:

We are going to configure an IP SLA to send ICMP echoes to 12.1.1.1, and start the process:

ip sla 1

icmp-echo 12.1.1.1 source-interface Serial1/1

frequency 5

ip sla schedule 1 life forever start-time now

Next let’s track this process:

track 2 ip sla 1 reachability

NOW, let’s configure EEM to instruct the router to remove the network statement if 12.1.1.1 is NOT reachable:

event manager applet tst

event track 2 state down

action 1.1 cli command “en”

action 1.2 cli command “conf t”

action 1.3 cli command “router eigrp 1”

action 1.4 cli command “no netw 12.1.1.2 0.0.0.0”

We need to configure another EEM to instruct the router to add the network statement back when and if the 12.1.1.1 IP address is reachable:

event manager applet tst2

event track 2 state up

action 1.1 cli command “en”

action 1.2 cli command “conf t”

action 1.3 cli command “router eigrp 1”

action 1.4 cli command “netw 12.1.1.2 0.0.0.0”

Cool, let’s test. So far the 12.1.1.1 IP address is reachable so nothing should be done, let’s verify:

On R3:

R3#Show ip route eigrp | b Gate

Gateway of last resort is not set

12.0.0.0/24 is subnetted, 1 subnets

D       12.1.1.0 [90/21024000] via 23.1.1.2, 00:14:15, Serial1/2

Let’s shutdown the S1/2 interface of R1 and verify:

On R1:

R1(config)#int s1/2

R1(config-if)#Shut

To verify:

On R3:

R3#Show ip route eigrp | b Gate

Gateway of last resort is not set

R3#

As we can see the network is no longer advertised, to verify this further let’s go to R2 and check EIGRP’s configuration:

On R2:

R2#sh run | s router

router eigrp 1

network 23.1.1.2 0.0.0.0

Cool, now let’s No shut the S1/2 interface of R1:

On R1:

R1(config)#int s1/2

R1(config-if)#No shut

We can see that R2 has added the network statement back, to verify:

On R2:

R2#sh run | s router

router eigrp 1

network 12.1.1.2 0.0.0.0

network 23.1.1.2 0.0.0.0

As a result R3 should see the network:

On R3:

R3#Show ip route eigrp | b Gate

Gateway of last resort is not set

12.0.0.0/24 is subnetted, 1 subnets

D       12.1.1.0 [90/21024000] via 23.1.1.2, 00:00:49, Serial1/2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s