zoukankan      html  css  js  c++  java
  • docker部署coredns

    示例:

    [root@corends coredns]# cd /home/coredns/
    [root@corends coredns]# ls -al
    total 12
    drwxr-xr-x  2 root root   61 Sep 12 11:40 .
    drwxr-xr-x. 4 root root   51 Sep 16 16:06 ..
    -rwxr-xr-x  1 root root  120 Sep  6 11:33 Corefile
    -rwxr-xr-x  1 root root 1522 Sep 12 11:40 hosts
    -rw-r--r--  1 root root  199 Sep  6 11:33 install-coredns.sh
    [root@corends coredns]# cat install-coredns.sh 
    #!/bin/bash
    
    docker run -d 
      --restart always 
      --name coredns 
      -p 53:53/tcp 
      -p 53:53/udp 
      -v /home/coredns/hosts:/etc/hosts 
      -v /home/coredns/Corefile:/Corefile 
      coredns/coredns
    [root@corends coredns]# cat Corefile 
    .:53 {
        hosts {
            fallthrough
        }
        forward . 202.96.128.86 114.114.114.114 8.8.8.8
        errors
        cache
    }
    [root@corends coredns]# cat hosts 
    # 根据实际需要修改
    192.168.0.200 devgz.yaohjk.com
    192.168.0.200 devboss.yaohjk.com
    192.168.0.200 devlogin.yaohjk.com
    192.168.0.200 devpay.yaohjk.com
    192.168.0.200 devwx.yaohjk.com
    
    192.168.0.200 gz.yaohuiw.net
    192.168.0.200 boss.yaohuiw.net
    192.168.0.200 login.yaohuiw.net
    192.168.0.200 pay.yaohuiw.net
    192.168.0.200 wx.yaohuiw.net
    
    
    192.168.0.199 gz.yaohjk.com
    192.168.0.199 boss.yaohjk.com
    192.168.0.199 login.yaohjk.com
    192.168.0.199 pay.yaohjk.com
    192.168.0.199 wx.yaohjk.com
    
    192.168.0.198 boss.yaohuiw.xyz
    192.168.0.198 gz.yaohuiw.xyz
    192.168.0.198 login.yaohuiw.xyz
    192.168.0.198 pay.yaohuiw.xyz
    192.168.0.198 wx.yaohuiw.xyz
    [root@corends coredns]#

    验证:

    [root@test2 ~]# cat /etc/resolv.conf 
    # Generated by NetworkManager
    nameserver 192.168.0.246
    
    
    
    [root@test2 ~]# nslookup devgz.yaohjk.com
    Server:        192.168.0.246
    Address:    192.168.0.246#53
    
    Name:    devgz.yaohjk.com
    Address: 192.168.0.200
    ** server can't find devgz.yaohjk.com: NXDOMAIN
    
    [root@test2 ~]# nslookup gz.yaohjk.com
    Server:        192.168.0.246
    Address:    192.168.0.246#53
    
    Name:    gz.yaohjk.com
    Address: 192.168.0.199
  • 相关阅读:
    关于栈部分知识点
    面向对象--四则运算
    转型第一步
    输入输出文件版本——计算题
    作业二
    2017《面向对象程序设计》课程作业一
    第四次作业
    light oj 1079
    Light oj 1080
    Codeforces 486B OR in Matrix【水题】
  • 原文地址:https://www.cnblogs.com/jiangwenhui/p/11912318.html
Copyright © 2011-2022 走看看