neutron dhcp ha 实验
4个节点(controller, network,2 compute nodes)
1.0 on the network node
1.1
set –I ‘s/start] on/#start\ on/g’ /etc/init/neutron-dhcp-agent.conf
1.2 Stop dhcp agent”
service neutron-dhcpagent stop
2.0 on the compute node1
2.1
install the dhcp agent:
apt-get install neutron-dhcp-agent -y
2.2 mv /etc/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini.bk
2.3
拷贝网络节点的配置到计算节点node1
mv network:/etc/neutron/dhcp_agent.ini
/etc/neutron/dhcp_agent.ini.
2.4
启动node1上的dhcp agent
service neutron-dhcp-agent restart
3.0 On compute node 2
3.1 和node1一样,同样在node2上启动dhcp-agent
4.0 On the controller node
4.1 查看agent的状态:neutron agent-list
4.2
创建network
“private”和相应的subnet
neutron net-create private
neutron subnet-create –name private-subnet private 10.0.0.0/29
4.3
创建network
“private1”和相应的subnet
neutron net-create private1
neutron subnet-create –name private1-subnet private1 10.0.1.0/29
4.4
在private上启动一个instance,private1上启动2个instance
nova boot –image cirros-qcow2 –flavor 1 –nic net-id=<private net is>
private one
nova boot –image cirros-qcow2 –flavor 1 –nic net-id=<private1 net is> private1 two
nova boot –image cirros-qcow2 –flavor 1 –nic net-id=<private1 net is> private1 three
4.5 nova list
5.0 on node1 和node2
5.1
ip netns
可以看到network namespaces
6.0 on controller node
6.1 查找dhcp agent 的ID
6.2
查找那个dhcp agent 服务private 和private1
neutron dhcp-agent-list-hosting-net private
neutron dhcp-agent-list-hosting-net private1
6.3 或者查找private(1)上都有哪些dhcp agent
Neutron net-list-on-dhcp-agent <dhcp agent ID on node1>
Neutron net-list-on-dhcp-agent <dhcp agent ID on node2>
6.4 检查2个dhcp agent
Neutron agent-show <dhcp agent ID on node1>
Neutron agent-show
<dhcp agent ID on node2>
可以看到neutron 会track每个agent的heartbeat信息
6.5 为每个网络private(1) 部署 DHCP HA(需要为每个network添加?)
Neutron dhcp-agent-network-add <dhcp agent ID on node2> private1
Neutron dhcp-agent-network-add <dhcp agent ID on node1> private2
6.6 验证每个网络都有2个agent
neutron dhcp-agent-list-hosting-net private
neutron dhcp-agent-list-hosting-net private1
6.7 log in instance3,通过node1(2)上的netns
ip netns exec <qdhcp-network id> ssh cirros@instance3
6.8 停掉node2 上的agent
Killall dnsmasq
Service neutron-dhcp-agent stop
6.9 用udhcpc验证instance3依然可以得到IP
ip netns exec <qdhcp-network id> ssh cirros@instance3
- on instance3
sudo udhcpc
7.0 on controller and node1(2)
7.1 移除已经stop的node2上的agent
Neutron agent-delete <dhcp agent ID on node2>
7.2 验证node2上的agent不在
Neutron agent-list
7.3 重启node2上的agent
Service neutron-dhcp-agent restart
7.4 验证node2的agent又回来了
Neutron agent-list