Archive

Archive for the ‘Scripts’ Category

Dos2unix

January 28, 2011 1 comment

There is a difference in how Windows and Unix-based systems end their lines. Why does this matter to us?
When converting the configs for the INE workbook vol1 the configs have been made by someone using Windows.

Windows uses a carriage return and a linefeed for each new line. The carriage return can be expressed as \r or ^M.
After that we have a linefeed which is expressed \n or ^J. When using a Unixbased system only the \n is used.

How can I convert from DOS-format to Unix, well there are a lot of different ways of doing this.
We can do it by using sed but there is a easier way. There is a utility called dos2unix, I run Debian on my Dynamips
box and I couldn’t find a package called dos2unix but there is a package named tofrodos that contains dos2unix.
To install it use:

sudo apt-get install tofrodos

Then answer yes to install it. Using it is easy, this is the syntax:

dos2unix r1.txt

This will clean up the file and output it with the same name it already has (overwriting). If you want to put the result in a new file then use:

dos2unix r1.txt r1-new.txt

If you have had issues with running my script this might be why. If you open a DOS-formatted text-file with Nano it will say that it has been
converted from DOS-format. I probably could have solved this in the script but my Unix skills are very limited and as I pick things up I will
try to improve it. Please leave comments if you use the script and if you have made any improvements to it. I want the community and all
us future CCIEs to have the tools needed readily available for sucessful studies.

Advertisements
Categories: Linux, Scripts Tags: , ,

Script updates

January 25, 2011 Leave a comment

Some more updates to script:

  • Had missed to remap some serial interfaces on r4-r6
  • Port Fa0/6 on SW2 wasn’t remapped which led to connectivity issues between R1 and R6
Categories: CCIE, Dynamips, Scripts Tags: , ,

Script updated again

January 24, 2011 1 comment

Found some more bugs:

  • Wasn’t matching specific enough in the sed statements for bb1
  • Added 100/full to backbone routers ethernet interfaces
  • Redid how I delete interfaces for backbone routers

Should be pretty close to finished now but I find something almost every day.

Categories: CCIE, Dynamips, Scripts Tags: , ,

Script updated

January 23, 2011 1 comment

Found a lot of errors in my script and added some features. Things that got fixed:

  • Searching for interfaces for r1-r6 that didn’t need to be changed
  • Setting all interfaces to 100/full since Dynamips doesn’t like auto
  • Some patterns weren’t specific enough which led to multiple entries
  • Switchport mode dynamic desirable not available, set to hardcoded trunk
  • Switchport host not available, using switchport mode access instead
  • Delete some of interfaces on BB1 because we have separate frameswitch in topology

That should take care of most of the errors, if you find anything else please report it. Script is still avaible here.

Categories: CCIE, Dynamips, Scripts Tags: , ,

Converting INE vol1 configs to Dynamips

January 23, 2011 19 comments

I have done mostly rack rentals so far and for pure layer 2 it’s a must but I want to mix with Dynamips for labs that are not heavy on layer 2. I wanted to use the configs provided for vol1 in Dynamips but the interfaces does not match since the serial interfaces is in a different slot. The NM-16ESW only has 16 ports instead of 24 and there are also some differences on the backbone routers. Going through each configuration before each lab would take a lot of time and be very tedious. Since I couldn’t find anything that suited my need I wrote a shellscript to convert the configs for me. Disclaimer: I have very little experience with scripting and if you want to use the script, do it at your own risk. The code is very ugly and can probably be more efficient but it works. If you find any errors please post them in comments. The script uses sed to replace text in the configs. You can find the script here. The only thing you need to modify is the newdir=”/home/reaper/INE/configs/Dynamips”. Change it to your homedir, I store the files for r1-r6 etc in INE/configs and the script creates the Dynamips dir.

Categories: CCIE, Scripts Tags: , , ,