本网站不收集任何访问者的行为与信息,不做任何商业运作,仅仅为个人使用。闽ICP备17026139号-1

在本机配置 CNAME

  1. 安装 dnsmasq

    sudo apt-get install dnsmasq
    
  2. 配置 dnsmasq

    vi /etc/dnsmasq.d/test.conf # 随便开一个文件
    

    填入:

    cname=from.gaubee.com,to.gaubee.com
    
  3. 修改本地 dns 配置:

    vi /etc/resolv.conf
    # 添加一行 nameserver 127.0.0.1
    

    最终我自己本地这个文件是这样的

    # This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
    # [network]
    # generateResolvConf = false
    nameserver 127.0.0.1
    nameserver 172.19.208.1
    
  4. 最后启动 dnsmasq 即可:

    /etc/init.d/dnsmasq start
    

    它会监听本地 53 断开(DNS 服务的端口),如果报端口占用。那么查看一下占用程序

    sudo lsof -i -P -n | grep LISTEN