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

Could not find a public IPv6 address on this system #7

Open
Hardstylez91 opened this issue Jan 11, 2024 · 1 comment
Open

Could not find a public IPv6 address on this system #7

Hardstylez91 opened this issue Jan 11, 2024 · 1 comment

Comments

@Hardstylez91
Copy link

Hardstylez91 commented Jan 11, 2024

This is the only output in my logfile, IPv6 is activated on my system

@espresso4jb
Copy link

espresso4jb commented Apr 15, 2024

I experienced similar issues and I noted that ipify has an interface for IPv6 and it does exactly what I need (returns the correct IPv6 globally routable address for the device that I run the script on).

I would suggest the following change:
def get_ipv6_address(interface_name):
return requests.request("GET", "https://api6.ipify.org").text

My curiosity got the better of me and I took a second look ...

The issue for me that kept the script from working as is was the grep statement looking to exclude "mngtmpaddr", which would be leveraging RFC3041 to allow the kernel to manage temporary addresses. The other exclusion, "temporary" is for RFC4941 addressing to mask a permanent address and it is not recommended to use temporary addressing for server use, but more for outbound connectivity, so makes sense to exclude. I also discovered per the man page for ip-address (8) that there are flags that you can use instead of the grep, fwiw that would be "-temporary" and "-mngtmpaddr" to get the same result.

It seems that most Linux configuration defaults leave the "mngtmpaddr" set. This does indicate another potential issue as this is not truly a "permanent" address and I should likely modify the way the address is assigned or the netplan.

I understand there can be a myriad of scenarios and you wrote the script for what worked for you, but a fix that may work for more environments if not using the ipify API could be to remove the "mngtmpaddr" restriction and just skip temporary addresses, quasi-diff as follows -

< ip_output = subprocess.getoutput(f"ip -6 -o address show dev {interface_name} scope global | grep --invert temporary | grep --invert mngtmpaddr")
> ip_output = subprocess.getoutput(f"ip -6 -o address show dev {interface_name} scope global -temporary")

Regardless, appreciate the script as got me quickly to what I needed with just a minor tweak.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants