|
|
@@ -149,10 +149,12 @@ func serviceRun() {
|
|
|
}
|
|
|
|
|
|
if time.Since(offlineStartTime) >= (time.Duration(20)*time.Second) &&
|
|
|
- getNetType() == NetEth && !eth0LinkDegraded.Load() { // eth0 无法联网时
|
|
|
+ getNetType() == NetEth && !eth0LinkDegraded.Load() { // eth0无法联网时
|
|
|
baseapp.Logger.Warnf("[%s] 通过eth0无法联网, 将网卡等级降级!", MODULE_NAME)
|
|
|
- eth0LinkDegraded.Store(true) // 标记eth0网卡降级, 并设置静态IP地址,运维用
|
|
|
- SetupEth0ForManagement("192.168.80.1/24")
|
|
|
+ eth0LinkDegraded.Store(true) // 开始设置eth0网卡降级使用
|
|
|
+ if _, _, err := getEth0Addr(); err != nil { // 当eth0未分配到有效地址时
|
|
|
+ SetupEth0ForManagement("192.168.80.1/24") // 给eth0设置一个静态的地址
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if time.Since(offlineStartTime) >= (time.Duration(60) * time.Second) {
|