zxCoder
V2EX  ›  问与答

校园网一重连就会修改/etc/resolv.cnf 这个文件

  •  
  •   zxCoder · Oct 16, 2020 · 2604 views
    This topic created in 2211 days ago, the information mentioned may be changed or developed.

    然后就一直把 github github.io raw.github 这些解析到本地

    每次都是按阿里 dns 设置重新修改一次

    sudo vim /etc/resolv.conf
    加入:
    nameserver 223.5.5.5
    nameserver 223.6.6.6
    

    有没有一劳永逸的方法,而且话说为啥校园网还能修改我本地的文件呢。。。

    8 replies  •  2020-10-16 19:24:09 +08:00
    wjhjd163
    wjhjd163
    Oct 16, 2020 via Android❤️1
    1
    这个文件是自动生成的
    你想修改 DNS 需要去修改网卡配置文件
    AreYou0k
    AreYou0k
    Oct 16, 2020❤️1
    2
    把写入权限取消试试
    fudanglp
    fudanglp
    Oct 16, 2020 via Android❤️1
    3
    resolv.conf 是自动生成的
    改 /etc/resolv.conf.d/head
    zxCoder
    zxCoder
    OP
    Oct 16, 2020
    4
    @fudanglp 原来如此 谢谢
    baobao1270
    baobao1270
    Oct 16, 2020
    5
    我怀疑我们是不是同一个学校……
    网卡配置里把使用 DHCP 通告的 DNS 去掉就行了
    deorth
    deorth
    Oct 16, 2020
    6
    iptables 重定向所有目标端口为 53 的 UDP
    raaaaaar
    raaaaaar
    Oct 16, 2020 via Android
    7
    加个 i 那个权限
    lttraw
    lttraw
    Oct 16, 2020❤️1
    8
    vi /etc/systemd/resolved.conf
    DNS= 10.0.0.3 10.0.0.4

    :wq

    # systemctl restart systemd-resolved
    # systemctl enable systemd-resolved

    # mv /etc/resolv.conf /etc/resolv.conf.bak
    # ln -s /run/systemd/resolve/resolv.conf /etc/

    我昨晚才搞了,重启后仍然不影响。找了很多种只有这种有用,看看有么有帮到你
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4848 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 07:57 · PVG 15:57 · LAX 23:57 · JFK 02:57
    ♥ Do have faith in what you're doing.