GCP 总是自动换 DNS

2019-09-28 22:45:49 +08:00
 qingmuhy0

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

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

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

看了系统日志发现是 DHCP 给弄的…
mikeguan
2019-09-29 00:28:50 +08:00
你的这个只读对 root 用户无效,需要 chattr 加上 i 权限
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
2019-09-29 08:39:28 +08:00
代理软件的配置文件内可以指定 dns 的吧,不一定非要修改系统 dns
zeyexe
2019-09-29 10:45:28 +08:00
这里提到了很多种方法,任君选择

https://www.cyberciti.biz/faq/dhclient-etcresolvconf-hooks/
notgood
2019-09-29 19:51:26 +08:00
LZ 求歪门邪道秘笈. 謝謝🙏
notgood
2019-09-29 19:54:37 +08:00
你要 chattr 加上 i 权限 chattr +i /etc/resolv.conf
求歪门邪道秘笈. 謝謝🙏
goldalan
2020-10-22 20:47:40 +08:00
修改 /etc/sysconfig/network/config 文件,将 NETCONFIG_DNS_POLICY='auto'这句改为 NETCONFIG_DNS_POLICY=''

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/605188

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX