神代綺凛

[ChinaDNS] 无污染的智能路由 DNS 折腾记 #2
这篇文章算是上一篇文章的完善,教你如何将 ChinaDNS 与 DNSMasq 结合起来用,使其更加稳定并且可以支...
扫描右侧二维码阅读全文
19
2018/05

[ChinaDNS] 无污染的智能路由 DNS 折腾记 #2

这篇文章算是上一篇文章的完善,教你如何将 ChinaDNS 与 DNSMasq 结合起来用,使其更加稳定并且可以支持 TCP 查询

Head Pic: 「チャンのエリ」/「はれんちとめこ」[pixiv]

ChinaDNS + DNSMasq

之前一篇文章讲到了如何搭建 ChinaDNS 以及关于 DNS 污染现象的详细说明,但是单纯使用 ChinaDNS 可能会不稳定,并且只支持通过UDP53端口进行查询

因此,我们最好是使用 DNSMasq 作为主 DNS 服务端,将 ChinaDNS 作为 DNSMasq 的上游 DNS

以下部署过程在我两篇文章里独有讲到,但是这里会对某些步骤稍作修改,想了解关于 DNSMasq 和 ChinaDNS 的更多内容可以看我在文章末尾留的两篇文章

ChinaDNS

1. 下载并编译

  1. 如果你的系统中没有makegcc就需要先安装
    # Ubuntu / Debian
    apt-get install -y make gcc
    # CentOS
    yum install -y make gcc
  2. 下载 ChinaDNS 源码并解压编译
    cd /root
    wget --no-check-certificate  https://github.com/shadowsocks/ChinaDNS/releases/download/1.3.2/chinadns-1.3.2.tar.gz
    tar -zxvf chinadns-1.3.2.tar.gz
    mv chinadns-1.3.2 chinadns
    cd chinadns
    ./configure && make
  3. 更新 chnrouter
    # In /root/chinadns
    curl 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' | grep ipv4 | grep CN | awk -F\| '{ printf("%s/%d\n", $4, 32-log($5)/log(2)) }' > chnroute.txt

2. 配置 supervisor 守护进程

防止 ChinaDNS 进程挂掉
如果你的系统中已经有 supervisor,那么忽略安装步骤,酌情参考除了安装之外的配置步骤

  1. 安装
    # python2
    pip install supervisord
    # python3
    pip install git+https://github.com/Supervisor/supervisor
  2. 初始化并修改配置文件
    此处和原先不一样的一点:让 ChinaDNS 在8053端口(或者其他非53端口)监听,因为我们要让它做 DNSMasq 的上游 DNS
    echo_supervisord_conf > /etc/supervisord.conf
    echo "[program:chinadns]
    command=/root/chinadns/src/chinadns -p 8053 -m -c /root/chinadns/chnroute.txt -s 114.114.114.114,208.67.222.222:443
    user = root
    autostart = true
    autorestart = true" >> /etc/supervisord.conf
  3. 添加 supervisor 开机自启
    echo "supervisord -c /etc/supervisord.conf" >> /etc/rc.local
    # 执行此命令以防系统没有权限执行开机自启脚本(by youngerzhong)
    chmod +x /etc/rc.local

    之后查看/etc/rc.local文件,如果有exit 0这行,就把它移动到文件的最后一行,即保证我们上面添加的这句在exit 0前面

  4. 启动 supervisor

    supervisord -c /etc/supervisord.conf

    然后查看程序运行状态

    supervisorctl status

    如果有输出 chinadns 的运行状态RUNNING就说明成功了

    此时可以用dig命令检查一下看 ChinaDNS 是否有正常运作

    dig www.pixiv.net @127.0.0.1 -p 8053

DNSMasq

如果你已经有 DNSMasq,那么忽略安装步骤,酌情参考除了安装之外的配置步骤

1. 安装

Ubuntu / Debian

apt-get install dnsmasq

CentOS

