ESXI利用错误小结
ESXI 利用+错误小结
环境:
ESXI + 群晖 + Win10
群晖开启SMB服务,Windows开启SMB功能并映射
为了安全起见,请关闭绝大部分端口或者192.168.0.0/24
异常:
利用工具:
刚开始上手经常手残 写了一个脚本,可以自己对着改一改
esxi.bat
@echo off
chcp 65001
setlocal EnableDelayedExpansion
rem **********************
echo 是否复制关机脚本
rem scp autoshutdown.sh esxi:/vmfs/volumes/数据桶名字/BAC
echo 正在复制密钥
scp %homepath%\.ssh\id_rsa.pub esxi:/etc/ssh/keys-root/authorized_keys # 用户SSH密钥
echo 正在复制证书
scp rui.key esxi:/etc/vmware/ssl/rui.key # 需要在当前文件夹放你的SSL证书NGINX版
scp rui.crt esxi:/etc/vmware/ssl/rui.crt
echo 正在执行备份脚本
ssh esxi "/sbin/auto-backup.sh" # 自动备份设置
echo 执行完成
local.sh
#!/bin/sh
# local configuration options
# Note: modify at your own risk! If you do/use anything in this
# script that is not part of a stable API (relying on files to be in
# specific places, specific tools, specific output, etc) there is a
# possibility you will end up with a broken system after patching or
# upgrading. Changes are not supported unless under direction of
# VMware support.
# Note: This script will not be run when UEFI secure boot is enabled.
/bin/kill $(cat /var/run/crond.pid)
/bin/echo '25 15 * * * /vmfs/volumes/数据桶名字/autoshutdown.sh' >> /var/spool/cron/crontabs/root
/usr/lib/vmware/busybox/bin/busybox crond
exit 0
autoshutdown.sh
#!/bin/sh
# vim-cmd vmsvc/getallvms 查询所有已配置的虚拟机,可获得VMID
vim-cmd vmsvc/power.off 1 # 发送关机信号
vim-cmd vmsvc/power.off 3
# vim-cmd vmsvc/power.off 6
sleep 5m # 确定关机后在关闭电源
/sbin/poweroff
别忘了这些
chmod + x /vmfs/volumes/数据桶名字/autoshutdown.sh
/sbin/auto-backup.sh
/vmfs/volumes/数据桶名字/autoshutdown.sh 试试看能不能正确关机,不能需要在各操作做系统配置定时关机
玩机小技巧
-
设置交换缓存
-
多网卡
-
时间设置 ntp.aliyun.com ESXI 默认使用UTC时间 +8
-
群晖
- Docker
- Bitwardenrs
- 你懂的!!!
- 注意不要泄露端口
- 使用端口触发
- NGINX
- Bitwardenrs
- SMB
- VMM
- Docker
纵饮孤独,程序员的世界是孤独的,这个平台让我们聚集在一起纵饮百年孤独