V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
qingmuhy0
V2EX  ›  宽带症候群

GCP 总是自动换 DNS

  •  
  •   qingmuhy0 · 2019-09-28 22:45:49 +08:00 · 4628 次点击
    这是一个创建于 1643 天前的主题,其中的信息可能已经有所发展或是发生改变。

    开了个 GCP 机器,用来代理,用了一些用 DNS 破解流媒体地域限制的歪门邪道,那个方法需要固定 DNS 到一个固定的地址,但我每次改了后,Google 过段时间就会自动该回去。把 DNS 文件设置为只读也阻止不了,求救。 123.jpg 1234.jpg 如图为 Google 自动改成了内网 DNS

    14 条回复    2020-10-22 20:47:40 +08:00
    leavic
        1
    leavic  
       2019-09-28 22:53:23 +08:00
    请自己 google resolvconf
    yexm0
        2
    yexm0  
       2019-09-28 22:53:53 +08:00 via Android
    看后台是不是跑着 google 的程序?是就试试 kill 了
    Yien
        3
    Yien  
       2019-09-28 22:54:34 +08:00
    求歪门邪道秘笈
    Love4Taylor
        4
    Love4Taylor  
       2019-09-28 23:00:32 +08:00 via Android
    iptables 重定向喽
    dot2017
        5
    dot2017  
       2019-09-28 23:41:33 +08:00
    1. 将 resolve.conf 设置成只读
    2. 找网卡的配置文件,里面应该有一项 autoconfig,屏蔽掉
    dot2017
        6
    dot2017  
       2019-09-28 23:42:17 +08:00
    另外 aws 和 azure 也是一样的,目的就是让虚拟机默认走内网的 dns。
    ETiV
        7
    ETiV  
       2019-09-29 00:18:42 +08:00
    极大概率是 DHCP client 搞的,不会记错的……

    我在 AWS 上被坑过,改了当时是生效了,结果过了个不定期的时间,又给还原回去了,业务就 down 了

    看了系统日志发现是 DHCP 给弄的…
    mikeguan
        8
    mikeguan  
       2019-09-29 00:28:50 +08:00 via Android
    你的这个只读对 root 用户无效,需要 chattr 加上 i 权限
    trepwq
        9
    trepwq  
       2019-09-29 01:50:55 +08:00
    root@instance-1:~# cat /etc/resolv.conf
    # This file is managed by man:systemd-resolved(8). Do not edit.
    #
    # This is a dynamic resolv.conf file for connecting local clients to the
    # internal DNS stub resolver of systemd-resolved. This file lists all
    # configured search domains.
    #
    # Run "systemd-resolve --status" to see details about the uplink DNS servers
    # currently in use.
    #
    # Third party programs must not access this file directly, but only through the
    # symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
    # replace this symlink by a static file or a different symlink.
    #
    # See man:systemd-resolved.service(8) for details about the supported modes of
    # operation for /etc/resolv.conf.
    maojy1989
        10
    maojy1989  
       2019-09-29 08:39:28 +08:00
    代理软件的配置文件内可以指定 dns 的吧,不一定非要修改系统 dns
    zeyexe
        11
    zeyexe  
       2019-09-29 10:45:28 +08:00
    这里提到了很多种方法,任君选择

    https://www.cyberciti.biz/faq/dhclient-etcresolvconf-hooks/
    notgood
        12
    notgood  
       2019-09-29 19:51:26 +08:00 via iPhone
    LZ 求歪门邪道秘笈. 謝謝🙏
    notgood
        13
    notgood  
       2019-09-29 19:54:37 +08:00 via iPhone
    你要 chattr 加上 i 权限 chattr +i /etc/resolv.conf
    求歪门邪道秘笈. 謝謝🙏
    goldalan
        14
    goldalan  
       2020-10-22 20:47:40 +08:00
    修改 /etc/sysconfig/network/config 文件,将 NETCONFIG_DNS_POLICY='auto'这句改为 NETCONFIG_DNS_POLICY=''
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2824 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 644ms · UTC 13:26 · PVG 21:26 · LAX 06:26 · JFK 09:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.