Archive
Dos2unix
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.
Dynamips – findings
So I have made some more findings about Dynamips
- Running more hypervisors is not more effecient than running one, will load balance over cores anyway
- GNS3 is just a hassle, stick with Dynagen if you have a set topology
This means that in my previous post it is only necessary to run two hypervisors, one local and one remote. I decided to run R1-R4 on my laptop and everything else on my other computer. This keeps the load at around 35% on my laptop and 75% on the other computer. It’s good that my laptop doesn’t get so high CPU load because I use it to run all the telnet sessions. I am using Putty to login to the console since this is what is used at the R&S lab.
Dynamips – loadbalanced hypervisors
As most CCIE candidates know Dynamips runs much better on Linux. Many of us run Windows at work or as our primary OS and might be afraid to mess around with partitioning and dual booting. There is a safer alternative that is called WUBI (Windows UBuntu Installer). WUBI installs Ubuntu like a regular program and it can be removed via add/remove programs. WUBI adds an option at boot to boot either Ubuntu or Windows. If you don’t choose anything Windows will boot. Get WUBI here.
I use my laptop to run labs but it’s not that powerful. It’s a Core 2 duo @ 2.13 GHz with 4GB RAM and runs Windows 7 Professional as primary OS. I can run the full INE topology at 75% CPU that is with only the base configs. I have another computer that is used as a HTPC, its a Core 2 duo @ 2.33 GHz with 2GB RAM and Windows XP as primary OS. I got the idea to try to load balance with the two computers. I started out booting Ubuntu on one computer and Windows on the other but I ran in to all sorts of issues. I decided to run Ubuntu on both computers and with WUBI its easy and safe to do so and still keep your Windows (take backups just in case!). Getting the load balancing to work turned out to be more difficult than expected, that is why I hope people can benefit from this blogpost.
Start by installing Ubuntu on both computers via WUBI and boot the computers. You need to install Dynamips and Dynagen, if you want to install GNS3 also. Either use the Synaptic package manager and search for the programs or from a terminal:
sudo apt-get install dynamips
Repeat this step for Dynagen and GNS3 if wanted. The great thing with Synaptic and apt-get is that it will check dependencies and download everything needed. If you want to control the second computer from the first one configure remote desktop settings.
When using both local and remote hypervisors you cannot use localhost in your .net file, use the real IP instead. Put entries like this in your .net file:
[192.168.1.65:7200]
udp = 10000
workingdir = /Applications/Dynagen/sample_labs/internetworkexpert/working
[[3725]]
image = /Applications/Dynagen/images/c3725-adventerprisek9-mz.124-15.T10.extracted.bin
ram = 128
ghostios = True
idlepc = 0x614ac21c
I use two hypervisors per computer so the next entry will be 192.168.1.65:7201 and udp = 10100. Then after that I have 192.168.1.67:7202 and udp = 10200 which is the other computer.
You need to create directories to put the files, this is done with mkdir:
cd /
mkdir Applications
cd Applications
mkdir Dynagen
cd Dynagen
mkdir images
The reason I created these directories is that is what INE uses in their .net file (I use their workbooks). You can download the .net files and base configs here.
Make sure that the dir ‘working’ that is created from the zip file has the right permissions (write) otherwise Dynagen will crash when it tries to write log files and other files to the dir.
INE and I use an uncompressed IOS to boot the devices faster. To uncompress the image you can use unzip:
unzip c3725-adventerprisek9-mz.124-15.T10.bin
Archive: c3725-adventerprisek9-mz.124-15.T10.bin
warning [c3725-adventerprisek9-mz.124-15.T10.bin]: 28328 extra bytes at beginning or within zipfile
(attempting to process anyway)
inflating: C3725-AD.BIN
To change the filename use mv
mv C3725-AD.bin c3725-adventerprisek9-mz.124-15.T10.extracted.bin
Now everything should be in place. Start GNS3 and choose ‘open network file’ and import the .net file. I will attach mine to show how it is done. If paths to directories or to the IOS image is wrong the import will fail so typing the right names is critical.
You should now have load balancing between the computers. I was able to go down from 75% CPU to around 45-50 with this setup. If you have any questions post them in comments. Here is the .net file.