问题导读
1.如何添加租户网络?
2.如何添加路由?
3.网络连通性如何验证?
4.如何建立路由与租户网络、外部网络关联?
创建外部网络【控制节点】
1.生效环境变量
[mw_shl_code=bash,true]source admin-openrc.sh[/mw_shl_code]
2.创建网络
[mw_shl_code=bash,true]neutron net-create ext-net --router:external \
--provider:physical_network external --provider:network_type flat[/mw_shl_code]
共享网络
[mw_shl_code=bash,true]neutron net-create ext-net --shared --router:external \
--provider:physical_network external --provider:network_type flat[/mw_shl_code]
[mw_shl_code=bash,true]Created a new network:
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | True |
| id | 893aebb9-1c1e-48be-8908-6b947f3237b3 |
| name | ext-net |
| provider:network_type | flat |
| provider:physical_network | external |
| provider:segmentation_id | |
| router:external | True |
| shared | False |
| status | ACTIVE |
| subnets | |
| tenant_id | 54cd044c64d5408b83f843d63624e0d8 |
+---------------------------+--------------------------------------+[/mw_shl_code]
创建外网上的子网
[mw_shl_code=bash,true]neutron subnet-create ext-net EXTERNAL_NETWORK_CIDR --name ext-subnet \
--allocation-pool start=FLOATING_IP_START,end=FLOATING_IP_END \
--disable-dhcp --gateway EXTERNAL_NETWORK_GATEWAY[/mw_shl_code]
替换掉FLOATING_IP_START,FLOATING_IP_END,分别是floating ip地址的开始地址和结束地址。替换掉EXTERNAL_NETWORK_CIDR子网关联的物理网络。替换 EXTERNAL_NETWORK_GATEWAY 与物理网络的网关。通常.1ip地址。禁用子网ip地址,因为实例不直接连接外网,floating ip需要手工分配。
举例:, 使用 203.0.113.0/24 , floating IP 地址范围 203.0.113.101 to 203.0.113.200:
[mw_shl_code=bash,true]neutron subnet-create ext-net 203.0.113.0/24 --name ext-subnet \
--allocation-pool start=203.0.113.101,end=203.0.113.200 \
--disable-dhcp --gateway 203.0.113.1[/mw_shl_code]
[mw_shl_code=bash,true]Created a new subnet:
+-------------------+------------------------------------------------------+
| Field | Value |
+-------------------+------------------------------------------------------+
| allocation_pools | {"start": "203.0.113.101", "end": "203.0.113.200"} |
| cidr | 203.0.113.0/24 |
| dns_nameservers | |
| enable_dhcp | False |
| gateway_ip | 203.0.113.1 |
| host_routes | |
| id | 9159f0dc-2b63-41cf-bd7a-289309da1391 |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | ext-subnet |
| network_id | 893aebb9-1c1e-48be-8908-6b947f3237b3 |
| tenant_id | 54cd044c64d5408b83f843d63624e0d8 |
+-------------------+------------------------------------------------------+[/mw_shl_code]
[mw_shl_code=bash,true]neutron subnet-create ext-net --name ext-subnet \
--allocation-pool start=10.0.0.101,end=10.0.0.200 \
--disable-dhcp --gateway 10.0.0.2 10.0.0.0/24[/mw_shl_code]
##################################
创建租户网络
1.生效环境变量
[mw_shl_code=bash,true]source demo-openrc.sh[/mw_shl_code]
2.创建租户网络
[mw_shl_code=bash,true]neutron net-create demo-net[/mw_shl_code]
创建租户网络子网
创建子网
[mw_shl_code=bash,true]neutron subnet-create demo-net TENANT_NETWORK_CIDR \
--name demo-subnet --gateway TENANT_NETWORK_GATEWAY[/mw_shl_code]
例子:
[mw_shl_code=bash,true]neutron subnet-create demo-net 192.168.1.0/24 \
--name demo-subnet --gateway 192.168.1.1[/mw_shl_code]
[mw_shl_code=bash,true]Created a new subnet:
+-------------------+------------------------------------------------------+
| Field | Value |
+-------------------+------------------------------------------------------+
| allocation_pools | {"start": "192.168.1.2", "end": "192.168.1.254"} |
| cidr | 192.168.1.0/24 |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 192.168.1.1 |
| host_routes | |
| id | 69d38773-794a-4e49-b887-6de6734e792d |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | demo-subnet |
| network_id | ac108952-6096-4243-adf4-bb6615b3de28 |
| tenant_id | cdef0071a0194d19ac6bb63802dc9bae |
+-------------------+------------------------------------------------------+[/mw_shl_code]
创建租户路由,并附加外网和租户网络到路由
[mw_shl_code=bash,true]neutron router-create demo-router[/mw_shl_code]
[mw_shl_code=bash,true]+-----------------------+--------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------+
| admin_state_up | True |
| external_gateway_info | |
| id | 635660ae-a254-4feb-8993-295aa9ec6418 |
| name | demo-router |
| routes | |
| status | ACTIVE |
| tenant_id | cdef0071a0194d19ac6bb63802dc9bae |
+-----------------------+--------------------------------------+[/mw_shl_code]
连接路由器到租户网络
[mw_shl_code=bash,true]neutron router-interface-add demo-router demo-subnet[/mw_shl_code]
Added interface b1a894fd-aee8-475c-9262-4342afdc1b58 to router demo-router.
连接路由器到外部网络通过设置为网关:
[mw_shl_code=bash,true]neutron router-gateway-set demo-router ext-net[/mw_shl_code]
Set gateway for router demo-router
验证安装
[mw_shl_code=bash,true]root@controller:~# ping -c 4 203.0.113.101
PING 203.0.113.101 (203.0.113.101) 56(84) bytes of data.
64 bytes from 203.0.113.101: icmp_seq=1 ttl=128 time=4.76 ms
64 bytes from 203.0.113.101: icmp_seq=2 ttl=128 time=3.87 ms
64 bytes from 203.0.113.101: icmp_seq=3 ttl=128 time=3.86 ms
64 bytes from 203.0.113.101: icmp_seq=4 ttl=128 time=3.73 ms
--- 203.0.113.101 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3007ms
rtt min/avg/max/mdev = 3.737/4.059/4.765/0.415 ms
root@controller:~# ^C
root@controller:~# ping -c 4 203.0.113.101
PING 203.0.113.101 (203.0.113.101) 56(84) bytes of data.
64 bytes from 203.0.113.101: icmp_seq=1 ttl=128 time=56.6 ms
64 bytes from 203.0.113.101: icmp_seq=2 ttl=128 time=3.86 ms
64 bytes from 203.0.113.101: icmp_seq=3 ttl=128 time=101 ms
64 bytes from 203.0.113.101: icmp_seq=4 ttl=128 time=4.42 ms
--- 203.0.113.101 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 3.863/41.512/101.157/40.554 ms[/mw_shl_code]
相关内容
openstack【Kilo】入门 【准备篇】零:整体介绍
openstack【Kilo】入门 【准备篇】一: Ubuntu14.04远程连接(ssh安装)
openstack【Kilo】入门 【准备篇】二:NTP安装
openstack【Kilo】入门 【准备篇】三:mysql(MariaDB)安装【控制节点】
openstack【Kilo】入门 【准备篇】四:RabbitMQ 安装
openstack【Kilo】入门 【keystone篇】五:keystone安装与配置
openstack【Kilo】入门 【keystone篇】六:创建服务实例和 API endpoint
openstack【Kilo】入门 【keystone篇】七:创建租户、用户、角色
openstack【Kilo】入门 【keystone篇】八:验证keystone安装部署
openstack【Kilo】入门 【keystone篇】九: 创建openstack客户端环境变量脚本
openstack【Kilo】入门 【glance篇】十:glance安装配置【控制节点】
openstack【Kilo】入门 【glance篇】十一:glance安装验证
openstack【Kilo】入门 【nova篇】十二:安装配置nova
openstack【Kilo】入门 【网络篇】十三:安装配置【控制节点】
openstack【Kilo】入门 【网络篇】十四:安装配置【网络节点】
openstack【Kilo】入门 【网络篇】十五:安装配置【计算节点】
openstack【Kilo】入门 【网络篇】十六:实例化网络
openstack【Kilo】入门 【网络篇】十七:创建实例
|