文章列表(关注微信公众号EmulatedLab,及时获取文章以及下载链接)

1、EVE-NG介绍(EVE-NG最好用的模拟器,仿真环境时代来临!)

2、EVE-NG安装过程介绍

3、EVE-NG导入Dynamips和IOL

4、EVE-NG导入QEMU镜像

5、EVE-NG关联SecureCRT,VNC,Wireshark

6、EVE-NG网卡桥接,带您走进更高级的实验

7、EVE-NG硬盘扩容,存储海量镜像

8、EVE-NG定制个人镜像,脚本快速导入

9、EVE-NG容纳H3C、Huawei,吞并GNS3

10、EVE-NG镜像来啦!打造国内最大的EVE交流圈

11、EVE-NG镜像再次来袭,无所不能!

12、EVE-NG镜像增持,走上神坛!

13、EVE-NG内存不够?教您扩大虚拟内存!

14、EVE-NG更新方便,不费劲儿!

15、EVE-NG小众镜像,助力尝鲜!

16、EVE-NG体验Seafile,抛弃10K/s网盘

17、EVE-NG增添监控服务器镜像,再上新高度!

18、EVE-NG变身Learning Centre版本及重置Web用户密码

19、EVE-NG优化非官方支持镜像的接口显示名称

20、EVE-NG华丽登场Openstack镜像,体验私有云!

点击查看配套视频教程!



wKiom1lHN8nxANwqAAbVl_rPuc0119.jpg-wh_50


 

 

目前已优化的设备包含:

            H3C vSR

            H3C vFW

            H3C vLB

            HuaweiUSG

            HillStone

 

 

H3C vSR举例

 

 

原接口名称

wKiom1lHOQigRZTOAAAbDq2Y3dw604.png-wh_50


终端执行命令

 

root@eve-ng:~# cp/opt/unetlab/html/includes/__node.php{,.`date +%s`}&&sed -i "/case'a10':/i\\\t\t\t\t\tcase 'vsr':\n\t\t\t\t\t\tfor (\$i = 0; \$i < \$this-> ethernet; \$i++) {\n\t\t\t\t\t\t\t\$n = 'Gi'.(\$i+1).'/0';                // Interfacename\n\t\t\t\t\t\t\tif (isset(\$old_ethernets[\$i])) {\n\t\t\t\t\t\t\t\t//Previous interface found, copy from old one\n\t\t\t\t\t\t\t\t\$this ->ethernets[\$i] = \$old_ethernets[\$i];\n\t\t\t\t\t\t\t} else{\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\$this -> ethernets[\$i] = newInterfc(Array('name' => \$n, 'type' => 'ethernet'),\$i);\n\t\t\t\t\t\t\t\t} catch (Exception \$e){\n\t\t\t\t\t\t\t\t\terror_log(date('M d H:i:s ').'ERROR:'.\$GLOBALS['messages'][40020]);\n\t\t\t\t\t\t\t\t\terror_log(date('M d H:i:s').(string) \$e);\n\t\t\t\t\t\t\t\t\treturn40020;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Setting CMD flags(virtual device and map to TAP device)\n\t\t\t\t\t\t\t\$this -> flags_eth .=' -device %NICDRIVER%,netdev=net'.\$i.',mac=50:'.sprintf('%02x', \$this ->tenant).':'.sprintf('%02x', \$this -> id / \n12).':'.sprintf('%02x', \$this-> id % 512).':00:'.sprintf('%02x', \$i);\n\t\t\t\t\t\t\t\$this ->flags_eth .= ' -netdev tap,id=net'.\$i.',ifname=vunl'.\$this ->tenant.'_'.\$this ->id.'_'.\$i.',script=no';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n"/opt/unetlab/html/includes/__node.php

root@eve-ng:~#

 

 

 

更改后的接口名称与OS中显示的名称吻合

wKiom1lHOQiRTXwBAAAc0xMfg4g871.png-wh_50


 

 

 

注意:

老用户直接执行命令即可!

新用户在导入设备时,接口名称就已优化,无需额外执行命令!

 

 

所有设备相应的执行命令:(每个命令都有细微差别)


1H3C vSR

