Continuing in to C# and Automation.

So still not had much time to be studying CCNP, but have been getting my hands dirty on C# around the automation of generating configuration for cisco devices.

As mentioned before part of my job is change management which means a lot of repetitive configurations. In the past the tools I have written in VB and Excel have been limited to a single master config, what I decided was needed was a tool that could take a generic config written in notepad or other simple text editor and present the variables to the end user in a friendly form, for them to complete and generate the config.

Confgen

Screen shot of early version of Confgen

This is currently has a simple template loaded for changing the vlan and description of a port and enabling / disabling it. But the application is flexible to be able to take any length or complexly of config you can enter.

There are still lots of things to tidy up,

currently only the first row of variables entered can be parsed in to a complete script, I also want to eventually use a word template to give a professional output for the final script. And have a menu driven system that will look for files in a specified folder at start up and load them ready to be picked by the end user.

However its a start and the core of the application is working. I would say itsĀ still very much a Beta version, but am hoping over the coming weeks and months to develop it in to a much more compete tool. A few bugs to resolve and functions to add but I hope it gives people an idea of what i am looking achieveive.

I also have a stage 2 idea to add to this that will make it even mousefulull for new deployments to build up complex configurations, as well as these simple snipits.

If any one wants to try it out the zip file is below, simple extract to a folder and run, file >> open. to open the included example. (you will need .net version 3.5 framwork installed to run it)

Confgen

Please play around and let me know what you think.

Edit: added page to site to keep track of this tool and its development, see above.

DevilWAH

A bit of perl while I’ve been away (Always including some CISCO of course).

Well no matter how many times I head back to post just lately I have never had the time. Studying been put on hold, house move on hold, and working falt out at the new job, but I have to say it has been fun.

Like I say not much studying done, but I have been playing with perl scripting latley. So rather than post nothing I thought I would share the results with you.

At work one of my teams jobs is to provision ports and reclaim ports on switchs. we basicaly write scritps during the day and then batch implement at night. So to make things a bit simpler, (and casue I was bored) I wrote a little web page using perl scripting as the back end.

Now I know I could use client side scripting to get a neater effect, and / or a stand alone program. But one thing about this was I wanted it as client friendly as possible, so decided to go for a web interface. And I have been meaning to learn a scripting language for ages so this seemed an good opportunity.

The web page is in two parts, one for provisioning ports and a second for reclaims, both can handle CATOS and IOS configs

They both still need some tidying up and I want to add some better functions to them soon, but Just so you don’t think i have disappeared here’s the link is you want to try them out. šŸ™‚ (they link to each other)

Port provisioning script

The reason it is set out as it is, is that for my job servers are duel link to two switch, so for each script we are provisioning 3 or 5 ports per server mostly. Also the second switch is normally a mirror of the first, so by ticking the copy check box you only then need to fill in the interface on the second switch, the vlan, speed, duplex,Ā ilo (integrate lights out for use when server crashes to remote reboot and get access to the bios) and sub-net information will be copied from the first switch. Port description as set to the name of the server configured.

I want to put some error checking in the webpage so users can’t skip filling in fields, and then expand to allow users to alter the number of switch / interfaces on the fly.

But for now it seems to work OK, and definitely speeds up or scripting tasks.

Let me know what you think šŸ™‚ If you have any suggestions or would like to see the source code let me know. If you wold likeĀ a bit more in depth of what I did may beĀ i can do aĀ follow up artical at some point.

Cheers

DEVILWAH.

PS. little baby is doing great. 9 months old and I finaly understand what people mean when the say how life changing having a baby is! Miss Lilith as she is know in our house is laughing smiling and generaly making my life great. Can’t wait for the warm weather to take her out more šŸ™‚

CCNP ROUTE (Part 8 EIGRP Simple Lab)

I decided that rather than just use other people labs I would come up with a few of my own, theĀ followingĀ lab is very simple, requiring the enabling of EIGRP on two routers so they form a neighbour relation ship, andĀ settingĀ up which routes will be advertised. Followed by some simpleĀ summarizationĀ to reduce the size of the routing tables.

You can find the GNS 3 topology files HERE, these also contain theĀ finalisedĀ configs if you want to see the method and commands used. (note you will need a 2691 image installed)

Fig 1

To start with we have two routers connected via a point to point link on interface Fastethernet 0/0. Each also has 10 loop back interfaces configured with various /24 networks configured.

The aim is simple, enable EIGRP with an AS number of 10, form a neighbour relationship between the two routers and update the routing tables so both routers can see / reach all configured networks. Ideal use as few networkĀ statementsĀ as possible, while remaining asĀ specificĀ as possible as to what networks get advertised. Autosmmorization should also be disabled.

After completing this, a #show ip route, should display something like this.

router1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

