zoukankan      html  css  js  c++  java
  • DNS 转发配置

    DNS 转发配置
    • 我们配置DNS是只能解析我们定义的zone的,我们没有定义的是不能解析的。
    • 配置DNS转发就可以解析其他互联网上的域名了,前提是这个域名在互联网中的企业在使用。
    • 也就是说这个域名已经被某个DNS服务器解析了。

    1、修改DNS主配置文件,options参数下添加

    vim /etc/named.conf

    options {
        # 域文件存放目录
        directory "/var/named";
        # 开启转发
        forward first;
        # 转发到哪个DNS
        forwarders { 180.76.76.76; };
    };

    2、测试配置文件,重启

    # 测试配置文件,是否正确
    named-checkconf
    # 重启DNS服务
    /etc/init.d/named restart

    3、测试转发

    dig @192.168.1.160 www.jd.com
     
    ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> @192.168.1.160 www.jd.com
    ; (1 server found)
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50736
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
     
    ;; QUESTION SECTION:
    ;www.jd.com. IN A
     
    ;; ANSWER SECTION:
    www.jd.com. 102 IN CNAME www.jdcdn.com.
    www.jdcdn.com. 5 IN A 218.60.111.1
     
    ;; Query time: 60 msec
    ;; SERVER: 192.168.1.160#53(192.168.1.160)
    ;; WHEN: Sun Dec 24 09:31:18 2017
    ;; MSG SIZE rcvd: 68
    测试域名转发
    # 在另一台机器内添加 192.168.1.160 DNS 服务
    vim /etc/resolv.conf
    nameserver 192.168.1.160
    测试
    ping www.baidu.com
    # 跳转到 192.168.1.171 说明可以正向解析出IP地址
    PING www.baidu.com (192.168.1.171) 56(84) bytes of data.
    From heartbeat2 (192.168.1.161) icmp_seq=1 Destination Host Unreachable
    From heartbeat2 (192.168.1.161) icmp_seq=2 Destination Host Unreachable
    From heartbeat2 (192.168.1.161) icmp_seq=3 Destination Host Unreachable
    From heartbeat2 (192.168.1.161) icmp_seq=5 Destination Host Unreachable
     
    ping www.jd.com
    # DNS服务器 本地没有解析后,转发到给180.76.76.76DNS
    PING www.jdcdn.com (218.60.111.1) 56(84) bytes of data.
    64 bytes from 218.60.111.1: icmp_seq=1 ttl=56 time=21.5 ms
    64 bytes from 218.60.111.1: icmp_seq=2 ttl=56 time=17.7 ms
    另一台机器 测试域名转发
  • 相关阅读:
    codeforces #322 div 2 D. Three Logos (枚举)
    hdu 5481||bestcoder #57 div 2 C Desiderium ()
    codeforces #322 div 2 C. Developing Skills(思路)
    codeforces #322 div 2 B. Luxurious Houses (思路)
    codeforces #322 div 2 A. Vasya the Hipster(随便搞)
    [转自codeforces] How to come up with the solutions: techniques
    uva 489
    hdoj 5479 || bestcoder #57 div 2 A Scaena Felix(模拟)
    hdu 5480|| bestcoder   #57 div 2 Conturbatio(前缀和||树状数组)
    支付宝和内购的区别以及集成方法
  • 原文地址:https://www.cnblogs.com/xiangsikai/p/8438544.html
Copyright © 2011-2022 走看看