RE: How to make a Network Not in Route Table Command Script.

From: Michael Snyder (msnyder@revolutioncomputer.com)
Date: Thu Nov 27 2003 - 17:59:45 GMT-3


Some small corrections.

It seems the extended ping commands I was looking for was count 1 and
timeout 1. Not sure where I got delay and repeat.

Also I did find a parser cache command, but it didn't help with my ping
scripts. Not sure way the cli parser drops commands after it starts the
first few pings, you would think it would buffer each command and exec
in turn.

-----Original Message-----
From: Michael Snyder [mailto:msnyder@wk.net]
Sent: Thursday, November 27, 2003 1:51 PM
To: ccielab@groupstudy.com
Subject: How to make a Network Not in Route Table Command Script.

I was working on a lab this morning, and for some reason my three way
redistribution wasn't working.

After jumping router to router for 30 minutes, I thought gee I wish I
had a command to show me every missing route.

So I wrote one. It's a variation of a ping script.

I'll walk you thru how I composed the script. It took me about 5
minutes.

------------------------------------------------------------------------

--

First I did a `show run | i ip address`

And pasted the results to notepad from every router.

------------------------------------------------------------------------ --

ip address 170.1.1.1 255.255.255.255 ip address 150.50.200.1 255.255.255.0 ip address 170.1.150.1 255.255.255.0

ip address 170.1.2.2 255.255.255.255 ip address 172.16.1.1 255.255.255.0 ip address 172.16.3.1 255.255.255.0 ip address 172.16.2.1 255.255.255.0 ip address 172.16.0.1 255.255.255.0 no ip address no ip address ip address 170.1.100.2 255.255.255.0 ip address 170.1.150.2 255.255.255.0 ip address 150.50.9.5 255.255.255.252

ip address 170.1.4.4 255.255.255.255 ip address 192.168.10.1 255.255.255.0 no ip address ip address 170.1.100.4 255.255.255.0 no ip address

ip address 170.1.5.5 255.255.255.255 ip address 170.1.200.5 255.255.255.224 no ip address ip address 170.1.100.5 255.255.255.0 no ip address no ip address

ip address 170.1.6.6 255.255.255.255 ip address 170.1.200.6 255.255.255.224 no ip address ip address 170.1.100.6 255.255.255.0 ip address 170.1.32.6 255.255.255.0 no ip address

ip address 170.1.7.7 255.255.255.255 ip address 170.1.200.7 255.255.255.224 ip address 170.1.24.7 255.255.255.0

ip address 170.1.8.8 255.255.255.255 ip address 150.50.4.8 255.255.255.0 ip address 170.1.24.8 255.255.255.0

ip address 170.1.9.9 255.255.255.255 ip address 170.1.32.9 255.255.255.0 no ip address ip address 170.1.15.9 255.255.255.192

------------------------------------------------------------------------ --

Next in notepad, I did a replace all of `no ip address` with a null string. Then I went thru the listing deleting the empty lines.

------------------------------------------------------------------------ --

ip address 170.1.1.1 255.255.255.255 ip address 150.50.200.1 255.255.255.0 ip address 170.1.150.1 255.255.255.0 ip address 170.1.2.2 255.255.255.255 ip address 172.16.1.1 255.255.255.0 ip address 172.16.3.1 255.255.255.0 ip address 172.16.2.1 255.255.255.0 ip address 172.16.0.1 255.255.255.0 ip address 170.1.100.2 255.255.255.0 ip address 170.1.150.2 255.255.255.0 ip address 150.50.9.5 255.255.255.252 ip address 170.1.4.4 255.255.255.255 ip address 192.168.10.1 255.255.255.0 ip address 170.1.100.4 255.255.255.0 ip address 170.1.5.5 255.255.255.255 ip address 170.1.200.5 255.255.255.224 ip address 170.1.100.5 255.255.255.0 ip address 170.1.6.6 255.255.255.255 ip address 170.1.200.6 255.255.255.224 ip address 170.1.100.6 255.255.255.0 ip address 170.1.32.6 255.255.255.0 ip address 170.1.7.7 255.255.255.255 ip address 170.1.200.7 255.255.255.224 ip address 170.1.24.7 255.255.255.0 ip address 170.1.8.8 255.255.255.255 ip address 150.50.4.8 255.255.255.0 ip address 170.1.24.8 255.255.255.0 ip address 170.1.9.9 255.255.255.255 ip address 170.1.32.9 255.255.255.0 ip address 170.1.15.9 255.255.255.192

