前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >openstak安装(30)

openstak安装(30)

原创
作者头像
陈不成i
修改2021-05-07 18:00:08
3170
修改2021-05-07 18:00:08
举报
文章被收录于专栏:ops技术分享

启动实例

创建虚拟网络

在创建私有项目网络前,必须创建创建公共网络(在启动实例前,必须创建必要的虚拟网络设施。对网络选择1,实例通过layer-2(桥接/交换)使用连接到物理网络设施的公共提供虚拟网络。这个网络包括一个为实例提供IP地址的DHCP服务。admin或者其他权限用户必须创建这个网络,因为它直接连接到物理网络设施。)

创建公共网络

[root@controller ~]# source admin-openrc.sh #加载 admin 凭证来获取管理员能执行的命令访问权限

[root@controller ~]# neutron net-create public --shared --provider:physical_network public --provider:network_type flat #创建网络

Created a new network:

+---------------------------+--------------------------------------+

| Field | Value |

+---------------------------+--------------------------------------+

| admin_state_up | True |

| id | 5fc60cce-0943-4844-b9e2-c768af2ea302 |

| mtu | 0 |

| name | public |

| port_security_enabled | True |

| provider:network_type | flat |

| provider:physical_network | public |

| provider:segmentation_id | |

| router:external | False |

| shared | True |

| status | ACTIVE |

| subnets | |

| tenant_id | e5f65d198e594c9f8a8db29a6a9d01a7 |

+---------------------------+--------------------------------------+

[root@controller ~]# neutron subnet-create public 192.168.1.0/24 --name public --allocation-pool start=192.168.1.220,end=192.168.1.250 --dns-nameserver 114.114.114.114 --gateway 192.168.1.1 #在网络上创建一个子网

Created a new subnet:

+-------------------+----------------------------------------------------+

| Field | Value |

+-------------------+----------------------------------------------------+

| allocation_pools | {"start": "192.168.1.220", "end": "192.168.1.250"} |

| cidr | 192.168.1.0/24 |

| dns_nameservers | 192.168.1.1 |

| enable_dhcp | True |

| gateway_ip | 192.168.1.1 |

| host_routes | |

| id | ac92ba15-daef-4bc3-a353-ed1325c85844 |

| ip_version | 4 |

| ipv6_address_mode | |

| ipv6_ra_mode | |

| name | public |

| network_id | 5fc60cce-0943-4844-b9e2-c768af2ea302 |

| subnetpool_id | |

| tenant_id | e5f65d198e594c9f8a8db29a6a9d01a7 |

+-------------------+----------------------------------------------------+

创建私有项目网络

[root@controller ~]# source demo-openrc.sh #加载 demo 凭证来获取管理员能执行的命令访问权限

[root@controller ~]# neutron net-create private #创建网络 非特权用户一般不能在这个命令制定更多参数

Created a new network:

+-----------------------+--------------------------------------+

| Field | Value |

+-----------------------+--------------------------------------+

| admin_state_up | True |

| id | ce8a6c38-5a84-47c0-b058-9bdd8b67e179 |

| mtu | 0 |

| name | private |

| port_security_enabled | True |

| router:external | False |

| shared | False |

| status | ACTIVE |

| subnets | |

| tenant_id | a152b2b891a147dfa3068d66311ad0c3 |

+-----------------------+--------------------------------------+

[root@controller ~]# neutron subnet-create private172.16.1.0/24 --name private --dns-nameserver 114.114.114.114 --gateway 172.16.1.1 #在网络上创建一个子网

Created a new subnet:

+-------------------+------------------------------------------------+

| Field | Value |

+-------------------+------------------------------------------------+

| allocation_pools | {"start": "172.16.1.2", "end": "172.16.1.254"} |

| cidr | 172.16.1.0/24 |

| dns_nameservers | 114.114.114.114 |

| enable_dhcp | True |

| gateway_ip | 172.16.1.1 |

| host_routes | |

| id | 91f26704-6ead-4d73-870e-115dd8377998 |

| ip_version | 4 |

| ipv6_address_mode | |

| ipv6_ra_mode | |

| name | private |

| network_id | ce8a6c38-5a84-47c0-b058-9bdd8b67e179 |

| subnetpool_id | |

| tenant_id | a152b2b891a147dfa3068d66311ad0c3 |

+-------------------+------------------------------------------------+

创建路由器

[root@controller ~]# source admin-openrc.sh #获得 admin 凭证来获取只有管理员能执行的命令的访问权限

[root@controller ~]# neutron net-update public --router:external #添加router: external到 public 网络

Updated network: public

[root@controller ~]# source demo-openrc.sh #加载 demo 凭证获得用户能执行的命令访问权限

[root@controller ~]# neutron router-create router #创建路由

Created a new router:

+-----------------------+--------------------------------------+

| Field | Value |

+-----------------------+--------------------------------------+

| admin_state_up | True |

| external_gateway_info | |

| id | 649c8cfc-e117-4105-b55d-cd9214792ae3 |

| name | router |

| routes | |

| status | ACTIVE |

| tenant_id | a152b2b891a147dfa3068d66311ad0c3 |

+-----------------------+--------------------------------------+

[root@controller ~]# neutron router-interface-add router private #在路由器添加一个私网子网接口

Added interface65404353-b387-4243-81b8-a2cbeb5b6b4d to router router.

[root@controller ~]# neutron router-gateway-set router public #在路由器上设置公共网络的网关

Set gateway for router router

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档