立即注册  找回密码
 立即注册
CeraNetworksBGVM服务器主机交流会员请立即修改密码Sharktech防护
查看: 63|回复: 4

群晖Virtual Machine Manager安装RoutesrOS

[复制链接]

群晖Virtual Machine Manager安装RoutesrOS

[复制链接]

9

主题

142

回帖

425

积分

中级会员

积分
425
fs6738

9

主题

142

回帖

425

积分

中级会员

积分
425
2022-1-5 22:43:30 | 显示全部楼层 |阅读模式
本帖最后由 fs6738 于 2022-1-5 22:48 编辑

主要思路:VMM安装CentOS7后,dd RouterOS


个人操作,略绕,介意的可以直接centos7 --> ros:

1. 群晖安装Virtual Machine Manager.
2. Ubuntu官网下载完整版ISO镜像Ubuntu18 server //
    安装完成后,ssh登录;如果不能连接,可以vnc手动安装openssh server,重启后连接ssh //
    dd centos7 //

    安装好linux建议先修改为国内dns
[ol]
  • echo nameserver 223.5.5.5 > /etc/resolv.conf && echo nameserver 119.29.2[/ol]复制代码
    3. CentOS7上dd RouterOS
        脚本下载后,解压扔到root下,给予0755权限后运行即可

    [ol]
  • wget https://www.inkscloud.com/wp-content/uploads/2021/07/1627246350-7e08a36aac8e952.zip
  • unzip 1627246350-7e08a36aac8e952.zip
  • chmod +x RouterOS.s && ./RouterOS.sh

    1. [*]#!/bin/bash
    2. [*]
    3. [*]# VPS2RouterOS
    4. [*]# https://github.com/Jamesits/vps2routeros
    5. [*]# This script will cause permanent data loss
    6. [*]# Please read the documentation prior to running this
    7. [*]# You have been warned
    8. [*]
    9. [*]# ======================= please change these =================================
    10. [*]# your network interface to internet
    11. [*]# this is used to auto configure IPv4 after reboot
    12. [*]# (this may not work for every device)
    13. [*]# eth0 for most devices, ens3 for Vultr
    14. [*]# you can use `ip addr` or `ifconfig` to find out this
    15. [*]# default: the interface on the default route
    16. [*]MAIN_INTERFACE=$(ip route list | grep default | cut -d' ' -f 5)
    17. [*]
    18. [*]# HDD device (not partition)
    19. [*]# May not be compatible with SCSI drives; see official document of RouterOS CHR
    20. [*]# you can use `lsblk` to find out this
    21. [*]# default: the disk with a partition mounted to `/`
    22. [*]DISK=$(mount | grep ' / ' | cut -d' ' -f1 | sed 's/[0-9]*$//g')
    23. [*]
    24. [*]# get IPv4 address in IP-CIDR format
    25. [*]# do not modify unless you know what you are doing
    26. [*]ADDRESS=$(ip addr show $MAIN_INTERFACE | grep global | cut -d' ' -f 6 | head -n 1)
    27. [*]
    28. [*]# get gateway IP
    29. [*]# do not modify unless you know what you are doing
    30. [*]GATEWAY=$(ip route list | grep default | cut -d' ' -f 3)
    31. [*]
    32. [*]# URL to RouterOS CHR
    33. [*]ROUTEROS_URL=https://download.mikrotik.com/routeros/6.48.1/chr-6.48.1.img.zip
    34. [*]
    35. [*]# Note: you can customize commands to be executed when RouterOS initializes.
    36. [*]# Search `Auto configure script` below
    37. [*]# do not modify that unless you know what you are doing
    38. [*]
    39. [*]# ======================= no need to modify below ============================
    40. [*]
    41. [*]set -euo pipefail
    42. [*]
    43. [*]# check if this script is running under root
    44. [*]if [[ $EUID -ne 0 ]]; then
    45. [*]   echo "This script must be run as root" 1>&2
    46. [*]   exit 1
    47. [*]fi
    48. [*]
    49. [*]# https://stackoverflow.com/a/3232082/2646069
    50. [*]confirm() {
    51. [*]    # call with a prompt string or use a default
    52. [*]    read -r -p "${1:-Are you sure? [y/N]} " response
    53. [*]    case "$response" in
    54. [*]        [yY][eE][sS]|[yY])
    55. [*]            true
    56. [*]            ;;
    57. [*]        *)
    58. [*]            false
    59. [*]            ;;
    60. [*]    esac
    61. [*]}
    62. [*]
    63. [*]echo -e "Please confirm the settings:"
    64. [*]echo -e "Installation destination: ${DISK}"
    65. [*]echo -e "Network information:"
    66. [*]echo -e "\tinterface: ${MAIN_INTERFACE}"
    67. [*]echo -e "\tIPv4 address: ${ADDRESS}"
    68. [*]echo -e "\tIPv4 gateway: ${GATEWAY}"
    69. [*]echo -e "\nIf you continue, your disk will be formatted and no data will be preserved."
    70. [*]
    71. [*]confirm || exit -1
    72. [*]
    73. [*]echo "installing packages"
    74. [*]yum -y install wget
    75. [*]
    76. [*]echo "download image"
    77. [*]wget ${ROUTEROS_URL} -O chr.img.zip
    78. [*]
    79. [*]echo "unzip image"
    80. [*]gunzip -c chr.img.zip > chr.img
    81. [*]
    82. [*]echo "mount image"
    83. [*]mount -o loop,offset=512 chr.img /mnt
    84. [*]
    85. [*]echo "Get address and gateway and assign variable"
    86. [*]
    87. [*]mkdir -p /mnt/rw
    88. [*]\echo "/ip address add address=${ADDRESS} interface=[/interface ethernet find where name=ether1]
    89. [*]/ip route add gateway=${GATEWAY}
    90. [*]" > /mnt/rw/autorun.scr
    91. [*]
    92. [*]echo "Unmount the image"
    93. [*]umount /mnt
    94. [*]
    95. [*]echo "Your old OS is being wiped while running, good luck"
    96. [*]echo "If the device stopped responding for more than 30 minutes, please issue a reboot manually"
    97. [*]
    98. [*]sleep 5
    99. [*]
    100. [*]echo "write disk"
    101. [*]echo u > /proc/sysrq-trigger
    102. [*]
    103. [*]echo "sync disk"
    104. [*]dd if=chr.img bs=1024 of=${DISK}
    105. [*]
    106. [*]echo "wait a while"
    107. [*]sleep 5 || echo "please wait 5 seconds and execute\n\techo b > /proc/sysrq-trigger\nmanually, or hard reset device"
    108. [*]
    109. [*]echo "rebooting"
    110. [*]reboot
    111. [*][/ol]复制代码

    112. 4.winBox搜索局域网找到RouterOS,点击connet连接配置


    113. 以上全为借鉴,无任何原创
    114.    https://post.smzdm.com/p/a5dn78pl
    115.    https://www.right.com.cn/forum/forum-72-1.html
    116.    https://www.inkscloud.com/archives/406
    117.    https://www.inkscloud.com/wp-content/uploads/2021/07/1627246350-7e08a36aac8e952.zip
    复制代码
  • 回复

    使用道具 举报

    24

    主题

    220

    回帖

    670

    积分

    高级会员

    积分
    670
    生为何故

    24

    主题

    220

    回帖

    670

    积分

    高级会员

    积分
    670
    2022-1-5 22:52:36 | 显示全部楼层
    ubuntu DD centos
    centos DD ros
    我是真不会啊。。我问下。那为啥不直接装centos DD Ros呢?
    回复

    使用道具 举报

    278

    主题

    643

    回帖

    2574

    积分

    金牌会员

    积分
    2574
    jiaogeshaminghn

    278

    主题

    643

    回帖

    2574

    积分

    金牌会员

    积分
    2574
    2022-1-5 23:04:47 | 显示全部楼层
    太绕了,没有层次

    首先应该是pve
    然后才应该是群晖主nas
    routeos主软路由。

    在nas中装软路由不伦不类
    回复

    使用道具 举报

    9

    主题

    142

    回帖

    425

    积分

    中级会员

    积分
    425
    fs6738 楼主

    9

    主题

    142

    回帖

    425

    积分

    中级会员

    积分
    425
    2022-1-5 23:29:52 | 显示全部楼层

    jiaogeshaminghn 发表于 2022-1-5 23:04

    太绕了,没有层次

    首先应该是pve

    告诉我,为什么要搞个垃圾pve?
    服务器装windows不香吗?
    回复

    使用道具 举报

    9

    主题

    142

    回帖

    425

    积分

    中级会员

    积分
    425
    fs6738 楼主

    9

    主题

    142

    回帖

    425

    积分

    中级会员

    积分
    425
    2022-1-5 23:04:00 | 显示全部楼层

    生为何故 发表于 2022-1-5 22:52

    ubuntu DD centos
    centos DD ros
    我是真不会啊。。我问下。那为啥不直接装centos DD Ros呢? ...

    那你仔细看下第二句话啊
    我VMM常备装ubuntu,debian,;但是centos最烂的系统,如果没有必要,当然不安装
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    Archiver|小黑屋|HS2V主机综合交流论坛

    GMT+8, 2024-11-23 01:23 , Processed in 0.069110 second(s), 4 queries , Gzip On, Redis On.

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表