centos7 dd ros系统教程/一键脚本

技术交流 无标签
0 61
sjsj
sjsj 普通会员 2025-07-18 14:18:11
用户等级:2级
<p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">准备条件:</span></p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">纯净centos7 系统(debian/ubuntu16通过类似)<br style="box-sizing: border-box;">更新系统:yum update<br style="box-sizing: border-box;">安装wget : yum install wget -y<br style="box-sizing: border-box;">关闭firewalld: systemctl stop firewalld.service &amp;&amp; systemctl disable firewalld.service</p><h2 class="wp-block-heading" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px; font-weight: 500; line-height: 1.2; font-size: 24px; position: relative; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; background-color: rgb(255, 255, 255);">一、通用单网卡方案 (适应于绝大多数VPS)</h2><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">下载镜像</span><br style="box-sizing: border-box;">wget https://download.mikrotik.com/routeros/6.48.3/chr-6.48.3.img.zip -O chr.img.zip</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">解压缩</span><br style="box-sizing: border-box;">gunzip -c chr.img.zip &gt; chr.img</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">挂载镜像</span><br style="box-sizing: border-box;">#注意:先用命令 fdisk -lu chr.img 查看start值是否为1,不是,则用当前数字 *512,替换下面命令中的offse值<br style="box-sizing: border-box;">mount -o loop,offset=512 chr.img /mnt</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">获取地址与网关 与 赋入变量</span><br style="box-sizing: border-box;">#<span style="box-sizing: border-box; font-weight: bolder;">有的网卡不是eth0 可以用ifconfig命令查看或者ip addr 查看,使用对应网卡命令即可</span></p><p class="pk-code-tools" data-pre-id="hljs-item-0" style="word-break: break-all; background-color: rgb(11, 28, 44); border-top-left-radius: 5px; border-top-right-radius: 5px; padding: 5px 10px 0px; display: flex; place-content: center space-between; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px;"><p class="dot" style="word-break: break-all;"><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; margin-right: 5px; background-color: rgb(255, 95, 86);"></i><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; margin-right: 5px; background-color: rgb(255, 189, 46);"></i><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; background-color: rgb(39, 201, 63);"></i></p><p class="actions" style="word-break: break-all;"><p style="word-break: break-all;"><span class="i fa fa-copy cp-code" data-clipboard-target="#hljs-item-0" style="font-family: &quot;Font Awesome 6 Free&quot;; font-weight: 900; color: rgb(248, 249, 250); cursor: pointer; transition: 0.3s;"></span></p></p></p><pre class="wp-block-code hljs language-ini" id="hljs-item-0" style="box-sizing: border-box; margin-bottom: 1rem; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; font-size: 15px; margin-top: 0px; padding: 10px; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; text-wrap-mode: wrap; overflow-wrap: break-word; color: rgb(203, 214, 226); background: rgb(11, 28, 44);"><table class="hljs-ln" style="caption-side: bottom;"><tbody style="box-sizing: border-box; border-style: solid; border-width: 0px;"><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="1" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;"><span class="hljs-attr" style="box-sizing: border-box; color: rgb(191, 191, 86);">ADDR0</span>=`ip addr show eth0 | grep global | cut -d<span class="hljs-string" style="box-sizing: border-box; color: rgb(86, 191, 139);">' '</span> -f <span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">6</span> | head -n <span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">1</span>`</td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="2" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;"><span class="hljs-attr" style="box-sizing: border-box; color: rgb(191, 191, 86);">ADDR0</span>=`ip addr show ens3 | grep global | cut -d<span class="hljs-string" style="box-sizing: border-box; color: rgb(86, 191, 139);">' '</span> -f <span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">6</span> | head -n <span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">1</span>`</td></tr></tbody></table></pre><p class="pk-code-tools" data-pre-id="hljs-item-1" style="word-break: break-all; background-color: rgb(11, 28, 44); border-top-left-radius: 5px; border-top-right-radius: 5px; padding: 5px 10px 0px; display: flex; place-content: center space-between; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px;"><p class="dot" style="word-break: break-all;"><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; margin-right: 5px; background-color: rgb(255, 95, 86);"></i><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; margin-right: 5px; background-color: rgb(255, 189, 46);"></i><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; background-color: rgb(39, 201, 63);"></i></p><p class="actions" style="word-break: break-all;"><p style="word-break: break-all;"><span class="i fa fa-copy cp-code" data-clipboard-target="#hljs-item-1" style="font-family: &quot;Font Awesome 6 Free&quot;; font-weight: 900; color: rgb(248, 249, 250); cursor: pointer; transition: 0.3s;"></span></p></p></p><pre class="wp-block-code hljs language-ini" id="hljs-item-1" style="box-sizing: border-box; margin-bottom: 1rem; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; font-size: 15px; margin-top: 0px; padding: 10px; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; text-wrap-mode: wrap; overflow-wrap: break-word; color: rgb(203, 214, 226); background: rgb(11, 28, 44);"><span class="hljs-attr" style="box-sizing: border-box; color: rgb(191, 191, 86);">GATE0</span>=`ip route list | grep default | cut -d<span class="hljs-string" style="box-sizing: border-box; color: rgb(86, 191, 139);">' '</span> -f <span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">3</span>`</pre><p class="pk-code-tools" data-pre-id="hljs-item-2" style="word-break: break-all; background-color: rgb(11, 28, 44); border-top-left-radius: 5px; border-top-right-radius: 5px; padding: 5px 10px 0px; display: flex; place-content: center space-between; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px;"><p class="dot" style="word-break: break-all;"><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; margin-right: 5px; background-color: rgb(255, 95, 86);"></i><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; margin-right: 5px; background-color: rgb(255, 189, 46);"></i><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; background-color: rgb(39, 201, 63);"></i></p><p class="actions" style="word-break: break-all;"><p style="word-break: break-all;"><span class="i fa fa-copy cp-code" data-clipboard-target="#hljs-item-2" style="font-family: &quot;Font Awesome 6 Free&quot;; font-weight: 900; color: rgb(248, 249, 250); cursor: pointer; transition: 0.3s;"></span></p></p></p><pre class="wp-block-code hljs language-css" id="hljs-item-2" style="box-sizing: border-box; margin-bottom: 1rem; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; font-size: 15px; margin-top: 0px; padding: 10px; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; text-wrap-mode: wrap; overflow-wrap: break-word; color: rgb(203, 214, 226); background: rgb(11, 28, 44);">mkdir -<span class="hljs-selector-tag" style="box-sizing: border-box; color: rgb(191, 139, 86);">p</span> /mnt/rw</pre><p class="pk-code-tools" data-pre-id="hljs-item-3" style="word-break: break-all; background-color: rgb(11, 28, 44); border-top-left-radius: 5px; border-top-right-radius: 5px; padding: 5px 10px 0px; display: flex; place-content: center space-between; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px;"><p class="dot" style="word-break: break-all;"><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; margin-right: 5px; background-color: rgb(255, 95, 86);"></i><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; margin-right: 5px; background-color: rgb(255, 189, 46);"></i><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; background-color: rgb(39, 201, 63);"></i></p><p class="actions" style="word-break: break-all;"><p style="word-break: break-all;"><span class="i fa fa-copy cp-code" data-clipboard-target="#hljs-item-3" style="font-family: &quot;Font Awesome 6 Free&quot;; font-weight: 900; color: rgb(248, 249, 250); cursor: pointer; transition: 0.3s;"></span></p></p></p><pre class="wp-block-code hljs language-bash" id="hljs-item-3" style="box-sizing: border-box; margin-bottom: 1rem; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; font-size: 15px; margin-top: 0px; padding: 10px; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; text-wrap-mode: wrap; overflow-wrap: break-word; color: rgb(203, 214, 226); background: rgb(11, 28, 44);"><table class="hljs-ln" style="caption-side: bottom;"><tbody style="box-sizing: border-box; border-style: solid; border-width: 0px;"><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="1" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;">\<span class="hljs-built_in" style="box-sizing: border-box; color: rgb(86, 139, 191);">echo</span> <span class="hljs-string" style="box-sizing: border-box; color: rgb(86, 191, 139);">"/ip address add address=<span class="hljs-variable" style="box-sizing: border-box; color: rgb(191, 139, 86);">$ADDR0</span> interface=[/interface ethernet find where name=ether1]</span></td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="2" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;"><span class="hljs-string" style="box-sizing: border-box; color: rgb(86, 191, 139);">/ip route add gateway=<span class="hljs-variable" style="box-sizing: border-box; color: rgb(191, 139, 86);">$GATE0</span></span></td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="3" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;"><span class="hljs-string" style="box-sizing: border-box; color: rgb(86, 191, 139);">"</span> &gt; /mnt/rw/autorun.scr</td></tr></tbody></table></pre><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">卸载镜像</span></p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">umount /mnt</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">立即重新挂载所有的文件系统为只读</span></p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">echo u &gt; /proc/sysrq-trigger</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">DD ros镜像</span>(有的机器硬盘并不是/dev/sda而是/dev/vda,需要提前使用fdisk -lu)</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">dd if=chr.img bs=1024 of=/dev/vda<br style="box-sizing: border-box;">reboot<br style="box-sizing: border-box;">(reboot失效可用下面命令)<br style="box-sizing: border-box;"><span style="box-sizing: border-box; font-weight: bolder;">立即重新启动机器</span></p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">echo b &gt; /proc/sysrq-trigger</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">安装好之后用有vnc的可以登录console看到安装界面,默认账号是admin,默认密码是空。<span style="box-sizing: border-box; font-weight: bolder;">尽快登录修改密码</span>。</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">一键脚本</span></p><p class="pk-code-tools" data-pre-id="hljs-item-4" style="word-break: break-all; background-color: rgb(11, 28, 44); border-top-left-radius: 5px; border-top-right-radius: 5px; padding: 5px 10px 0px; display: flex; place-content: center space-between; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px;"><p class="dot" style="word-break: break-all;"><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; margin-right: 5px; background-color: rgb(255, 95, 86);"></i><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; margin-right: 5px; background-color: rgb(255, 189, 46);"></i><i style="display: inline-block; width: 12px; height: 12px; border-radius: 6px; background-color: rgb(39, 201, 63);"></i></p><p class="actions" style="word-break: break-all;"><p style="word-break: break-all;"><span class="i fa fa-copy cp-code" data-clipboard-target="#hljs-item-4" style="font-family: &quot;Font Awesome 6 Free&quot;; font-weight: 900; color: rgb(248, 249, 250); cursor: pointer; transition: 0.3s;"></span></p></p></p><pre class="wp-block-code hljs language-perl" id="hljs-item-4" style="box-sizing: border-box; margin-bottom: 1rem; font-family: SFMono-Regular, Menlo, Monaco, Consolas, &quot;Liberation Mono&quot;, &quot;Courier New&quot;, monospace; font-size: 15px; margin-top: 0px; padding: 10px; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; text-wrap-mode: wrap; overflow-wrap: break-word; color: rgb(203, 214, 226); background: rgb(11, 28, 44);"><table class="hljs-ln" style="caption-side: bottom;"><tbody style="box-sizing: border-box; border-style: solid; border-width: 0px;"><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="1" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;">wget https:<span class="hljs-regexp" style="box-sizing: border-box; color: rgb(86, 139, 191);">//d</span>ownload.mikrotik.com/routeros/<span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">6.48</span>.<span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">3</span>/<span class="hljs-keyword" style="box-sizing: border-box; color: rgb(191, 86, 139);">chr</span>-<span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">6.48</span>.<span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">3</span>.img.zip -O chr.img.zip &amp;&amp; \</td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="2" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;">gunzip -c chr.img.zip &gt; chr.img &amp;&amp; \</td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="3" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;">mount -o loop,offset=<span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">512</span> chr.img /mnt &amp;&amp; \</td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="4" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;">ADDR<span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">0</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(86, 191, 139);">`ip addr show eth0 | grep global | cut -d' ' -f 6 | head -n 1`</span> &amp;&amp; \</td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="5" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;">GATE<span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">0</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(86, 191, 139);">`ip route list | grep default | cut -d' ' -f 3`</span> &amp;&amp; \</td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="6" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;"><span class="hljs-keyword" style="box-sizing: border-box; color: rgb(191, 86, 139);">mkdir</span> -p /mnt/rw &amp;&amp; \</td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="7" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;">echo <span class="hljs-string" style="box-sizing: border-box; color: rgb(86, 191, 139);">"/ip address add address=$ADDR0 interface=[/interface ethernet find where name=ether1]</span></td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="8" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;"><span class="hljs-string" style="box-sizing: border-box; color: rgb(86, 191, 139);">/ip route add gateway=$GATE0</span></td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="9" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;"><span class="hljs-string" style="box-sizing: border-box; color: rgb(86, 191, 139);">"</span> &gt; <span class="hljs-regexp" style="box-sizing: border-box; color: rgb(86, 139, 191);">/mnt/r</span>w/autorun.scr &amp;&amp; \</td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="10" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;">umount /mnt &amp;&amp; \</td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="11" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;">echo u &gt; <span class="hljs-regexp" style="box-sizing: border-box; color: rgb(86, 139, 191);">/proc/s</span>ysrq-trigger &amp;&amp; \</td></tr><tr style="box-sizing: border-box; border-style: solid; border-width: 0px;"><td class="hljs-ln-line hljs-ln-code" data-line-number="12" style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px;">dd <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(191, 86, 139);">if</span>=chr.img bs=<span class="hljs-number" style="box-sizing: border-box; color: rgb(191, 191, 86);">1024</span> of=<span class="hljs-regexp" style="box-sizing: border-box; color: rgb(86, 139, 191);">/dev/</span>vda &amp;&amp; reboot</td></tr></tbody></table></pre><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">常见问题:</span><br style="box-sizing: border-box;">有些D完死活启不动连不上 是因为UEFI的缘故,跟脚本无关 请改用 ROS7.0Beta 版本 支持UEFI启动<br style="box-sizing: border-box;">wget https://download.mikrotik.com/routeros/7.0beta5/chr-7.0beta5.img.zip -O chr.img.zip</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">Ros 授权相关</span></p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">Ros 系统是商业软件 ,本身是需要授权的,在没有授权的情况下使用,网卡限制速率(<span style="box-sizing: border-box; font-weight: bolder;">1Mbps</span>),不过Ros CHR版本是支持免费试用的,只需要去官方网站&nbsp;<a href="https://mikrotik.com/client" target="_blank" rel="nofollow" style="box-sizing: border-box; color: rgb(28, 96, 243); transition: 0.3s;">https://mikrotik.com/client</a>&nbsp;注册一个帐号,然后去邮箱获取帐号通过验证,接着返回到Ros系统&nbsp; 进入 System &gt; License&nbsp;&gt; generate new id 填入你刚刚注册的帐号登录即可,试用期是两个月时长,只要系统不进行更新,是可以一直免费试用下去的,功能不受限制。</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">SSH登录</span><br style="box-sizing: border-box;">一般NAT小鸡DD完ros后会自动设置好网络这些,只需要重启机器,然后使用xshell or putty ,连接NAT的IP,SSH端口号,用户名为admin,密码为空;登录到ros路由管理界面,输入/ip service set winbox port=映射端口,&nbsp;可重新映射winbox端口;</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;"><span style="box-sizing: border-box; font-weight: bolder;">使用winbox登录ros系统</span>&nbsp;<span style="box-sizing: border-box; font-weight: bolder;">并修改默认用户</span>(ssh客户端登录为IP地址,ssh端口号,初始用户名和密码)</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">winbox&nbsp;<a href="https://download.mikrotik.com/winbox/3.28/winbox64.exe" target="_blank" rel="nofollow" style="box-sizing: border-box; color: rgb(28, 96, 243); transition: 0.3s;">下载链接</a><br style="box-sizing: border-box;">默认登录名为:admin 默认密码为: 空<br style="box-sizing: border-box;">登录之后尽快修改权限,可新增用户(system&gt;users add),然后禁用原admin用户;或修改必要端口(IP&gt;firewall&gt;service ports)<br style="box-sizing: border-box;"><span style="box-sizing: border-box; font-weight: bolder;">如果你使用的MAC地址登录的话,不需要输入端口</span>。</p><br><h2 class="wp-block-heading" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px; font-weight: 500; line-height: 1.2; font-size: 24px; position: relative; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box; font-weight: bolder;">ROS 常用命令:</span></h2><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">1、查看网卡接口: /interface&nbsp; print</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">2、给网口添加IP地址: /ip address add address=192.168.1.254/24 interface=ether1</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">3、移除接口IP地址:  /ip address remove 0</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">4、重启系统:  /system reboot</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">5、关闭系统:  /system shutdown</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">6、恢复原始状态:  /system reset</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">7、查看IP配置:  /ip export    或&nbsp; /ip address print</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">8、查看授权:  /system license print</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">9、重新映射winbox端口: /ip service set winbox port=映射端口</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">10、查看网卡名称: interface print</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">11、配置IP地址和网关: /ip address add address=IP地址/掩码 interface=网卡名</p><p style="box-sizing: border-box; word-break: break-all; line-height: 2; color: rgb(52, 58, 64); font-family: system-ui, -apple-system, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, &quot;Noto Sans&quot;, &quot;Liberation Sans&quot;, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;; font-size: 15px; background-color: rgb(255, 255, 255); margin-top: 10px !important; margin-bottom: 10px !important;">/ip route add gateway=网关地址</p>
楼主签名:
回帖
回复列表