Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
nsznsznsz
V2EX  ›  Linux

怎么给 dnsmasq 设置从一个域名映射到另一个域名?

  •  
  •   nsznsznsz · Aug 1, 2017 · 4960 views
    This topic created in 3240 days ago, the information mentioned may be changed or developed.
    比如我想把我自己定义的一个域名比如 test.abc.com 映射成 tieba.baidu.com

    也就是当我想解析 test.abc.com 的时候实际去解析 tieba.baidu.com ,然后返回 tieba.baidu.com 对应的 IP

    应该怎么配置?这用 dnsmasq 能做到吗?
    6 replies    2017-08-02 13:51:05 +08:00
    sneezry
        1
    sneezry  
       Aug 1, 2017 via iPhone
    cname 么
    isCyan
        2
    isCyan  
       Aug 1, 2017 via Android
    这不就是 cname 吗,test.abc.com 设置 cname 记录指向 tieba.baidu.com
    wuwuyun
        3
    wuwuyun  
       Aug 1, 2017
    dnsmasq 里是可以配置的
    加一条 cname=xxx.xxx,target

    但是 target 域名必须要在 /etc/hosts 里面或者其他地方有指向

    There are significant limitations on the target; it must be a DNS name which is known to dnsmasq from /etc/hosts (or additional hosts files), from DHCP, from --interface-name or from another --cname.
    nsznsznsz
        4
    nsznsznsz  
    OP
       Aug 1, 2017
    那这样不就是写死了吗?。。target 不能动态获取 IP 了
    nsznsznsz
        5
    nsznsznsz  
    OP
       Aug 1, 2017
    @wuwuyun 这样不就是写死了吗?。。target 不能动态获取 IP 了
    wuwuyun
        6
    wuwuyun  
       Aug 2, 2017
    @nsznsznsz 还想怎么动态,写了 /etc/hosts 又不是不能改
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5587 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 07:34 · PVG 15:34 · LAX 00:34 · JFK 03:34
    ♥ Do have faith in what you're doing.