Openstack配置Neutron双网卡(linuxbridge网络架构)

浪尽此生 提交于 2020-12-30 14:02:29

前期准备

准备两台Centos7虚拟机,其中两台虚拟机配置两个网卡(NAT和仅主机),两台虚拟区配置多块硬盘,配置IP地址和hostname,同步系统时间,关闭防火墙和selinux,修改ip地址和hostname映射

ip hostname
ens33(NAT):192.168.29.145 ens37(仅主机):192.168.31.135 controller
ens33(NAT):192.168.29.146 ens37(仅主机):192.168.31.136 computer

OpenStack详细配置流程可参考:https://editor.csdn.net/md/?articleId=107760621

虚拟机配置双网关(以Controller为例)

修改网络配置

[root@controller ~]#  vi /etc/sysconfig/network-scripts/ifcfg-ens33
DEVICE=ens33
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.29.145
NETMASK=255.255.255.0
GATEWAY=192.168.29.2
DNS1=192.168.29.2
[root@controller ~]#  vi /etc/sysconfig/network-scripts/ifcfg-ens37
DEVICE=ens33
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.31.135
NETMASK=255.255.255.0

重启网络

[root@controller ~]#  systemctl restart network

配置双网关

[root@controller ~]#  vi  /etc/iproute2/rt_tables
252 e1 
251 e0

添加静态路由

[root@controller ~]#  ip route flush table e0
[root@controller ~]#  ip route add default via 192.168.29.2 dev ens33 src 192.168.29.145 table e0                   
[root@controller ~]#  ip route add 127.0.0.0/8 dev lo table e0
[root@controller ~]#  ip rule add from 192.168.29.145 table e0           
[root@controller ~]#  ip route flush table e1
[root@controller ~]#  ip route add default via 192.168.31.1 dev ens37 src 192.168.31.135 table e1                     
[root@controller ~]#  ip route add 127.0.0.0/8 dev lo table e1
[root@controller ~]#  ip rule add from 192.168.31.135 table e1 

配置开机自动写入静态路由

[root@controller ~]#  vi /etc/rc.local
ip route flush table e0
ip route add default via 192.168.29.2 dev ens33 src 192.168.29.145 table e0                   
ip route add 127.0.0.0/8 dev lo table e0
ip rule add from 192.168.29.145 table e0           
ip route flush table e1
ip route add default via 192.168.31.1 dev ens37 src 192.168.31.135 table e1                     
ip route add 127.0.0.0/8 dev lo table e1
ip rule add from 192.168.31.135 table e1

[root@controller ~]#  chmod +x /etc/rc.d/rc.local
[root@controller ~]#  systemctl start rc-local.service

Controller结点配置Neutron双网卡

修改配置文件

[root@controller ~]#  vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
physical_interface_mappings = public:ens33,internet:ens37
[root@controller ~]#  vi /etc/neutron/plugins/ml2/ml2_conf.ini
flat_networks = public,internet

重启服务

systemctl restart neutron-server.service neutron-linuxbridge-agent.service

Computer结点配置Neutron双网卡

修改配置文件

[root@computer ~]#  vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
physical_interface_mappings = public:ens33,internet:ens37

重启服务

[root@computer ~]#  systemctl restart neutron-linuxbridge-agent.service

部署云主机步骤可参考:https://blog.csdn.net/xixixilalalahaha/article/details/107759415

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!