由于 CentOS 的yum安装的 DNSmasq 版本比较旧,因此我们可以先下载最新版编译好,用yum安装完之后再替换掉程序。

先从 http://www.thekelleys.org.uk/dnsmasq/ 找到你想要的 DNSmasq 版本的源码压缩包的下载地址,例如我选择的是我写这篇文章时的最新版dnsmasq-2.79.tar.gz

下载对应的源码压缩包并解压

cd /root
wget http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.79.tar.gz
tar xf dnsmasq-2.79.tar.gz

编译,源码 make 不带 etc 等

cd dnsmasq-2.79
make V=s

然后用 yum 安装 DNSmasq

yum install dnsmasq

yum 安装的是2.4.8版本,然后我们再用我们编译好的最新版本替换

yes | cp -f ./src/dnsmasq /usr/sbin/dnsmasq

这时可以查看 DNSmasq 的版本检验一下

dnsmasq -v

看一下版本号,应该就是我们编译好的版本了

2. 配置

编辑/etc/dnsmasq.conf文件,将下面提到的配置项解除注释并进行更改

# 指定监听 53 端口
port=53

# 禁止 DNSMasq 使用 resolv.conf
no-resolv
no-poll

# 指定监听IP,将 x.x.x.x 换成你的 eth0 网卡IP(用 ifconfig 命令查看)
listen-address=127.0.0.1,x.x.x.x

# 指定额外配置文件夹
conf-dir=/etc/dnsmasq.d/

