-
Notifications
You must be signed in to change notification settings - Fork 1.4k
通过命令获取IP参考
jeessy2 edited this page Apr 7, 2023
·
6 revisions
Windows使用 powershell 脚本、其它使用 bash 脚本
ip -6 addr show eth1
其它设备需要支持EUI-64(IPv6后半部分包含ff:fe)
- Linux
ip -6 route | awk '{print $1}' | awk '/240:?/' | awk -F::/ '{print $1 ":suffix of other mac"}'
- Windows
Get-NetRoute -AddressFamily IPv6 | Where-Object { $_.DestinationPrefix.StartsWith("240") -and $_.DestinationPrefix.endsWith("/64") } | ForEach-Object { ($_.DestinationPrefix -split '::/')[0] + ":suffix of other mac" }
ip -6 addr | grep inet6 | awk -F '[ \t]+|/' '$3 == "::1" { next;} $3 ~ /^fe80::/ { next;} /inet6/ {print $3}'
ifconfig | grep inet6 | awk -F '[ \t]+|/' '$3 == "::1" { next;} $3 ~ /^fe80::/ { next;} /inet6/ {print $3}'
ipconfig | findstr IPv6