------------------------------------------------------------------------ --

This lab uses a summary address of 172.16.0.0/22, so I chose to pull out the 172.16.1.1/24 routes and use the summary instead.

Here's a important part, I needed a unique post-delimiter on the ends of the statements for text search and replace later. So I appended the ` char to the ends of the statements by hand. Each statement begins the same `ip address` text, so I don't need a pre-delimiter here.

------------------------------------------------------------------------ --

ip address 170.1.1.1 255.255.255.255 ` ip address 150.50.200.1 255.255.255.0 ` ip address 170.1.150.1 255.255.255.0 ` ip address 170.1.2.2 255.255.255.255 ` ip address 172.16.0.0 255.255.252.0 ` ip address 170.1.100.2 255.255.255.0 ` ip address 170.1.150.2 255.255.255.0 ` ip address 150.50.9.5 255.255.255.252 ` ip address 170.1.4.4 255.255.255.255 ` ip address 192.168.10.1 255.255.255.0 ` ip address 170.1.100.4 255.255.255.0 ` ip address 170.1.5.5 255.255.255.255 ` ip address 170.1.200.5 255.255.255.224 ` ip address 170.1.100.5 255.255.255.0 ` ip address 170.1.6.6 255.255.255.255 ` ip address 170.1.200.6 255.255.255.224 ` ip address 170.1.100.6 255.255.255.0 ` ip address 170.1.32.6 255.255.255.0 ` ip address 170.1.7.7 255.255.255.255 ` ip address 170.1.200.7 255.255.255.224 ` ip address 170.1.24.7 255.255.255.0 ` ip address 170.1.8.8 255.255.255.255 ` ip address 150.50.4.8 255.255.255.0 ` ip address 170.1.24.8 255.255.255.0 ` ip address 170.1.9.9 255.255.255.255 ` ip address 170.1.32.9 255.255.255.0 ` ip address 170.1.15.9 255.255.255.192 `

------------------------------------------------------------------------ --

Here's the payoff. Using notepad, replace all `ip address` with `show ip route` Also replace our delimiting char ` with `| i not`

------------------------------------------------------------------------ --

show ip route 170.1.1.1 255.255.255.255 | i not show ip route 150.50.200.1 255.255.255.0 | i not show ip route 170.1.150.1 255.255.255.0 | i not show ip route 170.1.2.2 255.255.255.255 | i not show ip route 172.16.0.0 255.255.252.0 | i not show ip route 170.1.100.2 255.255.255.0 | i not show ip route 170.1.150.2 255.255.255.0 | i not show ip route 150.50.9.5 255.255.255.252 | i not show ip route 170.1.4.4 255.255.255.255 | i not show ip route 192.168.10.1 255.255.255.0 | i not show ip route 170.1.100.4 255.255.255.0 | i not show ip route 170.1.5.5 255.255.255.255 | i not show ip route 170.1.200.5 255.255.255.224 | i not show ip route 170.1.100.5 255.255.255.0 | i not show ip route 170.1.6.6 255.255.255.255 | i not show ip route 170.1.200.6 255.255.255.224 | i not show ip route 170.1.100.6 255.255.255.0 | i not show ip route 170.1.32.6 255.255.255.0 | i not show ip route 170.1.7.7 255.255.255.255 | i not show ip route 170.1.200.7 255.255.255.224 | i not show ip route 170.1.24.7 255.255.255.0 | i not show ip route 170.1.8.8 255.255.255.255 | i not show ip route 150.50.4.8 255.255.255.0 | i not show ip route 170.1.24.8 255.255.255.0 | i not show ip route 170.1.9.9 255.255.255.255 | i not show ip route 170.1.32.9 255.255.255.0 | i not show ip route 170.1.15.9 255.255.255.192 | i not

