首页 > 代码库 > 中小企业openstack私有云布署实践【18 修改实例DHCP服务的DNS IP】
中小企业openstack私有云布署实践【18 修改实例DHCP服务的DNS IP】
某天,由于Linux服务器默认没有DNS缓存功能,每次服务器每访问一个http域名链接时,都会触发一次DNS域名解析查询,降低了调用API接口的时延,所以我司后续启用的内网的dnsmasq DNS服务功能,需要将实例的DNS IP进行修改
登录一台controller
source admin-openrc.sh
neutron subnet-list
+--------------------------------------+---------------------------------------------------+------------------+------------------------------------------------------+
| id | name | cidr | allocation_pools |
+--------------------------------------+---------------------------------------------------+------------------+------------------------------------------------------+
| 333b430f-bffe-47ed-9c1c-14a33618f569 | HA subnet tenant 18649c1da2594d31988fd26baf15252b | 169.254.192.0/18 | {"start": "169.254.192.1", "end": "169.254.255.254"} |
| 358321c0-6cbc-4ed7-a9e3-d8e7c3a6cf3a | 17216150 | 172.16.150.0/24 | {"start": "172.16.150.11", "end": "172.16.150.253"} |
| 291efb02-af77-429f-bc9e-95b714a804da | 1040100 | 10.40.100.0/24 | {"start": "10.40.100.10", "end": "10.40.100.253"} |
| ed517a74-736c-431d-8dd9-2b632395e6bb | 1040200 | 10.40.200.0/24 | {"start": "10.40.200.10", "end": "10.40.200.253"} |
| 419229d1-45d9-4aec-9fdf-e9fde3d58757 | 17216100 | 172.16.100.0/24 | {"start": "172.16.100.11", "end": "172.16.100.253"} |
| f7a13116-d091-4ad5-94fd-77a3c3f01ab5 | 1040150 | 10.40.150.0/24 | {"start": "10.40.150.10", "end": "10.40.150.253"} |
| f8b5705f-a45e-4498-bea4-8c104a873fab | 17216200 | 172.16.200.0/24 | {"start": "172.16.200.11", "end": "172.16.200.253"} |
+--------------------------------------+---------------------------------------------------+------------------+------------------------------------------------------+
查看17216150网段的详情,看到它使用的DNS为114
[root@controller1 ~]# neutron subnet-show 358321c0-6cbc-4ed7-a9e3-d8e7c3a6cf3a
+-------------------+-----------------------------------------------------+
| Field | Value |
+-------------------+-----------------------------------------------------+
| allocation_pools | {"start": "172.16.150.11", "end": "172.16.150.253"} |
| cidr | 172.16.150.0/24 |
| dns_nameservers | 114.114.114.114 |
| enable_dhcp | True |
| gateway_ip | |
| host_routes | |
| id | 358321c0-6cbc-4ed7-a9e3-d8e7c3a6cf3a |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | 17216150 |
| network_id | 2b32fcf5-1db9-4972-a077-219d520624a3 |
| subnetpool_id | |
| tenant_id | 18649c1da2594d31988fd26baf15252b |
+-------------------+-----------------------------------------------------+
修改它的DNS地址iP。还支持优先级。这个操作是覆盖型的。
neutron subnet-update 358321c0-6cbc-4ed7-a9e3-d8e7c3a6cf3a --dns_nameservers list=true 10.40.200.100 114.114.114.114
Updated subnet: 358321c0-6cbc-4ed7-a9e3-d8e7c3a6cf3a
[root@controller1 ~]# neutron subnet-show 358321c0-6cbc-4ed7-a9e3-d8e7c3a6cf3a
+-------------------+-----------------------------------------------------+
| Field | Value |
+-------------------+-----------------------------------------------------+
| allocation_pools | {"start": "172.16.150.11", "end": "172.16.150.253"} |
| cidr | 172.16.150.0/24 |
| dns_nameservers | 10.40.200.100 |
| | 114.114.114.114 |
| enable_dhcp | True |
| gateway_ip | |
| host_routes | |
| id | 358321c0-6cbc-4ed7-a9e3-d8e7c3a6cf3a |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | 17216150 |
| network_id | 2b32fcf5-1db9-4972-a077-219d520624a3 |
| subnetpool_id | |
| tenant_id | 18649c1da2594d31988fd26baf15252b |
+-------------------+-----------------------------------------------------+
此操作是针对要新建和启动的VM虚拟机有效,老的,已启动的VM,默认不会修改,可通过配置管理工具,比如saltstack,将服务器上的/etc/resolv.conf配置文件进行批量修改,并实时生效。
中小企业openstack私有云布署实践【18 修改实例DHCP服务的DNS IP】
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。