向百度提交网站,网站建设 电话,特效很好的网站,博客网站建设方案书1、创建外部网络#xff0c;即是provider网络#xff0c;有关provider网络的详细解释请参见我之前的文章openstack中的self-service和provider网络_openstack provider网络不能创建vlan吗-CSDN博客
network create --share --external --provider-physical-network physnet1…1、创建外部网络即是provider网络有关provider网络的详细解释请参见我之前的文章openstack中的self-service和provider网络_openstack provider网络不能创建vlan吗-CSDN博客
network create --share --external --provider-physical-network physnet1 --provider-network-type flat out
2、再创建子网
subnet create --subnet-pool 192.168.23.0/24 --gateway 192.168.23.1 --no-dhcp --allocation-pool start192.168.23.10,end192.168.23.60 --network out out_sub
allocation-pool 指的是动态分配的浮动IP范围gateway 192.168.23.1 这是指定外部网络的网关一般是物理网络的网关不是虚拟网络的
3、创建路由器
router create router3
4、把新创建的路由器跟用户子网连接起来
router add subnet router3 new_subnet01
这里面new_subnet01就是以前新建立的用户子网
(openstack) subnet show new_subnet01 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | Field | Value | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | allocation_pools | 10.173.0.2-10.173.0.254 | | cidr | 10.173.0.0/24 | | created_at | 2024-11-26T11:09:32Z | | description | | | dns_nameservers | | | enable_dhcp | True | | gateway_ip | 10.173.0.1 | | host_routes | | | id | ea702afb-a6e8-40d1-9bc4-f9280ff4a101 | | ip_version | 4 | | ipv6_address_mode | None | | ipv6_ra_mode | None | | location | cloud, project.domain_id, project.domain_nameDefault, project.id7e0a0a5e8dee4688ad2eeb2290023a5b, project.nameadmin, region_nameRegionOne, zone | | name | new_subnet01 | | network_id | c861c1c9-6b91-4e42-842b-07f56e21941b | | prefix_length | None | | project_id | 7e0a0a5e8dee4688ad2eeb2290023a5b | | revision_number | 0 | | segment_id | None | | service_types | | | subnetpool_id | None | | tags | | | updated_at | 2024-11-26T11:09:32Z
从这里面可以看出这个子网的网关是10.173.0.1注意这时候10.173.0.1还是没有分配给任何设备的。
5、把路由器和子网连接起来
router add subnet router3 new_subnet01
这里面路由器就会多一个端口了并且分配的IP就是10.173.0.1
port list --router router3
----------------------------------------------------------------------------------------------------------------------------------------------------- | ID | Name | MAC Address | Fixed IP Addresses | Status | ----------------------------------------------------------------------------------------------------------------------------------------------------- | b2626e44-efb1-4d49-9242-fc5f277ecc79 | | fa:16:3e:51:3c:d3 | ip_address10.173.0.1, subnet_idea702afb-a6e8-40d1-9bc4-f9280ff4a101 | ACTIVE | 7、把路由器再跟外网连接起来并指定跟外网互联的IP也可以不指定自动分配
router set --fixed-ip subnetout_sub,ip-address192.168.23.61 --external-gateway out router3
这里面要注意我们在这里面指定了--fixed-ip subnetout_sub,ip-address192.168.23.61 主要是为了指定子网因为out这个网络里面在我这边是存在多个子网的。同时我还指定了路由器跟外网子网相连端口的IP。如果你的out网络只有一个子网你也可以不指定这个
8、新建立浮动IP
floating ip create --subne out_sub out
这时会从start192.168.23.10,end192.168.23.60随机分配一个
9、给虚机绑定浮动IP
server add floating ip mynew_vm 192.168.23.28
192.168.23.28就是第8步创建的浮动IP 路由器在OPENSTACK里面标准实现实际上就是一个namespace我们在网络节点上查看
ip netns
qrouter-502d3467-a9cf-44f5-87bf-bbcd0439d7e6 (id: 8)
qrouter-开头的就是你建立的路由器里面用IPTABLE做了一对一的映射把浮动IP映射到用户内网的IP。当然在商业公有云中为了网络性能一般不使用namespace来做路由器而是使用其它更高效的方案如天翼云就是使用了开源的VPP进行了二次开发