加入收藏 设为首页 联系站长
首页 | 虚拟动态 | Cisco模拟 | Juniper仿真 | 虚拟机 | 网络仿真 | 软件路由 | 技术专题 | 相关软件 | 交流论坛
>首页 -> Cisco模拟 -> Dynamips

TOP

BAT文件中使用GHOST特性的技巧及使用(8月20)
[ 录入者:admin | 时间:2007-10-27 15:08:53 | 作者: | 来源: | 浏览:539次 ]

BAT文件中使用GHOST特性的技巧及使用(8月20)

NET文件里使用GHOSTIOS特性的教程蛮多,但BAT文件的我找了一天基本上么有
根据DYNAMIPS的CMD帮助里,经过我一天的研究终于实现了在BAT文件中使用GHOST特性的方法:
我现在用的机器的配置是AMD Athlon 64 X2 Dual Core Processor 3600+ 1.9G 448MB内存
BAT文件不加GHOST特性时.我开一台3620和一台带交换模块的3640,我的内存使用是这样的:


以下是使用GHOST特性的方法
首先建立GHOST.BAT文件,例如3640的dynamips-wxp.exe -P 3600 -t 3640 -r 128 -g ..\ghost_ram  ..\c3640-ik9o3s-mz.124-8a.bin //建立128MB的GHOST镜像并命名为ghost_ram
然后在DynamipsGUI生成的BAT文件中加入参数,-G ..\你生成的IOS的GHOST镜像文件 --sparse-mem
例如:dynamips-wxp.exe -T 2002 -P 3600 -r 128 -t 3640 -c 0x2102 -p 0:NM-1FE-TX -p 1:NM-4T -s 1:0:udp:11210:127.0.0.1:11100 -s 0:0:udp:11200:172.30.1.11:11400 ..\c3640-ik9o3s-mz.124-8a.bin --idle-pc=0x606f808c -G ..\ghost_ram --sparse-mem
修改后保存
然后双击生成的BAT文件
以下是我使用GHOST特性打开的3620和3640的BAT文件,内存及CPU使用率如下所示:


不加GHOST特性时,两台模拟器耗了我180MB左右的内存,使用了GHOST特性后,我的两台耗了近60MB内存
在用SecureCRT连接模拟器后的内存使用如下:

两台模拟器占用内存80多MB

比不用GHOST特性省了100MB左右,哈哈,好爽哦

这可是我原创哦,希望大家喜欢
还有个小技巧:不知道是我CPU的问题还是RP问题,在启用GHOST后,运行BAT文件内存并没节省,在我将两个CMD窗口分别连续最小化两次后(两次间隔在3S左右),内存的使用就是图2所示的那样了,而且比较稳定,希望这个小技巧能给大家带来新的收获

使用GHOST特性时,再打开MEMEMPTY的话,效果更佳
我开6台设备,其中两台模拟三层的3660,一台做DHCP的3660,和一台二层的3640,剩下两台模拟主机,6台内存在GHOST+MEMEMPTY的情况下,内存使用没超过6MB,有兴趣的朋友可以试试
 
 
 
 
Memory Usage Optimizations
As described in the Resource Utilization section your labs can consume a large amount of real and virtual memory. The “ghostios” and “sparemem” options were added to address both of these issues, respectively.



The Ghostios option can significantly reduce the amount of real host RAM needed for labs with multiple routers running the same IOS image. With this feature, instead of each virtual router storing an identical copy of IOS in its virtual RAM the host will allocate one shared region of memory that they will all utilize. So for example, if you are running 10 routers all with the same IOS image, and that image is 60 MB in size you will save 9*60 = 540 MB of real RAM when running your lab. Enabling ghostios is as simple as specifying “ghostios = true” in your network file. This option can be used in several places:

If used at the top level, ghostios is applied to all router instances in the lab
If used at the defaults section (e.g. “[[7200]]”) it applies only to that model of router on that dynamips server
Note that ghostios (and all other top level parameters for that matter) cannot be specified at the server level. They will be ignored. ghostios also cannot be specified at the router level


Typical usage is to specify “ghostios = true” at the top level. Dynagen is smart enough only to use ghostios if there is more than one router using the same IOS image.



When enabled, you will notice additional files in the same directory as you router nvram files with names like “c3660-ik9o3s-mz.124-10.image.ghost”. This is the mmap’ed file that contains the shared memory region. The other files typically created with a router instance are created as well (log, nvram, and possibly bootflash files).



Measuring the amount of host memory saved with ghostios can be a little tricky due to the complexities of memory management in modern OSs. See this sticky post in the General section of Hacki’s Forum titled “Understanding memory usage and RAM Ghosting: for the gory details.



The “sparsemem” feature does not conserve real memory, but instead reduces the amount of virtual memory used by your router instances. This can be important, because OS limits a single process to 2 GB of virtual memory on 32-bit Windows, and 3 GB on 32-bit Linux. For example, on Windows, after the VM space used by cygwin and other libraries dynamips depends on, this only leaves room for 4 router instances @ 256 MB each! Enabling sparsemem only allocates virtual memory on the host that is actually used by IOS in that router instance, rather than the entire amount of RAM configured. This can allow you to run more instances per dynamips process before you have to resort to running multiple dynamips processes. See this FAQ item for more info on this issue.



Neither ghostios nor sparemem are enabled by default, so you must turn them on with:



ghostios = true

sparsemem = true



in your network file. If you use ghostios, the shared memory will be memory-mapped no matter what your mmap setting is. If you enable sparse-mem, no memory mapping will occur for router memory. You can choose to use ghostios or sparsemem separately or together.



Here is an example network file with typical ghostios and sparsemem usage – configured at the top level so that they are applied to all router instances in the lab:



model = 3660

ghostios = true

sparsemem = true



[localhost]

      

      [[3660]]

      image = \Program Files\Dynamips\images\c3660-ik9o3s-mz.124-10.image           



      [[router r1]]

      fa0/0 = sw 1      # Note that you can use two letter interfaces names

                        # for increased clarity if you wish

      [[router r2]]

      fa1/0 = sw 2

      

      [[router r3]]

      fa1/0 = sw 3



      [[ETHSW sw1]]

1 = access 5

2 = access 25

3 = access 35

4 = dot1q 1 NIO_gen_eth: NIO_gen_eth:\Device\NPF_{B00A38DD-F10B-43B4-99F4-                                   B4A078484487}



原来是自动式的。晚上下班后去试验一下。
[上一篇]CISCO硬件模拟器-dynamips的使用.. [下一篇]Freebsd6.2 下安装dynagen(Cisco ..
※相关文章
 

评论

称  呼:
内  容:

相关栏目

最新文章

热门文章

推荐文章

赞助商链接