在任意Ubuntu VPS上覆盖安装RouterOS的脚本

 梦缘人   2018-11-28 13:07   422 人阅读  0 条评论
会省钱

此脚本会导致你的服务器硬盘数据全部丢失且无法恢复。可能导致你再也无法连接上你的服务器。请慎重使用。请在服务商提供控制台访问的前提下使用。已经测试过的云服务提供商:阿里云,腾讯云,DigitalOcean,Vultr,云朵.io,DevCapsule。其中部分需要更改开头的配置才能使用。

已知不能用的云服务提供商:Bandwagon(硬盘协议不兼容)

注:

在运行脚本之前请把系统重装为Ubuntu 16.04或更高。不兼容低版本Ubuntu以及其它发行版。

安装完后请使用 用户名:admin 密码:空(那一栏留空)登录(网页、WinBox或者控制台都可以),立即更改密码(注意中文Windows用户请全程把输入法设为英文),然后在system->packages更新到最新版本RouterOS。

1.jpg

Bash

<span class="prism-token prism-function">wget</span> http://download2.mikrotik.com/routeros/6.36.4/chr-6.36.4.img.zip -O chr.img.zip  <span class="prism-token prism-operator">&amp;&amp;</span> \  
gunzip -c chr.img.zip <span class="prism-token prism-operator">&gt;</span> chr.img  <span class="prism-token prism-operator">&amp;&amp;</span> \  
<span class="prism-token prism-function">mount</span> -o loop,offset<span class="prism-token prism-operator">=</span>33554944 chr.img /mnt <span class="prism-token prism-operator">&amp;&amp;</span> \  
ADDRESS<span class="prism-token prism-operator">=</span>`ip addr show eth0 <span class="prism-token prism-operator">|</span> <span class="prism-token prism-function">grep</span> global <span class="prism-token prism-operator">|</span> <span class="prism-token prism-function">cut</span> -d<span class="prism-token prism-string">' '</span> -f 6 <span class="prism-token prism-operator">|</span> <span class="prism-token prism-function">head</span> -n 1<span class="prism-token prism-variable">` <span class="prism-token prism-operator">&amp;&amp;</span> \  
GATEWAY<span class="prism-token prism-operator">=</span>`</span>ip route list <span class="prism-token prism-operator">|</span> <span class="prism-token prism-function">grep</span> default <span class="prism-token prism-operator">|</span> <span class="prism-token prism-function">cut</span> -d<span class="prism-token prism-string">' '</span> -f 3` <span class="prism-token prism-operator">&amp;&amp;</span> \  
<span class="prism-token prism-keyword">echo</span> <span class="prism-token prism-string">"/ip address add address=<span class="prism-token prism-variable">$ADDRESS</span> interface=[/interface ethernet find where name=ether1]  
/ip route add gateway=<span class="prism-token prism-variable">$GATEWAY</span>  
 "</span> <span class="prism-token prism-operator">&gt;</span> /mnt/rw/autorun.scr <span class="prism-token prism-operator">&amp;&amp;</span> \  
<span class="prism-token prism-function">umount</span> /mnt <span class="prism-token prism-operator">&amp;&amp;</span> \  
<span class="prism-token prism-keyword">echo</span> u <span class="prism-token prism-operator">&gt;</span> /proc/sysrq-trigger <span class="prism-token prism-operator">&amp;&amp;</span> \  
<span class="prism-token prism-function">dd</span> if<span class="prism-token prism-operator">=</span>chr.img bs<span class="prism-token prism-operator">=</span>1024 of<span class="prism-token prism-operator">=</span>/dev/vda <span class="prism-token prism-operator">&amp;&amp;</span> \  
<span class="prism-token prism-function">reboot</span>
本文地址:https://www.xfnz.net/898.html
版权声明:本文为原创文章,版权归 梦缘人 所有,欢迎分享本文,转载请保留出处!

 发表评论


表情