第 77 章 子网
本章论述了 subnet
命令下的命令。
77.1. 子网创建
创建子网
使用方法:
openstack subnet create [-h] [-f {json,shell,table,value,yaml}] [-c COLUMN] [--noindent] [--prefix PREFIX] [--max-width <integer>] [--fit-width] [--print-empty] [--project <project>] [--project-domain <project-domain>] [--subnet-pool <subnet-pool> | --use-prefix-delegation USE_PREFIX_DELEGATION | --use-default-subnet-pool] [--prefix-length <prefix-length>] [--subnet-range <subnet-range>] [--dhcp | --no-dhcp] [--gateway <gateway>] [--ip-version {4,6}] [--ipv6-ra-mode {dhcpv6-stateful,dhcpv6-stateless,slaac}] [--ipv6-address-mode {dhcpv6-stateful,dhcpv6-stateless,slaac}] [--network-segment <network-segment>] --network <network> [--description <description>] [--allocation-pool start=<ip-address>,end=<ip-address>] [--dns-nameserver <dns-nameserver>] [--host-route destination=<subnet>,gateway=<ip-address>] [--service-type <service-type>] [--tag <tag> | --no-tag] <name>
表 77.1. 位置参数
值 | 概述 |
---|---|
<name> | 新子网名称 |
表 77.2. 可选参数
值 | 概述 |
---|---|
-h, --help | 显示帮助信息并退出 |
--project <project> | 所有者的项目(名称或 id) |
--project-domain <project-domain> | 项目所属的域(名称或 id)。这可在项目名称之间有冲突时使用。 |
--subnet-pool <subnet-pool> | 此子网的子网池将获得 cidr (名称或 ID) |
--use-prefix-delegation USE_PREFIX_DELEGATION | 如果 ip 是 ipv6 格式,使用 prefix-delegation,并在外部分配 ip |
--use-default-subnet-pool | 为 --ip-version 使用默认子网池 |
--prefix-length <prefix-length> | 从子网池子网分配的前缀长度 |
--subnet-range <subnet-range> | cidr 标记中的子网范围(如果未指定 --subnet- 池,否则可选) |
--dhcp | 启用 dhcp (默认) |
--no-dhcp | 禁用 dhcp |
--gateway <gateway> | 为子网指定网关。三个选项为:<ip-address>:将特定 IP 地址用作网关,自动从子网中选择网关地址,不会从子网中选择:此子网不使用网关,例如:--gateway 192.168.9.1、--gateway auto、--gateway none (默认自动)。 |
--ip-version {4,6} | IP 版本(默认为 4)。请注意,在指定子网池时,IP 版本是从子网池决定的,并会忽略这个选项。 |
--ipv6-ra-mode {dhcpv6-stateful,dhcpv6-stateless,slaac} | Ipv6 ra (路由器广告)模式,有效的模式: [dhcpv6-stateful, dhcpv6-stateless, slaac] |
--ipv6-address-mode {dhcpv6-stateful,dhcpv6-stateless,slaac} | Ipv6 地址模式, 有效模式: [dhcpv6-stateful, dhcpv6-stateless, slaac] |
--network-segment <network-segment> | 与此子网关联的网络段(名称或 ID) |
--network <network> | 这个子网的网络属于 (名称或 id) |
--description <description> | 设置子网描述 |
--allocation-pool start=<ip-address>,end=<ip-address> | 此子网的分配池 IP 地址 e.g.: start=192.168.199.2,end=192.168.199.254 (重复选项来添加多个 IP 地址) |
--dns-nameserver <dns-nameserver> | 此子网的 DNS 服务器(重复选项以设置多个 DNS 服务器) |
--host-route destination=<subnet>,gateway=<ip-address> | 此子网的附加路由: destination=10.10.0.0/16、gateway=192.168.71.254 目标:目标子网(在 CIDR 表示法中)网关: nexthop IP 地址(用于添加多个路由) |
--service-type <service-type> | 此子网的服务类型,如 network:floatingip_agent_gateway。必须是网络端口的有效设备所有者值(重复选项来设置多个服务类型) |
--tag <tag> | 要添加到子网的标签(重复选项来设置多个标签) |
--no-tag | 没有与子网关联的标签 |
表 77.3. 输出格式器
值 | 概述 |
---|---|
-f {json,shell,table,value,yaml}, --format {json,shell,table,value,yaml} | 输出格式,默认为 table |
-c COLUMN, --column COLUMN | 指定要包含的列,可以重复 |
表 77.4. JSON Formatter
值 | 概述 |
---|---|
--noindent | 是否禁用缩进 json |
表 77.5. shell Formatter
值 | 概述 |
---|---|
--prefix PREFIX | 为所有变量名称添加前缀 |
表 77.6. 表格式
值 | 概述 |
---|---|
--max-width <integer> | 最大显示宽度 <1 来禁用。您还可以使用 CLIFF_MAX_TERM_WIDTH 环境变量,但参数具有优先权。 |
--fit-width | 适合显示宽度的表。如果 --max-width 大于 0,则意味着。将环境变量 CLIFF_FIT_WIDTH=1 设置为 always 启用 |
--print-empty | 如果没有要显示数据,则打印空表。 |