Cisco模拟器运行于Windows环境,比较耗资源,因此,在现有的CentOS6 Linux操作系统上,安装Dynamips来模拟Cisco路由和交换。
一、下载:
下载需要的几个包
[root@cisco test]# wget http://www.ipflow.utc.fr/dynamips/dynamips-0.2.8-RC2-x86.bin
[root@cisco test]# wget ftp://ftp.pbone.net/mirror/dag.wieers.com/redhat/el6/en/i386/dag/RPMS/dynagen-0.10.1-1.el6.rf.noarch.rpm
说明:dynamips包,可以下载RPM包,也可以下载bin文件
二、安装
1、安装支持包libpcap包,DVD光盘或在ISO文件中有,可以直接安装
[root@cisco test]# rpm -ivh /media/CentOS_6.0_Final/Packages/libpcap-1.0.0-6.20091201git117cb5.el6.i686.rpm
2、安装dynamips
[root@cisco test]# cp dynamips-0.2.8-RC2-x86.bin /usr/bin/dynamips
[root@cisco test]# chmod +x /usr/bin/dynamips
说明:下载的是bin文件,是可执行文件,改名放入对应的位置即可。如果是RPM文件,直接安装即可。
3、安装dynagen
[root@cisco test]# rpm -ivh dynagen-0.10.1-1.el6.rf.noarch.rpm
4、下载Cisco的ISO文件
5、编写拓扑脚本
三、运行使用
1、运行Dynamips守护进程(可以写成脚本形式)
脚本如下:
[root@cisco test]# vi start-dynamips.sh
#!/bin/bash
echo "*================================================*"
echo "* *"
echo "* . . *"
echo "* I I *"
echo "* III III *"
echo "* .II II. .II II. *"
echo "* .:III I III:..:III I III:. *"
echo "* C i s c o S y s t e m s *"
echo "* BY:ganxing *"
echo "*=============================================== *"
echo "* Console for 3640 Router *"
echo "*=============================================== *"
/usr/bin/dynamips -H 7200 &
2、编写拓扑文件(模拟一路由与一交换)
[root@cisco test]# vi test.net
autostart = False
[localhost]
workingdir = /tmp
prot = 7200
udp = 10000
`3640`
p_w_picpath = /root/c3640-jk9o3s-mz.123-10.bin
ram = 128
idlepc = 0x6045bcec
`ROUTER R0`
model = 3640
console = 2000
slot0 = NM-4E
e0/0 = SW f0/0
`ROUTER SW`
model = 3640
console = 2001
slot0 = NM-16ESW
3、编写启动模拟器脚本
[root@cisco test]# vi start.sh
#!/bin/bash
echo "*================================================*"
echo "* *"
echo "* . . *"
echo "* I I *"
echo "* III III *"
echo "* .II II. .II II. *"
echo "* .:III I III:..:III I III:. *"
echo "* C i s c o S y s t e m s *"
echo "* BY:ganxing *"
echo "*=============================================== *"
echo "* Console for 3640 Router *"
echo "*=============================================== *"
/usr/bin/dynagen test.net