一、 获取当前配置
# part1
NetCardName // 网卡名
IP // IPv4/IPv6地址
SubnetMask // IPv4/IPv6子网掩码
MTU
MAC // MAC地址
# 通过系统调用获取, 用的go原生包获取, 可以用系统命令ifconfig来对比查看, 如下
security@DEFAULTSTRING:~$ ifconfig
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.205 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::207:32ff:fe67:b732 prefixlen 64 scopeid 0x20<link>
ether 00:07:32:67:b7:32 txqueuelen 1000 (Ethernet)
RX packets 368485 bytes 26495671 (26.4 MB)
RX errors 0 dropped 85574 overruns 0 frame 0
TX packets 149 bytes 10094 (10.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1280
inet 10.171.16.79 netmask 255.255.255.192 broadcast 10.171.16.127
inet6 fe80::207:32ff:fe67:b733 prefixlen 64 scopeid 0x20<link>