mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-19 04:49:13 +08:00
core: 尽量使用重装前的 IP
防止自动获取的 IP 不是重装前的 IP 而造成失联
This commit is contained in:
parent
3b679732c1
commit
7a4eeb942a
@ -232,11 +232,11 @@ ipv6_has_internet=false
|
|||||||
|
|
||||||
test_internet
|
test_internet
|
||||||
|
|
||||||
# 处理云电脑 dhcp 获取的地址无法上网
|
# 防止自动获取的 IP 无法上网
|
||||||
if $dhcpv4 && ! $ipv4_has_internet &&
|
# 防止自动获取的 IP 不是重装前的 IP 而造成失联
|
||||||
[ -n "$ipv4_addr" ] && [ -n "$ipv4_gateway" ] &&
|
if $dhcpv4 && [ -n "$ipv4_addr" ] && [ -n "$ipv4_gateway" ] &&
|
||||||
{ ! [ "$ipv4_addr" = "$(get_first_ipv4_addr)" ] || ! [ "$ipv4_gateway" = "$(get_ipv4_gateway)" ]; }; then
|
{ ! $ipv4_has_internet || ! [ "$ipv4_addr" = "$(get_first_ipv4_addr)" ]; }; then
|
||||||
echo "DHCPv4 can't access Internet. And not match static IPv4 Address or Gateway."
|
echo "IPv4 from DHCPv4 can't access Internet or not matched."
|
||||||
flush_ipv4_config
|
flush_ipv4_config
|
||||||
add_missing_ipv4_config
|
add_missing_ipv4_config
|
||||||
test_internet
|
test_internet
|
||||||
@ -246,11 +246,11 @@ if $dhcpv4 && ! $ipv4_has_internet &&
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
should_disable_ra_slaac=false
|
should_disable_ra_slaac=false
|
||||||
# 处理部分商家 slaac / dhcpv6 获取的 ip 无法上网
|
# 防止自动获取的 IP 无法上网
|
||||||
if $dhcpv6_or_slaac && ! $ipv6_has_internet &&
|
# 防止自动获取的 IP 不是重装前的 IP 而造成失联
|
||||||
[ -n "$ipv6_addr" ] && [ -n "$ipv6_gateway" ] &&
|
if $dhcpv6_or_slaac && [ -n "$ipv6_addr" ] && [ -n "$ipv6_gateway" ] &&
|
||||||
{ ! [ "$ipv6_addr" = "$(get_first_ipv6_addr)" ] || ! [ "$ipv6_gateway" = "$(get_ipv6_gateway)" ]; }; then
|
{ ! $ipv6_has_internet || ! [ "$ipv6_addr" = "$(get_first_ipv6_addr)" ]; }; then
|
||||||
echo "SLAAC can't access Internet. And not match static IPv6 Address or Gateway."
|
echo "IPv6 from SLAAC/DHCPv6 can't access Internet or not matched."
|
||||||
flush_ipv6_config true
|
flush_ipv6_config true
|
||||||
add_missing_ipv6_config
|
add_missing_ipv6_config
|
||||||
test_internet
|
test_internet
|
||||||
|
Loading…
x
Reference in New Issue
Block a user