嘟嘟社区

[经验] 群晖Virtual Machine Manager安装RoutesrOS


本帖最后由 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

  1. echo nameserver 223.5.5.5 > /etc/resolv.conf && echo nameserver 119.29.2

复制代码

3. CentOS7上dd RouterOS
    脚本下载后,解压扔到root下,给予0755权限后运行即可

  1. wget https://www.inkscloud.com/wp-content/uploads/2021/07/1627246350-7e08a36aac8e952.zip
  2. unzip 1627246350-7e08a36aac8e952.zip
  3. chmod +x RouterOS.s && ./RouterOS.sh

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

复制代码

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

以上全为借鉴,无任何原创
   https://post.smzdm.com/p/a5dn78pl
   https://www.right.com.cn/forum/forum-72-1.html
   https://www.inkscloud.com/archives/406
   https://www.inkscloud.com/wp-content/uploads/2021/07/1627246350-7e08a36aac8e952.zip[/code]

ros, routeros, 群晖
ubuntu DD centos
centos DD ros
我是真不会啊。。我问下。那为啥不直接装centos DD Ros呢?
太绕了,没有层次

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

在nas中装软路由不伦不类

jiaogeshaminghn 发表于 2022-1-5 23:04
太绕了,没有层次

首先应该是pve

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

生为何故 发表于 2022-1-5 22:52
ubuntu DD centos
centos DD ros
我是真不会啊。。我问下。那为啥不直接装centos DD Ros呢? …

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