OpenStack入门篇(二十)之实现阿里云ESC多FLAT网络

  • 1.给两台虚拟机增加网卡,使用仅主机模式,网段为:192.168.57.0/24

  • 2.修改两台主机网卡配置

[root@linux-node1 ~]# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
[root@linux-node1 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth1
TYPE=Ethernet
BOOTPROTO=static
NAME=eth1
DEVICE=eth1
ONBOOT=yes
IPADDR=192.168.57.11
NETMASK=255.255.255.0
[root@linux-node1 ~]# systemctl restart network

[root@linux-node2 ~]# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
[root@linux-node2 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth1
TYPE=Ethernet
BOOTPROTO=static
NAME=eth1
DEVICE=eth1
ONBOOT=yes
IPADDR=192.168.57.12
NETMASK=255.255.255.0
[root@linux-node2 ~]# systemctl restart network
  • 3.修改桥接网络配置

[root@linux-node1 ~]# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
physical_interface_mappings = public:eth0,internal:eth1
public:公网   internal:私网
[root@linux-node1 ~]# source admin-openstack
[root@linux-node1 ~]# openstack endpoint list
  • 4.修改ml2的配置

[root@linux-node1 ~]# vim /etc/neutron/plugins/ml2/ml2_conf.ini
flat_network:单一扁平网络
flat_network = public,internal
[root@linux-node1 ~]# systemctl restart neutron-server
[root@linux-node1 ~]# systemctl restart neutron-linuxbridge-agent
  • 5.计算节点:linux-node2一样配置/etc/neutron/plugins/ml2/linuxbridge_agent.ini

physical_interface_mappings = public:eth0,internal:eth1
[root@linux-node2 ~]# systemctl restart neutron-linuxbridge-agent
  • 6.创建网络

[root@linux-node1 ~]# source admin-openstack
[root@linux-node1 ~]# openstack network create --share \
    --provider-physical-network internal \
    --provider-network-type flat internal  <--网络名称

[root@linux-node1 ~]# openstack subnet create --network internal \
    --allocation-pool start=192.168.57.100,end=192.168.57.200
    --dns-nameserver 192.168.56.2 --gateway 192.168.57.2 \
    --subnet-range 192.168.57.0/24 internal-subnet
  • 7.dashboard查看并创建云主机

在创建云主机时即可选择网络,如图:

 

实现阿里云的FLAT网络(经典网络)一个公网ip,一个私网ip,如图:

VNC查看:

 

 

posted @ 2018-08-10 15:49  烟雨浮华  阅读(1359)  评论(0编辑  收藏  举报