youto`blog - openstack
type: channel
link: http://www.youto.club/index.php/category/openstack/
items: 准备 kolla 离线部署包
items: Deploy OpenStack offline based on Kolla
items: OpenStack-Pike 搭建之Cinder（七）
items: OpenStack-Pike 搭建之Dashboard（六）
items: OpenStack-Pike 搭建之Neutron（五）
items: OpenStack-Pike 搭建之Nova（四）
items: OpenStack-Pike 搭建之Glance（三）
items: OpenStack-Pike 搭建之Keystone（二）
items: OpenStack-Pike 搭建之基础环境（一）
items: Hyper-V的简单使用

准备 kolla 离线部署包
type: item
date: 2023-05-06T05:24:00+00:00
description: 分析需要的文件 RPM包 容器镜像 pip 包 流程 1、配置完yum源，设置开启缓存。手动部署完，制作 repo 源 2、手动部署完，将所有容器打包 3、手动部署完，统计 python模块包 写到 requirements.txt，下载收集并编写安装脚本。 容器镜像 全部导出 docker save `docker images --format "{{.Repository}}:{{.Tag}}"` | gzip > kolla_centos_train_min.tar.gz 导入 docker load -i kolla_centos_train_min.tar.gz rpm 软件包 [root@kolla ~]# mkdir /repo [root@kolla ~]# cat /etc/yum.conf [main] cachedir=/repo keepcache=1 ... [root@kolla ~]# yum install -y createrepo [root@kolla ~]# cd /repo [root@kolla repo]# mkdir -p kolla_centos_train_rpm/Packages [root@kolla repo]# cp -ra */packages/* kolla_centos_train_rpm/Packages [root@kolla repo]# cd kolla_centos_train_rpm [root@kolla kolla_centos_train_rpm]# createrepo ./ [root@kolla kolla_centos_train_rpm]# ls Packages repodata [root@kolla kolla_centos_train_rpm]# cd /repo [root@kolla repo]# tar cfz kolla_centos_train_rpm.tar.gz kolla_centos_train_rpm pip 依赖包 [root@kolla kolla_centos_train_whl]# cat requirements.txt setuptools==22.0.5 pip==20.3.4 wheel kolla-ansible==9.1.0 [root@kolla kolla_centos_train_whl]# mkdir packages [root@kolla kolla_centos_train_whl]# pip download -d packages -r requirements.txt [root@kolla kolla_centos_train_whl]# cat install.sh #!/bin/bash pip install --no-index --find-links=./packages/ setuptools==22.0.5 pip install --no-index --find-links=./packages/ pip==20.3.4 pip install --no-index --find-links=./packages/ wheel pip install --no-index --find-links=./packages/ kolla-ansible==9.1.0 --ignore-installed PyYAML [root@kolla ~]# tar cfz kolla_centos_train_whl.tar.gz kolla_centos_train_whl/

Deploy OpenStack offline based on Kolla
type: item
date: 2023-05-06T05:09:00+00:00
description: Deploy OpenStack offline based on Kolla 系统：CentOS Linux release 7.9.2009 (Core) 规格：4C8G 存储 50G 系统盘 20G 数据盘（cinder） 网络规划 ens33 仅主机（管理网、ip：192.168.100.10/24） ens34 NAT（业务网、CICR：192.168.10.0/24 、gw：192.168.10.2） VIP 192.168.100.100 初始化环境 1、修改主机名 hosts [root@kolla ~]# hostnamectl set-hostname kolla rabbitmq 可能需要能够进行主机名解析 2、配置网络 [root@kolla ~]# cat > /etc/sysconfig/network-scripts/ifcfg-ens34 <<EOF NAME=ens34 DEVICE=ens34 TYPE=Ethernet ONBOOT="yes" BOOTPROTO="none" EOF [root@kolla ~]# nmcli con reload && nmcli con up ens34 准备两块网卡、ens34 为 业务网络 3、上传软件包 99cloud_skyline.tar.gz // skyline 容器镜像 kolla_centos_train_min.tar.gz // 容器镜像（最小化） kolla_centos_train_rpm.tar.gz // 依赖软件包 kolla_centos_train_whl.tar.gz // pip依赖包 4、创建 lvm [root@kolla ~]# pvcreate /dev/sdb [root@kolla ~]# vgcreate cinder-volumes /dev/sdb 注：卷组名为 cinder_volume_group 参数 5、配置 源 配置 yum [root@kolla ~]# mkdir /etc/yum.repos.d/bak [root@kolla ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak [root@kolla ~]# tar xf kolla_centos_train_rpm.tar.gz -C /opt/ [root@kolla ~]# cat > /etc/yum.repos.d/local.repo << EOF [kolla] name=kolla - acha baseurl=file:///opt/kolla_centos_train_rpm/ gpgcheck=0 enabled=1 EOF 安装 依赖 [root@kolla ~]# yum install -y python-devel libffi-devel gcc openssl-devel \ libselinux-python python2-pip python-pbr ansible 安装常用软件 [root@kolla ~]# yum install -y vim unzip net-tools lrzsz tree bash-completion 部署环境 1、安装 kolla-ansible [root@kolla ~]# tar xf kolla_centos_train_whl.tar.gz [root@kolla ~]# cd kolla_centos_train_whl [root@kolla kolla_centos_train_whl]# ./install.sh 2、配置 准备配置文件 [root@kolla kolla_centos_train_whl]# mkdir -p /etc/kolla [root@kolla kolla_centos_train_whl]# cd /etc/kolla [root@kolla kolla]# chown $USER:$USER /etc/kolla [root@kolla kolla]# cp -r /usr/share/kolla-ansible/etc_examples/kolla/* /etc/kolla [root@kolla kolla]# cp /usr/share/kolla-ansible/ansible/inventory/* /etc/kolla 修改ansible配置文件 [root@kolla kolla]# cat << EOF | sed -i '/^\[defaults\]$/ r /dev/stdin' /etc/ansible/ansible.cfg ho…

OpenStack-Pike 搭建之Cinder（七）
type: item
date: 2022-07-19T02:14:00+00:00
description: 概述 OpenStack块存储服务(cinder)为虚拟机添加持久的存储，块存储提供一个基础设施为了管理卷，以及和OpenStack计算服务交互，为实例提供卷。此服务也会激活管理卷的快照和卷类型的功能。 块存储服务通常包含下列组件： cinder-api 接受API请求，并将其路由到cinder-volume执行。 cinder-volume 与块存储服务和例如cinder-scheduler的进程进行直接交互。它也可以与这些进程通过一个消息队列进行交互。cinder-volume服务响应送到块存储服务的读写请求来维持状态。它也可以和多种存储提供者在驱动架构下进行交互。 cinder-scheduler守护进程 选择最优存储提供节点来创建卷。其与nova-scheduler组件类似。 cinder-backup daemon cinder-backup服务提供任何种类备份卷到一个备份存储提供者。就像cinder-volume服务，它与多种存储提供者在驱动架构下进行交互。 消息队列 在块存储的进程之间路由信息。 安装并配置控制节点 先决条件 1、创建数据库 root 用户连接到数据库服务器 mysql -u root -p000000 创建 cinder 数据库 CREATE DATABASE cinder; 允许 cinder 数据库的cinder用户访问权限： GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY '000000'; GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY '000000'; 2、获取 admin 凭证 . admin-openrc 3、创建服务证书 创建一个 cinder 用户 openstack user create --domain default --password 000000 cinder 添加 admin 角色到 cinder 用户上 openstack role add --project service --user cinder admin 创建服务实体 openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2 openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3 创建服务API openstack endpoint create --region RegionOne \ volumev2 public http://controller:8776/v2/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev2 internal http://controller:8776/v2/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev2 admin http://controller:8776/v2/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev3 public http://controller:8776/v3/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev3 internal http://controller:8776/v3/%\(project_id\)s openstack endpoint create --region RegionOne \ volumev3 admin http://controller:8776/v3/%\(project_id\)s {collapse} {collapse-item label="CMD"} [root@openstack ~]# mysql -u root -p000000 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 379 Server version: 10.1.20-MariaDB MariaDB Server Co…

OpenStack-Pike 搭建之Dashboard（六）
type: item
date: 2022-07-14T09:51:00+00:00
description: Dashboard 安装和配置组件 1、安装软件包 yum install -y openstack-dashboard 2、配置 local_settings cp -a /etc/openstack-dashboard/local_settings /root/local_settings vim /etc/openstack-dashboard/local_settings # 仪表板在控制节点 OPENSTACK_HOST = "controller" # 允许主机访问仪表板 ALLOWED_HOSTS = ['*'] # 配置会话存储服务 memcached SESSION_ENGINE = 'django.contrib.sessions.backends.cache' CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': 'controller:11211', } } # 启用身份 API 版本 3 OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST # 启用对域的支持 OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True # 配置 API 版本 OPENSTACK_API_VERSIONS = { "identity": 3, "image": 2, "volume": 2, } # 配置为通过仪表板创建的用户的默认域：Default OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "Default" # 配置为通过仪表板创建的用户的默认角色：user OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user" # 如果选择网络选项 1，请禁用对第 3 层网络服务的支持 OPENSTACK_NEUTRON_NETWORK = { ... 'enable_router': False, 'enable_quotas': False, 'enable_distributed_router': False, 'enable_ha_router': False, 'enable_lb': False, 'enable_firewall': False, 'enable_vpn': False, 'enable_fip_topology_check': False, } {collapse} {collapse-item label="查看执行过程"} 配置 local_settings [root@controller ~]# cat /etc/openstack-dashboard/local_settings import os from django.utils.translation import ugettext_lazy as _ from openstack_dashboard.settings import HORIZON_CONFIG DEBUG = False WEBROOT = '/dashboard/' ALLOWED_HOSTS = ['*'] LOCAL_PATH = '/tmp' SECRET_KEY='04f3ac91f6f48932c88a' SESSION_ENGINE = 'django.contrib.sessions.backends.cache' CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': 'controller:11211', } } EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' OPENSTACK_HOST = "controller" OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True OPENSTACK_API_VERSIONS = { "identity": 3, "image": 2, "volume": 2, } OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "Default" OPENSTACK_KEYSTONE_DEFAULT_RO…

OpenStack-Pike 搭建之Neutron（五）
type: item
date: 2022-07-14T09:47:00+00:00
description: Neutron 安装和配置 控制节点 前置条件 1、创建数据库并授权 使用 root 用户登录数据库 mysql -u root -p000000 创建 neutron 数据库 CREATE DATABASE neutron; neutron 用户对 neutron数据库有所有权限 GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \ IDENTIFIED BY '000000'; GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \ IDENTIFIED BY '000000'; 2、获取 admin 凭证 . admin-openrc 3、创建服务凭证 创建 neutron 用户 openstack user create --domain default --password 000000 neutron 将 service项目 中的 neutron用户 设置为 admin角色 openstack role add --project service --user neutron admin 创建 neutron 服务实体 openstack service create --name neutron --description "OpenStack Networking" network 4、创建 网络服务 API端点 openstack endpoint create --region RegionOne network public http://controller:9696 openstack endpoint create --region RegionOne network internal http://controller:9696 openstack endpoint create --region RegionOne network admin http://controller:9696 {collapse} {collapse-item label="查看执行过程"} 前置条件 [root@controller ~]# mysql -u root -p000000 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 68 Server version: 10.1.20-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE neutron; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \ -> IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \ -> IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye [root@controller ~]# . admin-openrc [root@controller ~]# openstack user create --domain default --password-prompt neutron User Password: Repeat User Password: +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | bd11a70055…

OpenStack-Pike 搭建之Nova（四）
type: item
date: 2022-07-13T07:19:00+00:00
description: Nova 概述 Use OpenStack Compute to host and manage cloud computing systems. OpenStack Compute is a major part of an Infrastructure-as-a-Service (IaaS) system. The main modules are implemented in Python. OpenStack Compute interacts with OpenStack Identity for authentication; OpenStack Image service for disk and server images; and OpenStack Dashboard for the user and administrative interface. Image access is limited by projects, and by users; quotas are limited per project (the number of instances, for example). OpenStack Compute can scale horizontally on standard hardware, and download images to launch instances. OpenStack Compute consists of the following areas and their components: nova-api service Accepts and responds to end user compute API calls. The service supports the OpenStack Compute API, the Amazon EC2 API, and a special Admin API for privileged users to perform administrative actions. It enforces some policies and initiates most orchestration activities, such as running an instance. nova-api-metadata service Accepts metadata requests from instances. The nova-api-metadata service is generally used when you run in multi-host mode with nova-network installations. For details, see Metadata service in the Compute Administrator Guide. nova-compute service A worker daemon that creates and terminates virtual machine instances through hypervisor APIs. For example:XenAPI for XenServer/XCPlibvirt for KVM or QEMUVMwareAPI for VMwareProcessing is fairly complex. Basically, the daemon accepts actions from the queue and performs a series of system commands such as launching a KVM instance and updating its state in the database. nova-placement-api service Tracks the inventory and usage of each provider. For details, see Placement API. nova-scheduler service Takes a virtual machine instance request from the queue and determines on which compute server host it runs. nova-conductor module Mediates interactions between the nova-compute service and the database. It eliminates d…

OpenStack-Pike 搭建之Glance（三）
type: item
date: 2022-07-13T05:03:00+00:00
description: Glance 概述 The OpenStack Image service includes the following components: glance-api Accepts Image API calls for image discovery, retrieval, and storage. glance-registry Stores, processes, and retrieves metadata about images. Metadata includes items such as size and type. Database Stores image metadata and you can choose your database depending on your preference. Most deployments use MySQL or SQLite. Storage repository for image files Various repository types are supported including normal file systems (or any filesystem mounted on the glance-api controller node), Object Storage, RADOS block devices, VMware datastore, and HTTP. Note that some repositories will only support read-only usage. Metadata definition service A common API for vendors, admins, services, and users to meaningfully define their own custom metadata. This metadata can be used on different types of resources like images, artifacts, volumes, flavors, and aggregates. A definition includes the new property’s key, description, constraints, and the resource types which it can be associated with. 前置条件 创建 数据库并授权 1、使用 root用户登录数据库 mysql -u root -p000000 2、创建 glance 数据库 CREATE DATABASE glance; 3、授权 glance用户 对 glance数据库 所有权限 GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \ IDENTIFIED BY '000000'; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \ IDENTIFIED BY '000000'; {collapse} {collapse-item label="查看执行过程"} 前置条件 [root@controller ~]# mysql -u root -p000000 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 27 Server version: 10.1.20-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE glance; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \ -> IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON gl…

OpenStack-Pike 搭建之Keystone（二）
type: item
date: 2022-07-13T05:00:00+00:00
description: Keystone 概述 The OpenStack Identity service provides a single point of integration for managing authentication, authorization, and a catalog of services. The Identity service is typically the first service a user interacts with. Once authenticated, an end user can use their identity to access other OpenStack services. Likewise, other OpenStack services leverage the Identity service to ensure users are who they say they are and discover where other services are within the deployment. The Identity service can also integrate with some external user management systems (such as LDAP). Users and services can locate other services by using the service catalog, which is managed by the Identity service. As the name implies, a service catalog is a collection of available services in an OpenStack deployment. Each service can have one or many endpoints and each endpoint can be one of three types: admin, internal, or public. In a production environment, different endpoint types might reside on separate networks exposed to different types of users for security reasons. For instance, the public API network might be visible from the Internet so customers can manage their clouds. The admin API network might be restricted to operators within the organization that manages cloud infrastructure. The internal API network might be restricted to the hosts that contain OpenStack services. Also, OpenStack supports multiple regions for scalability. For simplicity, this guide uses the management network for all endpoint types and the default RegionOne region. Together, regions, services, and endpoints created within the Identity service comprise the service catalog for a deployment. Each OpenStack service in your deployment needs a service entry with corresponding endpoints stored in the Identity service. This can all be done after the Identity service has been installed and configured. The Identity service contains these components: Server A centralized server provides authentication and autho…

OpenStack-Pike 搭建之基础环境（一）
type: item
date: 2022-07-12T10:10:00+00:00
description: 规定密码 所有密码设置为: `000000` Passwords 密码名称 描述 密码 数据库密码（未使用变量） 数据库 root密码 000000 ADMIN_PASS admin 用户密码 000000 CINDER_DBPASS 块存储服务 数据库密码 000000 CINDER_PASS 块存储服务用户密码 000000 DASH_DBPASS 仪表板 数据库密码 000000 DEMO_PASS demo 用户密码 000000 GLANCE_DBPASS 镜像服务 数据库密码 000000 GLANCE_PASS 镜像服务 用户密码 000000 KEYSTONE_DBPASS 认证服务 数据库密码 000000 METADATA_SECRE 元数据代理 密码 000000 NEUTRON_DBPASS 网络服务 数据库密码 000000 NEUTRON_PASS 网络服务 用户密码 000000 NOVA_DBPASS 计算服务 数据库密码 000000 NOVA_PASS 计算服务 用户密码 000000 PLACEMENT_PASS 安置服务用户 密码 000000 RABBIT_PASS RabbitMQ 用户密码 000000 参考：https://docs.openstack.org/install-guide/environment-security.html 网络配置 控制节点 网络接口 [root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 TYPE="Ethernet" BOOTPROTO="none" NAME="eth0" DEVICE="eth0" ONBOOT="yes" IPADDR="178.120.2.10" PREFIX="24" GATEWAY="178.120.2.1" DNS1="8.8.8.8" ## provider interface: DEVICE=INTERFACE_NAME TYPE=Ethernet ONBOOT="yes" BOOTPROTO="none" 名称解析 [root@controller ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 178.120.2.10 controller 178.120.2.20 compute 免密登录 [root@controller ~]# ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/root/.ssh/id_dsa): Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_dsa. Your public key has been saved in /root/.ssh/id_dsa.pub. The key fingerprint is: SHA256:cgfolkfd6Oum3nYdVI+HO8llHk1hKR0YaOITw2gTQAE root@controller The key's randomart image is: +---[DSA 1024]----+ | Eo+o.+ ..+++| | = * = o.oo| | o = B . .=o| | . o = +.*| | = S + o B.| | . + . . * .| | . . o | | oo . . | | .o+o. | +----[SHA256]-----+ [root@controller ~]# ssh-copy-id compute /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_dsa.pub" The authenticity of host 'compute (178.120.2.20)' can't be established. ECDSA key f…

Hyper-V的简单使用
type: item
date: 2022-03-28T09:54:00+00:00
description: Hyper-V 前几天在 Windows 跑了 docker ，晚上有事要运行一个虚拟机。结果，虚拟机跑不起来了，泪奔。报错如下，盲猜Docker 和 VMware 的环境起冲突了。去百度了一波，把 Hyper-V 关了，重启一下 ，VMware Workstation可以运行了，Docker 就GG了。用命令开关Hyper-V，也可以接收，但重启就接受不了了。 VMware Workstation 与 Device/Credential Guard 不兼容。 在禁用 Device/Credential Guard 后，可以运行 VMware Workstati 几经百度，终于找到解决方法，使用VMware Workstation 15.5.5以后版本。在 VMware Workstation 15.5.5 Pro 发行说明，支持 Windows 10 主机 VBS。解决了开启 Hyper-V 不能运行的问题，但 VMware 开启不了虚拟化，希望在后面版本可以支持。嵌套虚拟化解决方案，使用Hyper-V创建虚拟机。 VMware Workstation 15.5.5 Pro 发行说明 新增功能 VMware Workstation 15.5.5 Pro 发行说明 已知问题 开启 Hyper-V 在 "控制面板" 的 "程序" 中 选择 "关闭 和 开启 Windows 功能" 勾选 Hyper-V。 如果你是家庭版没有找到 Hyper-V 选项，复制下面文本，新建 bat脚本并运行。 pushd "%~dp0" dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i" del hyper-v.txt Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL 使用 Hyper-V 管理中心 在 "windows工具" 中 点击 Hyper-V管理中心 具体使用和 VMware Workstation 差不多，CPU 代数选一代，测试 CentOS用二代的运行不起来。 虚拟交换机对应 VMware Workstation 中的虚拟网络编辑器，外部、内部、专用网络分别对应桥接、NAT、仅主机。 虚拟交换机 的配置没 VMware Workstation 智能，其中 NAT 部分需要手动调节，默认使用 192.168.131.0/24 网段。 更改网段需要修改注册表，可以使用下面脚本快速修改，还需要把可以使用的物理网络连接共享到该网络。 @echo off set /p q=Pleasl input ShareIP [192.168.173.1]: reg add "HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters" -v ScopeAddress -d %q% -f reg add "HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters" -v ScopeAddressBackup -d %q% -f timeout /t 10 /nobreak 其中，检查点对应的快照。还可以设置开机自启，这个是 VMware Workstation 中没有的功能 参考文章 启用 Hyper-V NAT 网络配置 修改注册表