作用
neutron 管理了 openstack 中的网络
neutron 中, dhcp agent 用于为 openstack 网络分配 dhcp ip 地址
查询
查询网络
参考当前 openstack 环境中具有多少个网络环境
[root@hh-yun-puppet-129021 ~]# source /home/terry/keystonerc_admin
[root@hh-yun-puppet-129021 ~(keystone_admin)]# neutron net-list
+--------------------------------------+------------+------------------------------------------------------+
| id | name | subnets |
+--------------------------------------+------------+------------------------------------------------------+
| 0007150e-b600-4ea6-841d-79261bf10af8 | QA_NET | ecc5f5a4-1fd7-4428-9351-6809ada3ad08 10.199.160.0/19 |
| 1e984167-3d90-49c0-91ad-b3910326fa5b | OPS_NET | c2844b96-c26b-483d-b7fe-c2c37ff75cec 10.199.134.0/24 |
| 2530bdb0-8910-47d8-bcd5-696325c0cf7e | DMZ5_NET | 35267c69-b8f1-4e5f-9784-5d49db020944 10.199.52.0/24 |
| 36c8028c-3ddb-44fb-b232-8eed3ee1c357 | DMZ1_NET | 6b70aad7-3547-4d8d-9ab6-d73d080db88f 10.199.48.0/24 |
| 56886b13-e1a5-4213-8456-3616875a6a45 | MOBILE_NET | b18f5475-d334-4726-9508-b161e5998aed 10.199.144.0/20 |
| 594a0802-d2df-4aa1-9b49-3a0c4caa55c0 | DMZ3_NET | 1bda2357-268f-4683-b21b-d1f69da62a9b 10.199.50.0/24 |
| a46f6060-bfd2-44af-b90c-858ca62f19da | MGMT_NET | 91f2dc9f-9500-4615-989f-0d1562ab3c02 10.199.132.0/24 |
| bd780fa9-33fb-4757-887c-c1821630a15b | DMZ4_NET | af474d04-baa0-4410-ac6f-3d7d282b95d6 10.199.51.0/24 |
| c3a26318-9741-4067-bd29-49124ac40970 | DMZ6_NET | 2ec35a77-db91-4a9b-9497-ae3bef74035e 10.199.53.0/24 |
| d107fe05-0fe9-4fea-9325-4cf2d0825101 | DEV_NET | b0bd1964-ef05-4aec-a602-9dc6a97ef9fd 10.199.192.0/18 |
| db1786d1-b8c8-4d27-a4d1-6890d6162557 | QATOOL_NET | b986aeff-f3ba-4f18-9138-f39a6fef323d 10.199.133.0/24 |
| e302ca3a-dc19-4387-90ef-f5eb188e98cd | TEST_NET | 1b2ea04c-060a-4f6e-a8d6-66754f90c530 10.199.64.0/22 |
| f49a7526-ccbc-4d65-8169-433d19733887 | DMZ2_NET | d3c4da60-6ef1-4c1a-965a-036639ab62f1 10.199.49.0/24 |
+--------------------------------------+------------+------------------------------------------------------+
查询 dhcp agent
[root@hh-yun-puppet-129021 ~(keystone_admin)]# neutron agent-list | grep 'DHCP agent'
| 70a4a4f7-095f-477f-947d-1101c09f94b6 | DHCP agent | hh-yun-db-129041.vclound.com | :-) | True |
| 7a479ea9-6041-4ad2-9f17-8cc3e5dd6511 | DHCP agent | hh-yun-db-129042.vclound.com | :-) | True |
在当前用环境中, 已经具有两个 dhcp agent 可以为网路分配 IP 地址
分配 dhcp agent
作为高可用, 计划把两个 dhcp agent 都分配到每个网络中
帮助
[root@hh-yun-puppet-129021 ~(keystone_admin)]# neutron dhcp-agent-network-add
usage: neutron dhcp-agent-network-add [-h] [--request-format {json,xml}]
dhcp_agent network
neutron dhcp-agent-network-add: error: too few arguments
添加
[root@hh-yun-puppet-129021 ~(keystone_admin)]# neutron dhcp-agent-network-add 7a479ea9-6041-4ad2-9f17-8cc3e5dd6511 QA_NET
Added network QA_NET to DHCP agent
[root@hh-yun-puppet-129021 ~(keystone_admin)]# neutron dhcp-agent-network-add 7a479ea9-6041-4ad2-9f17-8cc3e5dd6511 OPS_NET
Added network OPS_NET to DHCP agent
参考上述例子, 把 dhcp agent 添加到每个网络中去
查询网络对应的 dhcp agent
[root@hh-yun-puppet-129021 ~(keystone_admin)]# neutron dhcp-agent-list-hosting-net QA_NET
+--------------------------------------+------------------------------+----------------+-------+
| id | host | admin_state_up | alive |
+--------------------------------------+------------------------------+----------------+-------+
| 70a4a4f7-095f-477f-947d-1101c09f94b6 | hh-yun-db-129041.vclound.com | True | :-) |
| 7a479ea9-6041-4ad2-9f17-8cc3e5dd6511 | hh-yun-db-129042.vclound.com | True | :-) |
+--------------------------------------+------------------------------+----------------+-------+
[root@hh-yun-puppet-129021 ~(keystone_admin)]# neutron dhcp-agent-list-hosting-net OPS_NET
+--------------------------------------+------------------------------+----------------+-------+
| id | host | admin_state_up | alive |
+--------------------------------------+------------------------------+----------------+-------+
| 70a4a4f7-095f-477f-947d-1101c09f94b6 | hh-yun-db-129041.vclound.com | True | :-) |
| 7a479ea9-6041-4ad2-9f17-8cc3e5dd6511 | hh-yun-db-129042.vclound.com | True | :-) |
+--------------------------------------+------------------------------+----------------+-------+
验证, 当前每个网络都具有两个可以分配 IP 地址的 DHCP AGENT
时间: 2024-10-03 13:34:35