如果你比较懒不想找而且只需要用 DNSMasq 做到本文所述功能,也可以直接
(注意替换x.x.x.x

echo "port=53
no-resolv
no-poll
listen-address=127.0.0.1,x.x.x.x
conf-dir=/etc/dnsmasq.d/" > /etc/dnsmasq.conf

然后运行以下命令写入配置以将 ChinaDNS 作为上游 DNS

echo "server=127.0.0.1#8053" > /etc/dnsmasq.d/chinadns.conf

重启 DNSMasq

/etc/init.d/dnsmasq restart

3. 开放安全组/防火墙端口

这里只是特别提醒一下记得开放,特别是部分 IDC 是有“安全组”的,记得开放53端口的 TCP 和 UDP

其余的iptables操作这里就不教了,因为一般都是全开放,或者去百度一下

相关文章

搬瓦工VPS优惠套餐,建站稳如狗,支持支付宝,循环出账94折优惠码BWH3HYATVBJW
年付$47CN2线路,1核/1G内存/20G硬盘/1T@1Gbps【点击购买
季付$47CN2 GIA线路,1核/1G内存/20G硬盘/1T@2.5Gbps【点击购买
Last modification:February 9th, 2019 at 12:59 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment Cancel reply

67 comments

  1. scegg  Mac OS X 10.14.4(Mac OS X 10.14.4) / Google Chrome 74.0.3729.6(Google Chrome 74.0.3729.6)
    测试出一个问题:在运行了一段时间后,chinadns没有反应,几个DNS都通畅,但supervisord报告它状态是RUNNING,看来是内部死锁。
    打算搞个dig测试,丢到crontab去。

    另外,chinadns那个-d参数是什么意思啊。。文档写的很迷。

    1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 73.0.3683.75(Google Chrome 73.0.3683.75)
      @scegg 这毕竟已经是几年没维护的了,我现在在用 overture
      博客里也有文章
  2. scegg  Mac OS X 10.14.4(Mac OS X 10.14.4) / Google Chrome 74.0.3729.6(Google Chrome 74.0.3729.6)
    对于没有rc.local的机器,有时候直接建立rc.local也许不会被执行。如果机器使用了systemd,可以通过下面的方式,直接创建一个sysmtemd的服务来启动supervisord:

    文件:/etc/systemd/system/supervisord.service
    [Unit]
    Description=superviosrd
    After=network.target

    [Service]
    Type=forking
    ExecStart=supervisord -c /etc/supervisord.conf

    [Install]
    WantedBy=multi-user.target
    ————文件结束————

    设置为自动启动(不会立即启动程序):
    systemctl enable supervisord
    手工启动程序:
    systemctl start supervisord
    关闭自动启动(不会立即结束程序):
    systemctl disable supervisord

    注意不要丢了Type=forking

    1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 73.0.3683.75(Google Chrome 73.0.3683.75)
  3. scegg  Mac OS X 10.14.4(Mac OS X 10.14.4) / Google Chrome 74.0.3729.6(Google Chrome 74.0.3729.6)
    测试部署在多个设备上,有一台机器出现了一个奇怪问题:
    dig测试报告:返回包未来自127.0.0.1,而是来自本机的一个网卡地址。
    chinadns未指定-b。
    如果指定-b,不论是到127.0.0.1还是这个网卡地址,都彻底无回应信息。
    只能在不指定-b的情况下,修改dnsmasq的指向地址作罢。

    如果有人有类似dig的测试结果,祝你们绕过此坑。

  4. scegg  Mac OS X 10.14.4(Mac OS X 10.14.4) / Google Chrome 74.0.3729.6(Google Chrome 74.0.3729.6)
    疑问:
    这种方式启动的chinadns,会去读取iplist.txt嘛。毕竟没有指定它的位置。
    1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 73.0.3683.75(Google Chrome 73.0.3683.75)
      @scegg 可以加-v参数看看它启动时具体做了什么
      1. scegg  Mac OS X 10.14.4(Mac OS X 10.14.4) / Google Chrome 74.0.3729.6(Google Chrome 74.0.3729.6)
        @神代綺凜 测试了一下,需要用-l指定iplist才可以。
  5. scegg  Mac OS X 10.14.4(Mac OS X 10.14.4) / Google Chrome 74.0.3729.6(Google Chrome 74.0.3729.6)
    在ubuntu上,supervisord安装后并不会建立默认的/etc/supervisord.conf,因此还需要将默认配置文件中的非注释部分手工加过去才行。

    https://github.com/Supervisor/supervisor/blob/master/supervisor/skel/sample.conf

    1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 73.0.3683.75(Google Chrome 73.0.3683.75)
      @scegg 其实会建立/etc/supervisor/supervisord.conf,直接使用这个就行了

      或者直接在/etc/supervisor/conf.d/中新建配置文件更好

      1. scegg  Mac OS X 10.14.4(Mac OS X 10.14.4) / Google Chrome 74.0.3729.6(Google Chrome 74.0.3729.6)
        @神代綺凜 nvm,发现/etc/supervisor/supervisord.conf 也没有建立hhh
        1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 73.0.3683.75(Google Chrome 73.0.3683.75)
          @scegg 正常安装应该都会有的呀(
          1. scegg  Mac OS X 10.14.4(Mac OS X 10.14.4) / Google Chrome 74.0.3729.6(Google Chrome 74.0.3729.6)
            @神代綺凜 我用pip3装的。
            没差了,linux总是充满了各种不正常。总之留下了默认的config,需要的人就自己复制下内容吧。
      2. scegg  Mac OS X 10.14.4(Mac OS X 10.14.4) / Google Chrome 74.0.3729.6(Google Chrome 74.0.3729.6)
        @神代綺凜 如果不指定配置文件位置,会默认使用/etc/supervisor/supervisord.conf 嘛?
        1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 73.0.3683.75(Google Chrome 73.0.3683.75)
          @scegg 会,supervisor 有几个默认配置路径,会依次寻找

          http://supervisord.org/configuration.html#configuration-file

  6. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 71.0.3578.98(Google Chrome 71.0.3578.98)
    改一下8,毕竟现在python3的supervisord没有进apt-get包管理器,
    然后现在很多项目是基于py3的,所以我觉得安装supervisord可以直接用pip
    python2 的就直接pip install supervisord
    python3 的就用pip install git+https://github.com/Supervisor/supervisor
    这样去区分,然后都可以运行了,不会报错了
    1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 71.0.3578.98(Google Chrome 71.0.3578.98)
      @Kaniwow
  7. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 63.0.3239.132(Google Chrome 63.0.3239.132)
    升级到18.04发现没有eth0 网卡是咋回事儿
    1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 69.0.3497.100(Google Chrome 69.0.3497.100)
      1. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 63.0.3239.132(Google Chrome 63.0.3239.132)
        @神代綺凜 我ifconfig出来是ens3
        1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 69.0.3497.100(Google Chrome 69.0.3497.100)
          @Kaniwow 其实 listen-address 不写这行也没有关系,默认应该会监听全部
          1. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 63.0.3239.132(Google Chrome 63.0.3239.132)
            @神代綺凜 我去试试
            我觉得overture+DNSmasq应该能让我吃上无污染DNS
  8. Death  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.99(Google Chrome 67.0.3396.99)
    请问一下,到了最后一步执行 /etc/init.d/dnsmasq restart 的时候提示No such file or directory是个什么情况?
    1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.99(Google Chrome 67.0.3396.99)
      @Death 可以尝试用service dnsmasq restart
      1. Death  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.99(Google Chrome 67.0.3396.99)
        @神代綺凜 嗯嗯,用的 sustemctl restart dnsmasq,谢谢大佬
  9. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
    想问一个很弱智的问题,就是我搭建好了DNS服务器之后我的链接地址是eth0的网卡IP还是运营商给的广播IP呢
    1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.87(Google Chrome 67.0.3396.87)
      @Kaniwow 你的意思是你在国内机器上搭好了,然后机器是有内网ip和公网ip的是么
      那当然是连接公网ip
      1. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
        @神代綺凜 在我本身的VPS上dig是可以获取到pixiv的正确地址的,然鹅我用服务器供应商给的广播地址输入到电脑上的时候直接无法解析了……
        1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.87(Google Chrome 67.0.3396.87)
          @Kaniwow 防火墙安全组检查一下,53UDP要开放
          1. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
            @神代綺凜 电脑端的还是VPS端的?
            1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.87(Google Chrome 67.0.3396.87)
              @Kaniwow VPS
              1. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
                @神代綺凜 Chain INPUT (policy ACCEPT)
                target prot opt source destination
                ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:53
                ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53

                Chain FORWARD (policy ACCEPT)
                target prot opt source destination

                Chain OUTPUT (policy ACCEPT)
                target prot opt source destination
                ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:53
                ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp spt:53

                好像…………开放了?

                1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.87(Google Chrome 67.0.3396.87)
                  @Kaniwow 安全组……VPS商后台控制的那个
                  1. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
                    @神代綺凜 我把那个全部端口打开放开了然后还是连不上啊
                    1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.87(Google Chrome 67.0.3396.87)
                      @Kaniwow 删完/etc/init.d/dnsmasq restart重启DNSMasq
                      1. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
                        @神代綺凜 还是DNS服务器无响应
                        1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.87(Google Chrome 67.0.3396.87)
                          @Kaniwow 那没更多的信息我也不知道是什么问题了
                          1. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
                            @神代綺凜 要不我把服务器给你看下,加个企鹅?
                            1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.87(Google Chrome 67.0.3396.87)
                              @Kaniwow 太麻烦,告辞
                              1. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
                                @神代綺凜 别啊dalao我去加你TG了你等会儿
                    2. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.87(Google Chrome 67.0.3396.87)
                      @Kaniwow 那你试一下把DNSMasq配置文件里的listen-address=127.0.0.1,x.x.x.x给删掉看看……
                  2. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
                    @神代綺凜 好的我去看一哈,抱歉啊问题有点脑残
  10. zephyru  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 68.0.3440.7(Google Chrome 68.0.3440.7)
    emmmm....
    今天发现我组的这个..p站有的时候不通..不知道啥原因...
    阿里云上可以dig到一个假地址..
    但是本地..
    pi@raspberrypi:~ $ dig www.pixiv.net

    ; <> DiG 9.10.3-P4-Raspbian <> www.pixiv.net
    ;; global options: +cmd
    ;; connection timed out; no servers could be reached
    但我通过改hosts的方法可以连接...不知道为啥....

    1. Kaniwow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
      @zephyru 大佬你是怎么做到的啊我也是疯狂没有答应就很凉
      1. zephyru  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 68.0.3440.7(Google Chrome 68.0.3440.7)
        @Kaniwow 我当时是重启了一圈....到重启网关就好了..
        也许是哪里有缓存或者不通吧..
        也没再遇到过.....
        反正,重启试试?
    2. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.79(Google Chrome 67.0.3396.79)
      @zephyru dig不指定参数是默认使用本机设定的DNS查询
      1. zephyru  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 68.0.3440.7(Google Chrome 68.0.3440.7)
        @神代綺凜 我把dnsmap+chiandns组在树莓派上的...
        然后..dig...之前用的好好的..
        今天不知道为啥就没响应了...
        百度,简书,知乎啥的好好的...
        但是p站和github都是找不到服务器..连个假地址也没反给我..
        重启电脑..无效..
        重启树莓派..无效..
        重启路由器..无效..
        重启网关...又好了..
        1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.79(Google Chrome 67.0.3396.79)
  11. 悟霾  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
    emmmm突然想到是不是可以在网关用端口转发把5353转发到53
    去试试看
  12. crow  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
    博主有没有想法写一下透明代理之类的文章 研究了几天进展不顺
    1. 神代綺凜  Mac OS X(Mac OS X) / Safari(Safari)
      @crow 实际上只要在路由器上使用ss客户端就让子网设备透明代理了
  13. zephyru  Windows 7 x64 Edition(Windows 7 x64 Edition) / Google Chrome 64.0.3282.186(Google Chrome 64.0.3282.186)
    对了关于..
    supervisord
    用这种方式添加的..我该怎么把它的开机启动关掉呢?
    再话说..
    假如有两天命令可以一直..
    command 下去么?
    网上查到的资料好像不大一样..而且莫名的少..
    1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
      @zephyru 想不让supervisor开机自启就不要在/etc/rc.local里加那句命令就好了,不过更推荐的做法是在写入ChinaDNS的supervisor配置的时候把autostart = true改成false,这样在supervisor启动的时候这个程序就不会被自动启动,但你仍可以随时通过supervisorctl start chinadns来启动指定配置的程序

      supervisor的作用是监控进程,如果程序挂掉就用设定好的命令再启动一次,而不是一直不断的执行command

      1. zephyru  Windows 7 x64 Edition(Windows 7 x64 Edition) / Google Chrome 64.0.3282.186(Google Chrome 64.0.3282.186)
        @神代綺凜 我按着这个流程又添加了一个..
        echo "[program:chinadns]
        只改了这一行..
        最后有个添加的没添加..
        发现chinands的自启被盖掉了....
        supervisorctl status 只有我后添加的那个..
        大佬~HELP!
        1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
          @zephyru 自行用编辑器编辑/etc/supervisord.conf,检查配置有什么错误,修正以后supervisorctl reload
          1. zephyru  Windows 7 x64 Edition(Windows 7 x64 Edition) / Google Chrome 64.0.3282.186(Google Chrome 64.0.3282.186)
            @神代綺凜 错误倒是没有..就是..[program:chinadns]这个被盖掉了...
            直接在编辑里修改似乎也没问题..
            问题是....
            如果我想用文章中那种方式添加该怎么做?
        2. zephyru  Windows 7 x64 Edition(Windows 7 x64 Edition) / Google Chrome 64.0.3282.186(Google Chrome 64.0.3282.186)
          @zephyru 也就是说我想问,想写入多个配置应该怎么写..
          1. zephyru  Windows 7 x64 Edition(Windows 7 x64 Edition) / Google Chrome 64.0.3282.186(Google Chrome 64.0.3282.186)
            @zephyru 再比如.我想添加两条SSH语句..

            common='ssh1|ssh2'
            还是
            common='ssh1'
            common='ssh2'
            1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
              @zephyru echo_supervisord_conf > /etc/supervisord.conf只用执行一次,这句的目的是初始化配置文件,会覆盖掉原先所有的配置,后面的那条语句才是追加配置
              1. zephyru  Windows 7 x64 Edition(Windows 7 x64 Edition) / Google Chrome 64.0.3282.186(Google Chrome 64.0.3282.186)
                @神代綺凜 懂了..那假如..想在一个program 里添加两条语句有办法么..
                我发现无论..
                common='ssh1|ssh2'
                还是
                common='ssh1'
                common='ssh2'
                它都不认耶.....
                1. 神代綺凜  Mac OS X(Mac OS X) / Safari(Safari)
                  @zephyru 你不能写两条吗。。。我不知道能不能在一个配置中监控多个进程的pid

                  而且就算要用一条语句同时运行两个命令也不是用ssh1 | ssh2啊,这是管道,你应该用ssh1 & ssh2

                  你赶紧把linux shell知识回炉重造一遍

                  1. zephyru  Windows 7 x64 Edition(Windows 7 x64 Edition) / Google Chrome 64.0.3282.186(Google Chrome 64.0.3282.186)
                    @神代綺凜 不..其实我没学过..linux shell...用什么查什么....
                    写两条倒是没问题..但是会启两个进程浪费资源(正经
                    但是我也不知道..假如写在一个脚本里..用这个守护会不会有作用...
                    嘛...无论哪种方式...都只能去试试..Try and error(疑好像哪里不对..
                    早晚还是得去看本关于Linux的书的...
                    1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
                      @zephyru 写一条不也是启动两个进程,都有两条指令了……守护又不占什么资源的几乎可以忽略不计
                      1. zephyru  Windows 7 x64 Edition(Windows 7 x64 Edition) / Google Chrome 64.0.3282.186(Google Chrome 64.0.3282.186)
                        @神代綺凜 啊...你这么一说..突然意识到..一条SSH一定会占一个进程..
                        傻了,傻了..
                        这就是..面向搜索引擎编程的弊端..对一定是这样...
  14. zephyru  Windows 7 x64 Edition(Windows 7 x64 Edition) / Google Chrome 64.0.3282.186(Google Chrome 64.0.3282.186)
    虽然不知道自己在做什么..
    但就是好了..
    赞美大佬..
    1. zephyru  Windows 7 x64 Edition(Windows 7 x64 Edition) / Google Chrome 64.0.3282.186(Google Chrome 64.0.3282.186)
      @zephyru 作为一个好奇宝宝,水回复是不对的..
      所以我又来提问题了..
      记得前面查DNSmasq的时候..
      搜索引擎高速我..这个东西有缓存DNS的功能..
      默认就开启的么?不需要设置?
      假如我想让它去解析某网站并缓存应该怎么操作?直接dig然后修改服务器上的hosts?
      然后...
      我记得..谷歌的墙似乎涉及各种稀奇古怪的重定向...
      也就是说..改个hosts基本是没用的..
      那么..steam社区的也是这种么?
      1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 66.0.3359.181(Google Chrome 66.0.3359.181)
        @zephyru 默认是缓存150条解析记录,如果想自行设置可以用

        cache-size=50

        来设定,也可以直接

        no-negcache

        来关闭缓存功能,其实这个不需要动,缓存是没什么问题的

        默认DNSMasq是会使用系统内的/etc/hosts的,可以用

        no-hosts

        来禁止使用

        steam我也不清楚是怎么回事,我目前一直用Steamcommunity 302来解决