zoukankan      html  css  js  c++  java
  • 安装 局域网用的dns服务器,为多环境k8s的ip地址解耦合

    安装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

    /etc/resolv.dnsmasq.conf
    nameserver 10.0.3.88
    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
    
  • 相关阅读:
    四则运算2
    大二第二学期阅读计划
    第一周课堂练习
    《人月神话》读后感
    软件工程概论总结第十一章
    软件工程概论总结第十章
    软件工程概论总结第九章
    软件工程概论总结第八章
    软件工程概论总结第七章
    第五章、软件过程中的形式化方法
  • 原文地址:https://www.cnblogs.com/nocanstillbb/p/12991112.html
Copyright © 2011-2022 走看看