[root@controller ~]# openstack network --help
Command "network" matches:
network create # 创建网络
network delete # 删除网络
network list # 查看网络列表
network set # 设置网络
network show # 查看网络
network unset
创建网络参数补充
参数 | 功能 | 用法 |
---|---|---|
share | 共享 | --share:共享 --no-share:不共享 |
external | 外部网络 | |
internal | 内部网络 | |
provider-network-type | 网络供应类型 | flat geneve gre local vlan vxlan |
provider-physical-netowrk | 物理网络名 |
# name:external type:external provider network type:flat provider physical network:provider share:yes
[root@controller ~]# openstack network create --external --share --provider-network-type flat --provider-physical-network provider external
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2021-03-20T09:08:38Z |
| description | |
| dns_domain | None |
| id | 8c7505aa-6770-436a-a109-9bd145beded1 |
| ipv4_address_scope | None |
| ipv6_address_scope | None |
| is_default | False |
| is_vlan_transparent | None |
| mtu | 1500 |
| name | external |
| port_security_enabled | True |
| project_id | 57e7eb094ace4170ab2c4792c23ee6e7 |
| provider:network_type | flat |
| provider:physical_network | provider |
| provider:segmentation_id | None |
| qos_policy_id | None |
| revision_number | 5 |
| router:external | External |
| segments | None |
| shared | True |
| status | ACTIVE |
| subnets | |
| tags | |
| updated_at | 2021-03-20T09:08:39Z |
+---------------------------+--------------------------------------+
[root@controller ~]# openstack network list
+--------------------------------------+----------+---------+
| ID | Name | Subnets |
+--------------------------------------+----------+---------+
| 8c7505aa-6770-436a-a109-9bd145beded1 | external | |
+--------------------------------------+----------+---------+
[root@controller ~]# openstack network show external
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2021-03-20T09:08:38Z |
| description | |
| dns_domain | None |
| id | 8c7505aa-6770-436a-a109-9bd145beded1 |
| ipv4_address_scope | None |
| ipv6_address_scope | None |
| is_default | False |
| is_vlan_transparent | None |
| mtu | 1500 |
| name | external |
| port_security_enabled | True |
| project_id | 57e7eb094ace4170ab2c4792c23ee6e7 |
| provider:network_type | flat |
| provider:physical_network | provider |
| provider:segmentation_id | None |
| qos_policy_id | None |
| revision_number | 5 |
| router:external | External |
| segments | None |
| shared | True |
| status | ACTIVE |
| subnets | |
| tags | |
| updated_at | 2021-03-20T09:08:39Z |
+---------------------------+--------------------------------------+
[root@controller ~]# openstack subnet --help
Command "subnet" matches:
subnet create # 创建子网
subnet delete # 删除子网
subnet list # 子网列表
subnet set # 设置子网
subnet show # 查看子网
创建子网参数补充:
参数 | 功能 | 用法 |
---|---|---|
network | 指定一个网络 | |
subnet-range | 网段 | |
gateway | 网关 | |
ip-version | IP版本 | IPV4:4 IPV6:6 |
dhcp | DHCP服务 | |
allocation-pool | DHCP池 | --allocation-pool start=开始IP,end=结束IP |
dns-nameserver | DNS服务器 | --dns-nameserver |
host-route | 主机路由 | --host-route destination=,gateway= |
参数 | 功能 | 用法 |
---|---|---|
[root@controller ~]# openstack route --help
Command "route" matches:
router add port # 添加端口到路由
router add subnet # 添加子网到路由
router create # 创建路由
router delete # 删除路由
router list # 查看路由列表
router remove port # 删除路由端口
router remove subnet # 删除路由子网
router set # 设置路由
router show # 查看路由
# name ext-router
[root@controller ~]# openstack router create ext-router
+-------------------------+--------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2021-03-20T10:49:05Z |
| description | |
| distributed | False |
| external_gateway_info | None |
| flavor_id | None |
| ha | False |
| id | 1a863f4f-3c45-44bb-b21d-ad548c620320 |
| name | ext-router |
| project_id | 57e7eb094ace4170ab2c4792c23ee6e7 |
| revision_number | 0 |
| routes | |
| status | ACTIVE |
| tags | |
| updated_at | 2021-03-20T10:49:05Z |
+-------------------------+--------------------------------------+
# 外部网络:external
[root@controller ~]# openstack router set --external-gateway external ext-router
[root@controller ~]# openstack router show ext-router
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | nova |
| created_at | 2021-03-20T10:49:05Z |
| description | |
| distributed | False |
| external_gateway_info | {"network_id": "8c7505aa-6770-436a-a109-9bd145beded1", "enable_snat": true, "external_fixed_ips": [{"subnet_id": "87081291-9dcd-4be4-9ba0-88b820ef19a5", "ip_address": "192.168.200.51"}]} |
| flavor_id | None |
| ha | False |
| id | 1a863f4f-3c45-44bb-b21d-ad548c620320 |
| interfaces_info | [] |
| name | ext-router |
| project_id | 57e7eb094ace4170ab2c4792c23ee6e7 |
| revision_number | 2 |
| routes | |
| status | ACTIVE |
| tags | |
| updated_at | 2021-03-20T10:51:58Z |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
# 子网:int-subnet
[root@controller ~]# openstack router add subnet ext-router int-subnet
[root@controller ~]# openstack router show ext-router
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | nova |
| created_at | 2021-03-20T10:49:05Z |
| description | |
| distributed | False |
| external_gateway_info | {"network_id": "8c7505aa-6770-436a-a109-9bd145beded1", "enable_snat": true, "external_fixed_ips": [{"subnet_id": "87081291-9dcd-4be4-9ba0-88b820ef19a5", "ip_address": "192.168.200.51"}]} |
| flavor_id | None |
| ha | False |
| id | 1a863f4f-3c45-44bb-b21d-ad548c620320 |
| interfaces_info | [{"subnet_id": "54c58387-2878-4b06-8820-0c3335f8094b", "ip_address": "10.0.0.1", "port_id": "bf914d2b-9d4e-473b-b4f1-cb953f0905e9"}] |
| name | ext-router |
| project_id | 57e7eb094ace4170ab2c4792c23ee6e7 |
| revision_number | 3 |
| routes | |
| status | ACTIVE |
| tags | |
| updated_at | 2021-03-20T10:54:52Z |
+-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@controller ~]# openstack floating ip --help
Command "floating" matches:
floating ip create # 创建浮动IP
floating ip delete # 删除浮动IP
floating ip list # 查看浮动IP列表
floating ip pool list # 浮动IP池列表
floating ip set # 设置浮动IP
floating ip show # 查看浮动IP
# 网络:external
[root@controller ~]# openstack floating ip create external
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| created_at | 2021-03-20T11:19:45Z |
| description | |
| fixed_ip_address | None |
| floating_ip_address | 192.168.200.69 |
| floating_network_id | 8c7505aa-6770-436a-a109-9bd145beded1 |
| id | a4d42a58-a1f3-4669-9d1b-a4aebd4f9096 |
| name | 192.168.200.69 |
| port_id | None |
| project_id | 57e7eb094ace4170ab2c4792c23ee6e7 |
| qos_policy_id | None |
| revision_number | 0 |
| router_id | None |
| status | DOWN |
| subnet_id | None |
| updated_at | 2021-03-20T11:19:45Z |
+---------------------+--------------------------------------+
[root@controller ~]# openstack floating ip list
+--------------------------------------+---------------------+------------------+------+--------------------------------------+----------------------------------+
| ID | Floating IP Address | Fixed IP Address | Port | Floating Network | Project |
+--------------------------------------+---------------------+------------------+------+--------------------------------------+----------------------------------+
| a4d42a58-a1f3-4669-9d1b-a4aebd4f9096 | 192.168.200.69 | None | None | 8c7505aa-6770-436a-a109-9bd145beded1 | 57e7eb094ace4170ab2c4792c23ee6e7 |
+--------------------------------------+---------------------+------------------+------+--------------------------------------+----------------------------------+