cp/opt/unetlab/html/includes/__node.php{,.`date +%s`}&&sed -i "/case'a10':/i\\\t\t\t\t\tcase 'vsr':\n\t\t\t\t\t\tfor (\$i = 0; \$i < \$this-> ethernet; \$i++) {\n\t\t\t\t\t\t\t\$n = 'Gi'.(\$i+1).'/0';                // Interfacename\n\t\t\t\t\t\t\tif (isset(\$old_ethernets[\$i])) {\n\t\t\t\t\t\t\t\t//Previous interface found, copy from old one\n\t\t\t\t\t\t\t\t\$this ->ethernets[\$i] = \$old_ethernets[\$i];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\t\t\$this -> ethernets[\$i] = new Interfc(Array('name'=> \$n, 'type' => 'ethernet'), \$i);\n\t\t\t\t\t\t\t\t} catch (Exception\$e) {\n\t\t\t\t\t\t\t\t\terror_log(date('M d H:i:s ').'ERROR:'.\$GLOBALS['messages'][40020]);\n\t\t\t\t\t\t\t\t\terror_log(date('M d H:i:s').(string) \$e);\n\t\t\t\t\t\t\t\t\treturn40020;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Setting CMD flags(virtual device and map to TAP device)\n\t\t\t\t\t\t\t\$this -> flags_eth .=' -device %NICDRIVER%,netdev=net'.\$i.',mac=50:'.sprintf('%02x', \$this ->tenant).':'.sprintf('%02x', \$this -> id / \n12).':'.sprintf('%02x', \$this-> id % 512).':00:'.sprintf('%02x', \$i);\n\t\t\t\t\t\t\t\$this ->flags_eth .= ' -netdev tap,id=net'.\$i.',ifname=vunl'.\$this ->tenant.'_'.\$this ->id.'_'.\$i.',script=no';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n"/opt/unetlab/html/includes/__node.php

 

2H3C vFW

cp/opt/unetlab/html/includes/__node.php{,.`date +%s`}&&sed -i "/case'a10':/i\\\t\t\t\t\tcase 'vfw':\n\t\t\t\t\t\tfor (\$i = 0; \$i < \$this-> ethernet; \$i++) {\n\t\t\t\t\t\t\t\$n = 'Gi'.(\$i+1).'/0';                // Interfacename\n\t\t\t\t\t\t\tif (isset(\$old_ethernets[\$i])) {\n\t\t\t\t\t\t\t\t//Previous interface found, copy from old one\n\t\t\t\t\t\t\t\t\$this ->ethernets[\$i] = \$old_ethernets[\$i];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\t\t\$this -> ethernets[\$i] = new Interfc(Array('name'=> \$n, 'type' => 'ethernet'), \$i);\n\t\t\t\t\t\t\t\t} catch (Exception\$e) {\n\t\t\t\t\t\t\t\t\terror_log(date('M d H:i:s ').'ERROR:'.\$GLOBALS['messages'][40020]);\n\t\t\t\t\t\t\t\t\terror_log(date('M d H:i:s').(string) \$e);\n\t\t\t\t\t\t\t\t\treturn40020;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Setting CMD flags(virtual device and map to TAP device)\n\t\t\t\t\t\t\t\$this -> flags_eth .=' -device %NICDRIVER%,netdev=net'.\$i.',mac=50:'.sprintf('%02x', \$this ->tenant).':'.sprintf('%02x', \$this -> id / \n12).':'.sprintf('%02x', \$this-> id % 512).':00:'.sprintf('%02x', \$i);\n\t\t\t\t\t\t\t\$this ->flags_eth .= ' -netdev tap,id=net'.\$i.',ifname=vunl'.\$this ->tenant.'_'.\$this ->id.'_'.\$i.',script=no';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n"/opt/unetlab/html/includes/__node.php

 

3H3C vLB

cp/opt/unetlab/html/includes/__node.php{,.`date +%s`}&&sed -i "/case'a10':/i\\\t\t\t\t\tcase 'vlb':\n\t\t\t\t\t\tfor (\$i = 0; \$i < \$this-> ethernet; \$i++) {\n\t\t\t\t\t\t\t\$n = 'Gi'.(\$i+1).'/0';                // Interfacename\n\t\t\t\t\t\t\tif (isset(\$old_ethernets[\$i])) {\n\t\t\t\t\t\t\t\t//Previous interface found, copy from old one\n\t\t\t\t\t\t\t\t\$this ->ethernets[\$i] = \$old_ethernets[\$i];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\t\t\$this -> ethernets[\$i] = new Interfc(Array('name'=> \$n, 'type' => 'ethernet'), \$i);\n\t\t\t\t\t\t\t\t} catch (Exception\$e) {\n\t\t\t\t\t\t\t\t\terror_log(date('M d H:i:s ').'ERROR:'.\$GLOBALS['messages'][40020]);\n\t\t\t\t\t\t\t\t\terror_log(date('M d H:i:s').(string) \$e);\n\t\t\t\t\t\t\t\t\treturn40020;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Setting CMD flags(virtual device and map to TAP device)\n\t\t\t\t\t\t\t\$this -> flags_eth .=' -device %NICDRIVER%,netdev=net'.\$i.',mac=50:'.sprintf('%02x', \$this ->tenant).':'.sprintf('%02x', \$this -> id / \n12).':'.sprintf('%02x', \$this-> id % 512).':00:'.sprintf('%02x', \$i);\n\t\t\t\t\t\t\t\$this ->flags_eth .= ' -netdev tap,id=net'.\$i.',ifname=vunl'.\$this ->tenant.'_'.\$this ->id.'_'.\$i.',script=no';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n"/opt/unetlab/html/includes/__node.php

 

