前期准备
准备两台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
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
[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
1.
2.
3.
4.
5.
6.
7.
8.
重启网络

[root@controller ~]# systemctl restart network
1.
配置双网关

[root@controller ~]# vi /etc/iproute2/rt_tables
252 e1
251 e0
1.
2.
3.
添加静态路由

[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
1.
2.
3.
4.
5.
6.
7.
8.
配置开机自动写入静态路由

[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
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
Controller结点配置Neutron双网卡
修改配置文件

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

systemctl restart neutron-server.service neutron-linuxbridge-agent.service
1.
Computer结点配置Neutron双网卡
修改配置文件

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

[root@computer ~]# systemctl restart neutron-linuxbridge-agent.service
1.
部署云主机步骤可参考: https://blog.csdn.net/xixixilalalahaha/article/details/107759415
-----------------------------------
©著作权归作者所有:来自51CTO博客作者wx5ed6455937203的原创作品,请联系作者获取转载授权,否则将追究法律责任
Openstack配置Neutron双网卡(linuxbridge网络架构)
https://blog.51cto.com/u_14832653/2576541

发表评论

邮箱地址不会被公开。 必填项已用*标注