2008年3月13日 星期四

用LINUX建構cisco LAB

以下文件是在ubuntu LINUX的環境下,進行安裝dynanmips/dynagen的說明。
dynamips/dynagen是一個法國網路工程師寫出來的軟體,造福了不少買不起機器,卻有志從事cisco 網路設備管理的朋友們!

----------------------------------------------------------------------------------
[簡易安裝法]
I. Easy way to install Dynamips/Dynagen (older version)

The easiest way to install any program on Ubuntu linux is via Synaptic,
although in most cases slightly older versions of programs are available .
Just go to (on your Gnome desktop):

1. System > Administration > Synaptic (package manager)
2. Search for Dynagen / Dynamips
3. Tick the boxes next to the chosen programs, apply changes, and wait until it finish installation.
4. That's it!
[註解:用ubuntu內建的套件管理程式 Synaptic就可以進行安裝!可以用關鍵字搜尋。找dynamips和dynagen!]


Now you can run it from terminal:
Code:
dynamips -H 7200 &
[註解:執行dynamips,使用PORT 7200,並丢到背景執行!這是一個像模擬器的SERVER。]

Once you have your IOS and lab ready run (if not follow this tutorial)
Code:
dynagen simple1.net
[註解:simple1.net是定義生成怎麼樣機器和網路串接環境的組態檔!可以自行新增。但要知道它組態檔的寫法。]
(default simple1.net lab and other can be found on your system in /usr/share/doc/dynagen/ or
just follow dynagen tutorial to find out how to create one)

Helpful link (Ubuntu Guide - great source on howto's for Ubuntu desktop):
http://ubuntuguide.org/wiki/Ubuntu:Gutsy

----------------------------------------------------------------------------------
[進階安裝]
II. A bit harder way to install Dynamips/Dynagen (latest version)

Alternatively, to get the latest version, rather then messing up with source .tar.gz archives
(it's not recommended with linux versions based on packages,
such as Ubuntu is based on .deb files - debian packages, sort of windows .exe files),
follow the steps:

1. Download the latest .rpm (red hat package) for Dynamips server (dynamips-0.2.8RC1-1.i386.rpm)
and Dynagen (dynagen-0.10.1-1.noarch.rpm ) from here.
[註解:找www.dynamips.org,有下載的連結!現在真正的載點好像轉到sourceforge.net了。]

2. Convert .rpm files to .deb with 'alien' program.
Once you haven't got 'alien' program installed by default, install it running following command from the terminal window:
(Alt+F2, and then gnome-terminal)
Code:
sudo apt-get install alien
[註解:最新版本有RPM和tar.gz檔,但就是沒有deb檔!而我們現在在debian LINUX環境之下,所以才會要求用alien指令。]

By default Firefox put the files you download on your Desktop, so run the following commends:
Code:
cd ~/Desktop/ #changes to directory where you downloaded .rpms

sudo alien dynamips-0.2.8RC1-1.i386.rpm #converts .rpm to .deb
sudo alien dynagen-0.10.1-1.noarch.rpm
[註解:用alien命令安裝RPM檔案。 ]


3. Double click on resulting .deb files (should find them on your desktop) and once the installer pop up the window install.
4. First time you run the program:
Code:
dynamips -H 7200 &

dynamips would return error (no error? go to step 6):
Code:
$ dynamips: error while loading shared libraries: libpcap.so.0.9.4: cannot open shared object file: No such file or directory
[註解:上面那行是在ubuntu 7.10環境下的錯誤訊息。libpcap是擷取封包用的模組,沒有它玩不起來。]


Question dynamips complains about missing lipcap library - which you actually have got installed, but in highier version!
5. To fix the problem, check the version of lipcap you have installed with:
Code:
ls /usr/lib | grep libpcap.so.*

it returns (in my case):
Code:
$ libpcap.so.0.8
$ libpcap.so.0.9.7

link the latest version of your lipcap (for me it is 0.9.7) to the one dynamips asks for (0.9.4):
(change the numbers in the following command if you've got different vesions!)
Code:
sudo ln -s /usr/lib/libpcap.so.0.9.7 /usr/lib/libpcap.so.0.9.4
[註解:解決方法之一,是以ubuntu本身的套件管理去安裝這個模組,然後將模組名字用soft link的方式,去建立出原錯誤訊息中要求的檔名。]


6. Now you should successfully run dynamips with:
Code:
dynamips -H 7200 &

it returns:
Code:
$ Cisco Router Simulation Platform (version 0.2.8-RC1-x86)
Copyright (c) 2005-2007 Christophe Fillot.
Build date: Sep 10 2007 21:54:52

Hypervisor TCP control server started (port 7200).

To turn off dynamips server:
Code:
ps | grep dynamips

would return something like this:
Code:
10110 pts/1 00:00:00 dynamips

so to kill the dynamips process in this example enter:
Exclamation (Your process number might be different!)
Code:
kill 10110
[註解:從ps命令到 kill命令,都是要說明如何結束dynamips的運行程序。你也能用killall dynamips,會比較直接而乾脆!]

On the commend prompt press 'enter' again and you get:
Code:
$
[1]+ Terminated dynamips -H 7200

7. Once dynamips is up and running (dynamips -H 7200 &) you can run the labs with dynagen
( I assume you have working IOS and simple.net config file created in the working directory):
Code:
dynagen simple.net


[註解:以下是一個有三個router的模擬環境。]
----------------------------------------------------------------------------------
Here is my simple.net lab example:
Code:
# 3 routers lab

[localhost]

[[7200]]
image = "ENTER PATH TO YOUR IOS IMAGE HERE"
npe = npe-400
ram = 160

[[ROUTER R1]]
s1/0 = R2 s2/0
s2/0 = R3 s1/0

[[router R2]]
s1/0 = R3 s2/0

[[router R3]]

沒有留言:

搜尋此網誌

本站大事記

這個部落格(網站)內容以分享LINUX和延伸出的技術文章為主!
特別是為了工作和進修需要,搜集了不少網站連結。
希望對來這裡觀文的朋友們,有提供一些有用的資訊或文章。
但這裡的文章中,也包含個人的心情扎記和隨興言談……
若是當中沒有對上你的口味,請多包涵!

原「琳娜絲與希斯寇的邂逅」,改名為「愛上琳娜絲」!

原「琳娜絲與希斯寇的邂逅」,改名為「愛上琳娜絲」!
--原序文--
就是當LINUX遇上CISCO啦!他們的結合還能作什麼事…不就是讓這個世界的網路,串…串起來啊…不然你們那能上這網站看部落格!