------------------------------------------------------------------------ --

Ok, lets try it on R4

------------------------------------------------------------------------ --

R4# R4# R4# show ip route 170.1.1.1 255.255.255.255 | i not R4# show ip route 150.50.200.1 255.255.255.0 | i not % Network not in table R4# show ip route 170.1.150.1 255.255.255.0 | i not R4# show ip route 170.1.2.2 255.255.255.255 | i not R4# show ip route 172.16.0.0 255.255.252.0 | i not R4# show ip route 170.1.100.2 255.255.255.0 | i not R4# show ip route 170.1.150.2 255.255.255.0 | i not R4# show ip route 150.50.9.5 255.255.255.252 | i not % Network not in table R4# show ip route 170.1.4.4 255.255.255.255 | i not R4# show ip route 192.168.10.1 255.255.255.0 | i not R4# show ip route 170.1.100.4 255.255.255.0 | i not R4# show ip route 170.1.5.5 255.255.255.255 | i not R4# show ip route 170.1.200.5 255.255.255.224 | i not % Subnet not in table R4# show ip route 170.1.100.5 255.255.255.0 | i not R4# show ip route 170.1.6.6 255.255.255.255 | i not R4# show ip route 170.1.200.6 255.255.255.224 | i not % Subnet not in table R4# show ip route 170.1.100.6 255.255.255.0 | i not R4# show ip route 170.1.32.6 255.255.255.0 | i not R4# show ip route 170.1.7.7 255.255.255.255 | i not % Subnet not in table R4# show ip route 170.1.200.7 255.255.255.224 | i not % Subnet not in table R4# show ip route 170.1.24.7 255.255.255.0 | i not % Subnet not in table R4# show ip route 170.1.8.8 255.255.255.255 | i not % Subnet not in table R4# show ip route 150.50.4.8 255.255.255.0 | i not % Network not in table R4# show ip route 170.1.24.8 255.255.255.0 | i not % Subnet not in table R4# show ip route 170.1.9.9 255.255.255.255 | i not R4# show ip route 170.1.32.9 255.255.255.0 | i not R4# show ip route 170.1.15.9 255.255.255.192 | i not R4#

------------------------------------------------------------------------ --

There's my missing routes!!! For some reason rip isn't making it to ospf on R4.

How would I use this in the lab? I would make this table early on, and update it throughout lab. Every lab is only going to have about 40 routes or less, so the overhead of keeping a universal route script is acceptable, even you did it by hand without using notepad search and replace features.

BTW once you have it, you can customize it at will. Lets see all the tags.

Replace all `| i not` with `| i Tag`

------------------------------------------------------------------------ --

R4# R4# show ip route 170.1.1.1 255.255.255.255 | i Tag R4# show ip route 150.50.200.1 255.255.255.0 | i Tag R4# show ip route 170.1.150.1 255.255.255.0 | i Tag R4# show ip route 170.1.2.2 255.255.255.255 | i Tag R4# show ip route 172.16.0.0 255.255.252.0 | i Tag R4# show ip route 170.1.100.2 255.255.255.0 | i Tag R4# show ip route 170.1.150.2 255.255.255.0 | i Tag R4# show ip route 150.50.9.5 255.255.255.252 | i Tag R4# show ip route 170.1.4.4 255.255.255.255 | i Tag R4# show ip route 192.168.10.1 255.255.255.0 | i Tag R4# show ip route 170.1.100.4 255.255.255.0 | i Tag R4# show ip route 170.1.5.5 255.255.255.255 | i Tag R4# show ip route 170.1.200.5 255.255.255.224 | i Tag R4# show ip route 170.1.100.5 255.255.255.0 | i Tag R4# show ip route 170.1.6.6 255.255.255.255 | i Tag R4# show ip route 170.1.200.6 255.255.255.224 | i Tag R4# show ip route 170.1.100.6 255.255.255.0 | i Tag R4# show ip route 170.1.32.6 255.255.255.0 | i Tag Tag 222, type extern 1 R4# show ip route 170.1.7.7 255.255.255.255 | i Tag R4# show ip route 170.1.200.7 255.255.255.224 | i Tag R4# show ip route 170.1.24.7 255.255.255.0 | i Tag R4# show ip route 170.1.8.8 255.255.255.255 | i Tag R4# show ip route 150.50.4.8 255.255.255.0 | i Tag R4# show ip route 170.1.24.8 255.255.255.0 | i Tag R4# show ip route 170.1.9.9 255.255.255.255 | i Tag Tag 222, type extern 1 R4# show ip route 170.1.32.9 255.255.255.0 | i Tag Tag 222, type extern 1 R4# show ip route 170.1.15.9 255.255.255.192 | i Tag Tag 222, type extern 1 R4# R4#

