Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPV6获取错误 #1112

Open
realzolo opened this issue May 15, 2024 · 4 comments
Open

IPV6获取错误 #1112

realzolo opened this issue May 15, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@realzolo
Copy link

realzolo commented May 15, 2024

问题描述

  1. 使用接口获取ipv6, 有时候也是得到的这个包含“::”的不可用的地址
  2. 通过网卡+正则,还是获取错误。
  3. 也不能按照顺序获取,因为这两个地址顺序会自动改变。。。
    image

DNS服务商

Alidns(阿里云)

是否已搜索同类问题

已搜索,但未能解决

操作系统

Linux

架构

x86_64

版本

v6.5.0

安装方式

Docker

额外信息

No response

@realzolo realzolo added the bug Something isn't working label May 15, 2024
Copy link

See

  1. 67% Ipv6获取bug #1111

@jeessy2
Copy link
Owner

jeessy2 commented May 15, 2024

换个正则ff:ee

@realzolo
Copy link
Author

realzolo commented Jun 2, 2024

换个正则ff:ee

遇到同样问题,请问可否提供一个正则表达式呢

用这个命令试试:
ip -6 addr | grep inet6 | awk -F '[ \t]+|/' '$3 == "::1" { next;} $3 ~ /^fe80::/ { next;} /inet6/ {print $3}' | awk '{ln=length}ln>max{delete result; max=ln}ln==max{result[NR]=$0}END{for(i in result) print result[i] }'

@karteous
Copy link

karteous commented Jun 2, 2024

匹配正确ipv6地址^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants