mirror of
https://github.com/bin456789/reinstall.git
synced 2025-06-07 21:09:56 +00:00
net: 修复特殊情况下 dns 写入后又被清空
This commit is contained in:
parent
8a3ef0c875
commit
8895d23082
@ -466,11 +466,16 @@ if ! $ipv6_has_internet; then
|
||||
fi
|
||||
|
||||
# 如果联网了,但没获取到默认 DNS,则添加我们的 DNS
|
||||
if $ipv4_has_internet && ! { [ -e /etc/resolv.conf ] && is_have_ipv4_dns; }; then
|
||||
|
||||
# 有一种情况是,多网卡,且能上网的网卡先完成了这个脚本,不能上网的网卡后完成
|
||||
# 无法上网的网卡通过 flush_ipv4_config 删除了不能上网的 IP 和 dns
|
||||
# (原计划是删除无法上网的网卡 dhcp4 获取的 dns,但实际上无法区分)
|
||||
# 因此这里直接添加 dns,不判断是否联网
|
||||
if ! is_have_ipv4_dns; then
|
||||
echo "nameserver $ipv4_dns1" >>/etc/resolv.conf
|
||||
echo "nameserver $ipv4_dns2" >>/etc/resolv.conf
|
||||
fi
|
||||
if $ipv6_has_internet && ! { [ -e /etc/resolv.conf ] && is_have_ipv6_dns; }; then
|
||||
if ! is_have_ipv6_dns; then
|
||||
echo "nameserver $ipv6_dns1" >>/etc/resolv.conf
|
||||
echo "nameserver $ipv6_dns2" >>/etc/resolv.conf
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user