------------------------------------------------------------------------ --

Let's make a ping script out of it. I never had much luck with ping scripts because of terminal timing is locked down in the lab. But on the other hand, later releases of 12.2 support extended ping commands such as `repeat 1` and `delay 1`

First thing replace `show ip route` with `ping`. Next thing replace `| i not` with delay 1 repeat 1

The mask information is awkward but we're only talking about 40 lines max. So even by hand it is doable.

Here lets replace 255.255.255 with a null string, then clean up by hand.

------------------------------------------------------------------------ --

ping 170.1.1.1 repeat 1 delay 1 ping 150.50.200.1 repeat 1 delay 1 ping 170.1.150.1 repeat 1 delay 1 ping 170.1.2.2 repeat 1 delay 1 ping 172.16.0.0 repeat 1 delay 1 ping 170.1.100.2 repeat 1 delay 1 ping 170.1.150.2 repeat 1 delay 1 ping 150.50.9.5 repeat 1 delay 1 ping 170.1.4.4 repeat 1 delay 1 ping 192.168.10.1 repeat 1 delay 1 ping 170.1.100.4 repeat 1 delay 1 ping 170.1.5.5 repeat 1 delay 1 ping 170.1.200.5 repeat 1 delay 1 ping 170.1.100.5 repeat 1 delay 1 ping 170.1.6.6 repeat 1 delay 1 ping 170.1.200.6 repeat 1 delay 1 ping 170.1.100.6 repeat 1 delay 1 ping 170.1.32.6 repeat 1 delay 1 ping 170.1.7.7 repeat 1 delay 1 ping 170.1.200.7 repeat 1 delay 1 ping 170.1.24.7 repeat 1 delay 1 ping 170.1.8.8 repeat 1 delay 1 ping 150.50.4.8 repeat 1 delay 1 ping 170.1.24.8 repeat 1 delay 1 ping 170.1.9.9 repeat 1 delay 1 ping 170.1.32.9 repeat 1 delay 1 ping 170.1.15.9 repeat 1 delay 1

------------------------------------------------------------------------ --

While these techniques are not a magic bullet, it does help. Knowing what a routing table should look like per router and using scripts to verify this could really help. It allows you to focus on the missing routes instead of wasting time looking at what you already have.

The other command I use for grading my labs is `show ip route summary`, to check the total number of subnets on each router.

------------------------------------------------------------------------ --

Michael Snyder Lead Network Engineer CCDP, CSSP, MCSE Revolution Computer Systems (270) 443-7400

The ping script brings up a question, I've seen console paser commands for routers and I also know the router to router telnet also has a incoming buffer. Anyone know of a way to increase the router paser buffer? I would love to stuff a whole ping script into the paser command buffer before it begins to exec. Just an idea to get pass the timing settings of terminal program(s). I've seen that the new ios has a real scripting commands, but don't have access to practice it. The old style console ping scripts would be fine for me if I could get it to work on a constant basis.



This archive was generated by hypermail 2.1.4 : Fri Dec 12 2003 - 12:29:18 GMT-3