4Huawei USG

cp/opt/unetlab/html/includes/__node.php{,.`date +%s`}&&sed -i "/case'a10':/i\\\t\t\t\t\tcase 'usg':\n\t\t\t\t\t\tfor (\$i = 0; \$i < \$this-> ethernet; \$i++) {\n\t\t\t\t\t\t\tif (\$i==0) {\n\t\t\t\t\t\t\t\t\$n ='Gi0/'.\$i.'/0';                //Interface name\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\$n ='Gi1/0/'.(\$i-1);                //Interface name\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (isset(\$old_ethernets[\$i])){\n\t\t\t\t\t\t\t\t// Previous interface found, copy from oldone\n\t\t\t\t\t\t\t\t\$this -> ethernets[\$i] =\$old_ethernets[\$i];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\t\t\$this -> ethernets[\$i] = new Interfc(Array('name'=> \$n, 'type' => 'ethernet'), \$i);\n\t\t\t\t\t\t\t\t} catch (Exception\$e) {\n\t\t\t\t\t\t\t\t\terror_log(date('M d H:i:s ').'ERROR:'.\$GLOBALS['messages'][40020]);\n\t\t\t\t\t\t\t\t\terror_log(date('M d H:i:s').(string) \$e);\n\t\t\t\t\t\t\t\t\treturn40020;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Setting CMD flags(virtual device and map to TAP device)\n\t\t\t\t\t\t\t\$this -> flags_eth .=' -device %NICDRIVER%,netdev=net'.\$i.',mac=50:'.sprintf('%02x', \$this ->tenant).':'.sprintf('%02x', \$this -> id / 512).':'.sprintf('%02x', \$this-> id % 512).':00:'.sprintf('%02x', \$i);\n\t\t\t\t\t\t\t\$this ->flags_eth .= ' -netdev tap,id=net'.\$i.',ifname=vunl'.\$this ->tenant.'_'.\$this -> id.'_'.\$i.',script=no';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n"/opt/unetlab/html/includes/__node.php

 

5HillStone

cp/opt/unetlab/html/includes/__node.php{,.`date +%s`}&&sed -i "/case'a10':/i\\\t\t\t\t\tcase 'hillstone':\n\t\t\t\t\t\tfor (\$i = 0; \$i <\$this -> ethernet; \$i++) {\n\t\t\t\t\t\t\t\$n = 'ethernet0/'.\$i;                // Interfacename\n\t\t\t\t\t\t\tif (isset(\$old_ethernets[\$i])) {\n\t\t\t\t\t\t\t\t//Previous interface found, copy from old one\n\t\t\t\t\t\t\t\t\$this ->ethernets[\$i] = \$old_ethernets[\$i];\n\t\t\t\t\t\t\t} else{\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\$this -> ethernets[\$i] = newInterfc(Array('name' => \$n, 'type' => 'ethernet'),\$i);\n\t\t\t\t\t\t\t\t} catch (Exception \$e){\n\t\t\t\t\t\t\t\t\terror_log(date('M d H:i:s ').'ERROR:'.\$GLOBALS['messages'][40020]);\n\t\t\t\t\t\t\t\t\terror_log(date('M d H:i:s').(string) \$e);\n\t\t\t\t\t\t\t\t\treturn40020;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Setting CMD flags(virtual device and map to TAP device)\n\t\t\t\t\t\t\t\$this -> flags_eth .=' -device %NICDRIVER%,netdev=net'.\$i.',mac=50:'.sprintf('%02x', \$this ->tenant).':'.sprintf('%02x', \$this -> id / 512).':'.sprintf('%02x', \$this-> id % 512).':00:'.sprintf('%02x', \$i);\n\t\t\t\t\t\t\t\$this ->flags_eth .= ' -netdev tap,id=net'.\$i.',ifname=vunl'.\$this ->tenant.'_'.\$this ->id.'_'.\$i.',script=no';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n"/opt/unetlab/html/includes/__node.php

 

感谢群友[辽宁]-奥斯丁提供的脚本!


本篇于2017-06-14在微信公众号EmulatedLab上发表

Maosen | 森