码迷,mamicode.com
首页 > 其他好文 > 详细

安装 局域网用的dns服务器,为多环境k8s的ip地址解耦合

时间:2020-05-30 11:12:12      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:where   server   pre   ecs   efault   rom   ip add   str   code   

安装dnsmasq

yum -y install dnsmasq

配置

vim /etc/mnsmasq.conf

修改以下几个数据

# Change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf
resolv-file=/etc/resolv.dnsmasq.conf
# By  default,  dnsmasq  will  send queries to any of the upstream
# servers it knows about and tries to favour servers to are  known
# to  be  up.  Uncommenting this forces dnsmasq to try each query
# with  each  server  strictly  in  the  order  they   appear   in
# /etc/resolv.conf
strict-order


# Or which to listen on by address (remember to include 127.0.0.1 if
# you use this.)
listen-address=监听的本地IP

添加解析

# Add domains which you want to force to an IP address here.
# The example below send any host in double-click.net to a local
# web-server.
#address=/double-click.net/127.0.0.1

address=/k8s.haoyun.com.vip/10.7.1.200

address=/k8s.haoyun.com.m1/10.7.1.201
address=/k8s.haoyun.com.m2/10.7.1.202
address=/k8s.haoyun.com.m3/10.7.1.203

address=/k8s.haoyun.com.n1/10.7.1.211
address=/k8s.haoyun.com.n2/10.7.1.212
address=/k8s.haoyun.com.n3/10.7.1.213
address=/k8s.haoyun.com.n4/10.7.1.214
address=/k8s.haoyun.com.n5/10.7.1.215
address=/k8s.haoyun.com.n6/10.7.1.216

address=/k8s.haoyun.com.w1/10.7.1.221
address=/k8s.haoyun.com.w2/10.7.1.222
address=/k8s.haoyun.com.w3/10.7.1.223
address=/k8s.haoyun.com.w4/10.7.1.224

# Add other name servers here, with domain specs if they are for
# non-public domains.
#server=10.7.1.201

设置上游dns

nameserver 10.7.1.201
nameserver 8.8.8.8

在其他linux机器上设置dns服务器

#  vi /etc/resolv.conf
# Generated by NetworkManager
nameserver 10.7.1.201
nameserver 10.0.3.88
:wq
测试
#nslookup www.baidu.com
Server:		10.0.3.88
Address:	10.0.3.88#53

安装 局域网用的dns服务器,为多环境k8s的ip地址解耦合

标签:where   server   pre   ecs   efault   rom   ip add   str   code   

原文地址:https://www.cnblogs.com/nocanstillbb/p/12991112.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!