检查ip冲突的方法

使用arping检查ip冲突. [root@node1 ~]# arping -I enp4s0f0 192.168.11.3 ARPING 192.168.11.3 from 192.168.12.196 enp4s0f0 Unicast reply from 192.168.11.3 [18:C0:4D:1D:AA:7C] 0.683ms Unicast reply from 192.168.11.3 [18:C0:4D:1D:AA:7C] 0.551ms Unicast reply from 192.168.11.3 [18:C0:4D:1D:AA:7C] 0.562ms Unicast reply from 192.168.11.3 [18:C0:4D:1D:AA:7C] 0.548ms 如果返回的mac 地址有多个, 说明这个局域网出现ip冲突.

go_1.21泛型示例

package demo import ( “math/rand” “time” ) // 定义泛型接口 type RandomElementer[T any] interface { // 返回一个随机的元素,如果集合为空,返回(zero, false) RandomElement() (T, bool) } func MustRandom[T any](collection RandomElementer[T]) T { val, ok := collection.RandomElement() if !ok { panic(“collection is empty.”) } return val } // MyList 泛型集合. type MyList[T any] []T // MyList 实现接口RandomElement func (l MyList[T]) RandomElement()… Continue reading go_1.21泛型示例

Published
Categorized as go, language