mirror of
https://github.com/bin456789/reinstall.git
synced 2026-02-21 18:37:49 +08:00
添加 --static 参数,强制使用静态IP
This commit is contained in:
parent
058068f7b1
commit
496d2ba5bd
16
trans.sh
16
trans.sh
@ -581,9 +581,16 @@ is_in_china() {
|
||||
grep -q 1 /dev/netconf/*/is_in_china
|
||||
}
|
||||
|
||||
force_static() {
|
||||
grep -q 1 /dev/netconf/*/force_static
|
||||
}
|
||||
|
||||
# 有 dhcpv4 不等于有网关,例如 vultr 纯 ipv6
|
||||
# 没有 dhcpv4 不等于是静态ip,可能是没有 ip
|
||||
is_dhcpv4() {
|
||||
if force_static; then
|
||||
return 1
|
||||
fi
|
||||
get_netconf_to dhcpv4
|
||||
# shellcheck disable=SC2154
|
||||
[ "$dhcpv4" = 1 ]
|
||||
@ -612,12 +619,18 @@ is_staticv6() {
|
||||
}
|
||||
|
||||
should_disable_ra_slaac() {
|
||||
if force_static; then
|
||||
return 1
|
||||
fi
|
||||
get_netconf_to should_disable_ra_slaac
|
||||
# shellcheck disable=SC2154
|
||||
[ "$should_disable_ra_slaac" = 1 ]
|
||||
}
|
||||
|
||||
is_slaac() {
|
||||
if force_static; then
|
||||
return 1
|
||||
fi
|
||||
# 防止部分机器slaac/dhcpv6获取的ip/网关无法上网
|
||||
if should_disable_ra_slaac; then
|
||||
return 1
|
||||
@ -628,6 +641,9 @@ is_slaac() {
|
||||
}
|
||||
|
||||
is_dhcpv6() {
|
||||
if force_static; then
|
||||
return 1
|
||||
fi
|
||||
# 防止部分机器slaac/dhcpv6获取的ip/网关无法上网
|
||||
if should_disable_ra_slaac; then
|
||||
return 1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user