192.168.10.0/31 is subnetted, 1 subnets
C       192.168.10.0 is directly connected, FastEthernet0/0
172.16.0.0/24 is subnetted, 20 subnets
D       172.16.32.0 [90/409600] via 192.168.10.1, 00:01:01, FastEthernet0/0
D       172.16.33.0 [90/409600] via 192.168.10.1, 00:01:01, FastEthernet0/0
D       172.16.28.0 [90/409600] via 192.168.10.1, 00:01:01, FastEthernet0/0
D       172.16.29.0 [90/409600] via 192.168.10.1, 00:01:01, FastEthernet0/0
D       172.16.30.0 [90/409600] via 192.168.10.1, 00:01:01, FastEthernet0/0
D       172.16.31.0 [90/409600] via 192.168.10.1, 00:01:01, FastEthernet0/0
D       172.16.24.0 [90/409600] via 192.168.10.1, 00:01:01, FastEthernet0/0
D       172.16.25.0 [90/409600] via 192.168.10.1, 00:01:01, FastEthernet0/0
D       172.16.26.0 [90/409600] via 192.168.10.1, 00:01:01, FastEthernet0/0
D       172.16.27.0 [90/409600] via 192.168.10.1, 00:01:01, FastEthernet0/0
C       172.16.8.0 is directly connected, Loopback9
C       172.16.9.0 is directly connected, Loopback10
C       172.16.4.0 is directly connected, Loopback5
C       172.16.5.0 is directly connected, Loopback6
C       172.16.6.0 is directly connected, Loopback7
C       172.16.7.0 is directly connected, Loopback8
C       172.16.0.0 is directly connected, Loopback1
C       172.16.1.0 is directly connected, Loopback2
C       172.16.2.0 is directly connected, Loopback3
C       172.16.3.0 is directly connected, Loopback4

Now to reduce the size of the routing table we can manually summarise the routes. This is carried out under the interface that is sending out the update (in this case it will be fast ethernet 0/0 on each router). Again we want to be as specific as possible. The completed LAB uses multiply summarization statements , this increase the specificity of the summarization at the expense of adding an extra route in to the table. The routing table should now look something like.

router2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

 192.168.10.0/31 is subnetted, 1 subnets
C       192.168.10.0 is directly connected, FastEthernet0/0
172.16.0.0/16 is variably subnetted, 15 subnets, 2 masks
C       172.16.32.0/24 is directly connected, Loopback9
D       172.16.32.0/21 is a summary, 00:02:27, Null0
C       172.16.33.0/24 is directly connected, Loopback10
C       172.16.28.0/24 is directly connected, Loopback5
C       172.16.29.0/24 is directly connected, Loopback6
C       172.16.30.0/24 is directly connected, Loopback7
C       172.16.31.0/24 is directly connected, Loopback8
C       172.16.24.0/24 is directly connected, Loopback1
D       172.16.24.0/21 is a summary, 00:02:28, Null0
C       172.16.25.0/24 is directly connected, Loopback2
C       172.16.26.0/24 is directly connected, Loopback3
C       172.16.27.0/24 is directly connected, Loopback4
D       172.16.8.0/24 [90/409600] via 192.168.10.0, 00:02:26, FastEthernet0/0
D       172.16.9.0/24 [90/409600] via 192.168.10.0, 00:02:26, FastEthernet0/0
D       172.16.0.0/21 [90/409600] via 192.168.10.0, 00:02:26, FastEthernet0/0

So the routes from Router 1 are now summarized in to 3 blocks. 172.16.0.0/21 which would include the first 8 networks, plus the 172.16.8.0 and 172.16.9.0 /24 which fall out side the summarization.

Note also the routes to null that have been entered. When you set up a summarization, the router will automatically set up a route to null for that network. The reason for this is that you many not actually have routes to all the subnets for the network you have advertised as a summary. Imagen in the above case there was no loop back 5 and 6 on router 2, so no networks 172.16.28.0 and 172.16.29.0 /24. But the router is still advertising a summary address that includes them. When packet arrive at the router they are routed based on the most specific match. so a packet coming in with a destination address of 172.16.27.59 will match both the following routes.

D 172.16.24.0/21 is a summary, 00:02:28, Null0
C 172.16.26.0/24 is directly connected, Loopback

but because /24 is more specific than /21 the route to the loop back interface will be used. However if there is no more specific route, then the null route will be matched and the packets discarded.

OK I said it was simple and it is. The topology files have both the starting position and my completed example. This is of course not the only solution. You can argue there are neater ways to do it, but I chose to use multiply statements to show how specific networks can be picked and what happens when summary address do not exactly match the networks that are configured.

There will be one more EIGRP Lab coming up that will be more involved and included redistribution of static routes and manual formation on neighbours.

DevilWAH