文章列表(關注微信公衆號EmulatedLab,及時獲取文章以及下載連接)php
一、EVE-NG介紹(EVE-NG最好用的模擬器,仿真環境時代來臨!)
html
二、EVE-NG安裝過程介紹node
三、EVE-NG導入Dynamips和IOL服務器
四、EVE-NG導入QEMU鏡像微信
五、EVE-NG關聯SecureCRT,VNC,Wiresharkide
六、EVE-NG網卡橋接,帶您走進更高級的實驗優化
七、EVE-NG硬盤擴容,存儲海量鏡像this
八、EVE-NG定製我的鏡像,腳本快速導入spa
九、EVE-NG容納H3C、Huawei,吞併GNS33d
十、EVE-NG鏡像來啦!打造國內最大的EVE交流圈
十一、EVE-NG鏡像再次來襲,無所不能!
十二、EVE-NG鏡像增持,走上神壇!
1三、EVE-NG內存不夠?教您擴大虛擬內存!
1四、EVE-NG更新方便,不費勁兒!
1五、EVE-NG小衆鏡像,助力嚐鮮!
1六、EVE-NG體驗Seafile,拋棄10K/s網盤
1七、EVE-NG增添監控服務器鏡像,再上新高度!
1八、EVE-NG變身Learning Centre版本及重置Web用戶密碼
1九、EVE-NG優化非官方支持鏡像的接口顯示名稱
20、EVE-NG華麗登場Openstack鏡像,體驗私有云!
目前已優化的設備包含:
H3C vSR
H3C vFW
H3C vLB
HuaweiUSG
HillStone
以H3C vSR舉例
原接口名稱
終端執行命令
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中顯示的名稱吻合
注意:
老用戶直接執行命令便可!
新用戶在導入設備時,接口名稱就已優化,無需額外執行命令!
全部設備相應的執行命令:(每一個命令都有細微差異)
1、H3C 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
2、H3C 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
3、H3C 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
4、Huawei 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
5、HillStone:
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 | 森