Juno版本的l3 ha采用的是keepalived这个工具,其内部实现了vrrp协议。先来介绍下vrrp:
VRRP简介
VRRP是一种路由容错协议,也可以叫做备份路由协议。一个局域网络内的所有主机都设置缺省路由,当网内主机发出的目的地址不在本网段时,报文将被通过缺省路由发往外部路由器,从而实现了主机与外部网络的通信。当缺省路由器down掉(即端口关闭)之后,内部主机将无法与外部通信,如果路由器设置了VRRP时,那么这时,虚拟路由将启用备份路由器,从而实现全网通信。(选自百度百科:虚拟路由冗余协议)
内部实现流程图:
具体配置
# 我的环境 # 系统: centos7 x86_64 # l3_agent: node-191、node-192 [root@node-191 ~(keystone_admin)]# yum install keepalived -y # 安装keepalived包 [root@node-191 neutron(keystone_admin)]# cat /etc/neutron/l3_agent.ini [DEFAULT] interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver ovs_use_veth = True use_namespaces = True external_network_bridge = br-ex router_delete_namespaces = True l3_ha = True # 就这三条,默认是False max_l3_agents_per_router = 2 min_l3_agents_per_router = 2 [root@node-191 neutron(keystone_admin)]# systemctl restart neutron-server.service^Ceutron-l3-agent.service neutron-openvswitch-agent.service # 重启相关服务 [root@node-192 ~(keystone_admin)]# yum install keepalived -y # 安装keepalived包 [root@node-192 neutron(keystone_admin)]# cat /etc/neutron/l3_agent.ini [DEFAULT] interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver ovs_use_veth = True use_namespaces = True external_network_bridge = br-ex router_delete_namespaces = True l3_ha = True # 就这三条,默认是False max_l3_agents_per_router = 2 min_l3_agents_per_router = 2 [root@node-192 neutron(keystone_admin)]# systemctl restart neutron-server.service^Ceutron-l3-agent.service neutron-openvswitch-agent.service # 重启相关服务
使用
dashboard上创建router的时候无法指定是否ha,只能通过cli创建,格式如下:
[root@node-192 ~(keystone_admin)]# neutron router-create --ha {True,False} router名称
创建ha的router,和相应的网络,dashboard上无法显示相应的拓扑(还不懂是不是bug)
# 查看node-191、node-192的namespace [root@node-191 ~(keystone_admin)]# ip netns | grep qrouter qrouter-25b9d299-ed2a-469f-8246-1d24ac6f0e15 [root@node-192 ~(keystone_admin)]# ip netns | grep qrouter qrouter-25b9d299-ed2a-469f-8246-1d24ac6f0e15 # 一样的namespace # 先进入到node-191的router namespace下,查看一些网络配置情况 [root@node-191 ~(keystone_admin)]# ip netns exec qrouter-25b9d299-ed2a-469f-8246-1d24ac6f0e15 bash [root@node-191 ~(keystone_admin)]# ifconfig ha-a7a786c4-4a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 169.254.192.3 netmask 255.255.192.0 broadcast 169.254.255.255 inet6 fe80::f816:3eff:fe14:e40f prefixlen 64 scopeid 0x20<link> ether fa:16:3e:14:e4:0f txqueuelen 1000 (Ethernet) RX packets 1153 bytes 62554 (61.0 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 17 bytes 1278 (1.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 0 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 qg-e7df2b18-32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::f816:3eff:fe81:e213 prefixlen 64 scopeid 0x20<link> ether fa:16:3e:81:e2:13 txqueuelen 1000 (Ethernet) RX packets 10234 bytes 1179158 (1.1 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2 bytes 220 (220.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 qr-efba8867-b7: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::f816:3eff:fe8a:e255 prefixlen 64 scopeid 0x20<link> ether fa:16:3e:8a:e2:55 txqueuelen 1000 (Ethernet) RX packets 36 bytes 2804 (2.7 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 7 bytes 738 (738.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@node-191 ~(keystone_admin)]# ps axu | grep keep # 查看keepalived进程,可以看下keepalived.conf里面内容 root 9403 0.0 0.0 112224 1304 ? Ss Apr06 0:04 /usr/sbin/keepalived -D root 9404 0.0 0.0 114444 3016 ? S Apr06 0:04 /usr/sbin/keepalived -D root 9405 0.0 0.0 114320 2432 ? S Apr06 0:36 /usr/sbin/keepalived -D root 10956 0.0 0.0 112224 1336 ? Ss 17:11 0:00 keepalived -P -f /var/lib/neutron/ha_confs/25b9d299-ed2a-469f-8246-1d24ac6f0e15/keepalived.conf -p /var/lib/neutron/ha_confs/25b9d299-ed2a-469f-8246-1d24ac6f0e15.pid -r /var/lib/neutron/ha_confs/25b9d299-ed2a-469f-8246-1d24ac6f0e15.pid-vrrp root 11225 0.0 0.0 114320 2424 ? S 17:12 0:00 keepalived -P -f /var/lib/neutron/ha_confs/25b9d299-ed2a-469f-8246-1d24ac6f0e15/keepalived.conf -p /var/lib/neutron/ha_confs/25b9d299-ed2a-469f-8246-1d24ac6f0e15.pid -r /var/lib/neutron/ha_confs/25b9d299-ed2a-469f-8246-1d24ac6f0e15.pid-vrrp # 同样地进入到node-192的router namespace下,查看一些网络配置情况 169.254.192.0/18: 这是keepalived心跳检测网段
限制
每个tenant最多只能有255个HA的virtual router,因为VRID只有8位。还有每个tenant只能有一个
administrative network
参考链接
https://wiki.openstack.org/wiki/Neutron/L3_High_Availability_VRRP
http://www.openstack.cn/p2510.html
本文出自 “the-way-to-cloud” 博客,请务必保留此出处http://iceyao.blog.51cto.com/9426658/1629720
原文地址:http://iceyao.blog.51cto.com/9426658/1629720