
[This message has also been posted.] Hi, At various times I have been involved in maintaining routers with lots of (sub)interfaces, and lots of static routes pointing down those subinterfaces. Unfortunately, a simple "show run" on a router produces a listing with all the static routes listed together, and all the subinterfaces listed separately. On a router with a lot of static routes and a lot of connected networks, this becomes a bit of a headache - you end up with static routes hanging around long after the subinterface has been removed, and spring cleaning usually results at least a couple of confused and unhappy users for whom inbound traffic is now spiralling off somewhere else. Even when this kind of configuration is made automatically (from a database which enforces referential integrity), the odd quick-fix static route added at some time might well hang around for years after it has stopped being useful. I have often wished that I could do a "show run" which would group IOS configuration by customer. Now I can! Hooray! Take an IOS configuration file (as tftp'd or rsh'd somewhere, or perhaps retrieved using ciscoconfd) and pass it through this awk script. The configuration will be re-sorted, so that: + most configuration comes first + (sub)interface configuration comes next, with corresponding static routes + all other static routes come next + "end" The static routes corresponding to a connected (sub)interface are hence shown grouped with that subinterface. All static routes that don't point at a connected network are listed separately right at the end, where they can be scruitinised and (if appropriate) removed. Example: The following stripped-down configuration: version 11.1 service timestamps log datetime localtime service password-encryption no service udp-small-servers no service tcp-small-servers ! hostname eg ! clock timezone NZST 12 clock summer-time NZDT recurring 1 Sun Oct 2:00 3 Sun Mar 2:00 enable secret 5 hohoho ! interface ATM5/0 mtu 1500 no ip address no ip route-cache optimum atm ilmi-keepalive 30 atm pvc 999 0 16 ilmi ! interface ATM5/0.2 point-to-point description customer1's network ip address 192.168.24.1 255.255.255.252 atm pvc 502 2 120 aal5snap inarp ! interface ATM5/0.3 point-to-point description customer2's network ip address 192.168.24.5 255.255.255.252 atm pvc 503 2 51 aal5snap inarp ! interface ATM5/0.4 point-to-point description customer3's network ip address 192.168.24.9 255.255.255.252 atm pvc 504 2 52 aal5snap inarp ! interface ATM5/0.5 point-to-point description customer4's network ip address 192.168.24.13 255.255.255.252 atm pvc 505 2 53 aal5snap inarp ! ip name-server 203.97.33.1 ip name-server 203.97.37.1 ip classless ip route 10.1.4.0 255.255.252.0 192.168.24.14 ip route 172.16.0.0 255.255.0.0 192.168.24.6 ip route 172.18.0.0 255.255.0.0 192.168.24.2 ip route 192.168.25.0 255.255.255.0 192.168.24.14 ip route 192.168.27.0 255.255.255.0 192.168.24.42 ! line con 0 exec-timeout 0 0 length 20 line aux 0 line vty 0 4 exec-timeout 0 0 password 7 humhumhum length 25 ! end When run through ios-lint.awk, we get: ! generated by cisco_lint.awk ! version 11.1 service timestamps log datetime localtime service password-encryption no service udp-small-servers no service tcp-small-servers ! hostname eg ! clock timezone NZST 12 clock summer-time NZDT recurring 1 Sun Oct 2:00 3 Sun Mar 2:00 enable secret 5 hohoho ! ip name-server 203.97.33.1 ip name-server 203.97.37.1 ip classless ! line con 0 exec-timeout 0 0 length 20 line aux 0 line vty 0 4 exec-timeout 0 0 password 7 humhumhum length 25 ! interface ATM5/0 mtu 1500 no ip address no ip route-cache optimum atm ilmi-keepalive 30 atm pvc 999 0 16 ilmi ! interface ATM5/0.2 point-to-point description customer1's network ip address 192.168.24.1 255.255.255.252 atm pvc 502 2 120 aal5snap inarp ! ip route 172.18.0.0 255.255.0.0 192.168.24.2 ! interface ATM5/0.3 point-to-point description customer2's network ip address 192.168.24.5 255.255.255.252 atm pvc 503 2 51 aal5snap inarp ! ip route 172.16.0.0 255.255.0.0 192.168.24.6 ! interface ATM5/0.4 point-to-point description customer3's network ip address 192.168.24.9 255.255.255.252 atm pvc 504 2 52 aal5snap inarp ! interface ATM5/0.5 point-to-point description customer4's network ip address 192.168.24.13 255.255.255.252 atm pvc 505 2 53 aal5snap inarp ! ip route 10.1.4.0 255.255.252.0 192.168.24.14 ip route 192.168.25.0 255.255.255.0 192.168.24.14 ! ! ! The following static routes do not point to a connected interface. ! Some of these might be worth looking at more closely :) ! ip route 192.168.27.0 255.255.255.0 192.168.24.42 ! end Much nicer :) Anyway, sorry about all the bandwidth - script is at: http://www.patho.gen.nz/pub/users/jabley/ios-lint.awk Feedback welcome. Share and enjoy. Joe -- Joe Abley <jabley(a)clear.co.nz> I am not speaking for CLEAR. In fact, Network Architect, CLEAR Net I'm not speaking at all. I'm typing. --------- To unsubscribe from nznog, send email to majordomo(a)list.waikato.ac.nz where the body of your message reads: unsubscribe nznog