Nov 3

Run remote procedures & GNS3

Posted by Dragos Draghicescu

An interesting and pretty new capability of Cisco IOS is scripting through TCL language. What is not that well documented is that you can configure a router in some situations and the interesting thing is that you can store the configuration procedure remotely, like on a tftp server for example. What I will present may be useful in lab environments, for simulation purposes. I used it to prepare a huge exercise for the CCNA 2 class.

First of all, I will suppose that you have configured a tftp server somewhere in your LAN. Second thing is you can configure a bridge between your Ethernet interface and a tap interface (a virtual interface, for use with the emulated router). In Linux, you can use the Bridge-utils and uml-utilities to do that. You can find a tutorial on how to do a bridge <here>.

Now lets get to work! :)

In GNS3 (ran as root) you have to link the router with a clouds tap interface. In the cloud configuration panel, add a tap interface into the NIO tap tab (lets say tap0). Next, configure the router interface IP address like its part of your LAN. You can ping your gateway to verify that.

It’s all said and done. The script I wrote reads a number of Loopback interfaces to be configured from the user input. The output looks like this:

IOS output

IOS output

The output is incomplete, but the script configured Loopback 0 to 4 with ip addresses.

I hope some will find what can be done with IOS TCL pretty interesting.

Good luck!

DD

Oct 26

Wake on LAN

Posted by Dragos Draghicescu

As I was looking through the DD-WRT Linux distribution capabilities I have seen an interesting protocol named Wake on LAN, allowing one to power up a device remotely.

Basically, for implementation, you have to configure the BIOS on the PC (usually in Power Management section) to support it. After that, your network card will remain active even after you power off the PC, waiting in a low-power state for a “magic packet” to turn it back on. I managed to implement it in a lab and it’s really nice to have full control over configuring a host PC from turn on to shut down. And in a lab with 45 PC’s.. it kind of helps :) .

I’ve played a little with an embedded ARM device with Linux, and cross-compiled the program <here> for use with the command line. The script that fires it lies <here>. I apologise for not having around the latest version at the time writing this. It looks like this:

WOL_screen

WOL_screen

You can look on the web for more information about WOL (it’s very well documented).

Good luck!

DD

Aug 19

Like most CCIE Lab stories, this one starts with a way to access the consoles remotely – a terminal server. In my case, a Cisco 2811 with a NM-16A module (and a CAB-OCTAL-ASYNC breakout cable for connecting 8 routers).

I have had the opportunity to work with terminal servers many times before (including the actual CCIE lab) – but they were always configured by other people. This time, I had to configure the TS myself. No problem, I say…

TS(config)#int lo0
TS(config-if)#ip add 192.168.1.1 255.255.255.255

!--- line numbers may vary depending on module
!--- use "show line" to determine the numbers in use
TS(config-if)#line 66 81
TS(config-line)#transport input all

!--- Optional
TS(config-line)#flowcontrol hardware

!--- Optional, but it makes accessing the devices easier
TS(config)#ip host r1 2066 192.168.1.1
TS(config)#ip host r2 2067 192.168.1.1
TS(config)#ip host r3 2068 192.168.1.1
TS(config)#ip host r4 2069 192.168.1.1
TS(config)#ip host r5 2070 192.168.1.1
TS(config)#ip host r6 2071 192.168.1.1
TS(config)#ip host r7 2072 192.168.1.1
TS(config)#ip host r8 2073 192.168.1.1

Looks good, and I can now access the devices by telnetting to the various ports on 192.168.1.1. Yet something is wrong… The lines become busy at random intervals, which makes the terminal server refuse connections. A “clear line” solves the problem, but only for a very short time – just seconds later, the line becomes active again.

TS#sh line
   Tty Line Typ     Tx/Rx    A Modem  Roty AccO AccI  Uses  Noise Overruns  Int

*   1/6   72 TTY   9600/9600  -    -      -    -    -     3   1448  447/1343   -
*   1/7   73 TTY   9600/9600  -    -      -    -    -     5    129   62/188    -

TS#r1
Translating "r7"
Trying r7 (192.168.1.1, 2072)...
% Connection refused by remote host

After several hours of frustration (clearing lines just to have them become busy again almost immediately), I realize what I forgot:

TS(config-if)#line 66 81
TS(config-line)#no exec

The explanation? Any kind of noise on the wire was interpreted by the TS as an incoming character. As a result, the TS would activate the line, opening an exec session. A “clear line” would close the session, only to have it opened again by the noise.

As somebody else put it – “‘No exec’ isn’t mandatory, but it will help you keep your sanity!”