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

IPv4 and IPv6 (dual-stack) support? #45

Closed
aofei opened this issue Jun 3, 2022 · 5 comments · May be fixed by #50
Closed

IPv4 and IPv6 (dual-stack) support? #45

aofei opened this issue Jun 3, 2022 · 5 comments · May be fixed by #50

Comments

@aofei
Copy link

aofei commented Jun 3, 2022

I created a custom VPC network with IPv6 support today and configured my old instance to use it.

Although ip a s eth0 shows that the interface has an external IPv6 address, I cannot reach any public IPv6 addresses. For example, ping -6 dns.google prints ping: connect: Network is unreachable.

Then I created a new instance using the ubuntu-2204-jammy-v20220528 image and everything worked fine. This makes me think that my old instance (created about two years ago) might have some unknown problem. So I used this project to create a new instance:

$ gcloud compute instances create archlinux-ipv6-test --image-project arch-linux-gce --image-family arch --network-interface subnet=custom,stack-type=IPV4_IPV6

Everything worked fine until I rebooted the instance with sudo reboot. And after reboot ip a s eth0 shows no external IPv6 address.

I don't know if I'm doing something wrong, are there any other steps I need to do? Or does this project not support IPv6 yet?

@aofei
Copy link
Author

aofei commented Jun 4, 2022

Routing problem. I worked around this problem by adding the following line to the startup-script:

ip -6 route add default via $(curl -fsS http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/gateway-ipv6 -H "Metadata-Flavor: Google") dev eth0

But I still think it should be handled automatically by some system component, so I leave this issue open for now.

@toastwaffle
Copy link
Collaborator

Hi @aofei.

I'm not familiar with custom VPCs - could you share either gcloud commands or step by step instruction for the cloud console so I can replicate your setup for testing?

@aofei
Copy link
Author

aofei commented Jun 6, 2022

$ gcloud compute networks create archimg-issue-45 --subnet-mode custom
$ gcloud compute networks subnets create archimg-issue-45 --network archimg-issue-45 --region asia-east2 --range 10.10.0.0/24 --stack-type IPV4_IPV6 --ipv6-access-type EXTERNAL
$ gcloud compute firewall-rules create archimg-issue-45-allow-ssh --network archimg-issue-45 --allow tcp:22
$ gcloud compute instances create archimg-issue-45 --zone asia-east2-a --image-project arch-linux-gce --image-family arch --network-interface subnet=archimg-issue-45,stack-type=IPV4_IPV6 --metadata block-project-ssh-keys=true --no-shielded-secure-boot --no-shielded-vtpm --no-shielded-integrity-monitoring

If all goes well, these four lines of commands should create a problematic instance for you.

Then you can execute:

$ gcloud compute ssh archimg-issue-45 --zone asia-east2-a --command "ip a s eth0; ping -6 -c 3 dns.google"

and everything should be fine at this point. But if you then execute:

$ gcloud compute ssh archimg-issue-45 --zone asia-east2-a --command "sudo reboot"

the problem arises at this point. Either the instance is not reachable at all (no internet), or ip a s eth0 shows no external IPv6 address. The problem I'm having at this moment is the first one (no internet). The problem I had three days ago was the second.

@aofei
Copy link
Author

aofei commented Jun 9, 2022

the problem arises at this point. Either the instance is not reachable at all (no internet), or ip a s eth0 shows no external IPv6 address.

For the second case (ip a s eth0 shows no external IPv6 address), a workaround is to add the following line to the startup-script:

ip -6 addr add $(curl -fsS http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ipv6 -H "Metadata-Flavor: Google" | sed "s/\/96/\/128/") dev eth0

@aofei
Copy link
Author

aofei commented Jun 14, 2022

I happened to have the same problem today (ip a s eth0 shows no external IPv6 address after sudo reboot) with an instance I created with ubuntu-2204-jammy-v20220528 image.

So I don't know, according to the IPv6 address assignment, this problem seems more likely to be caused by some metadata server bug in asia-east2 region than the VM OS now. Because I just tested the commands in #45 (comment) with us-central1 region, and everything works fine.

If it's a metadata server bug, then this issue can be closed. @toastwaffle

aofei added a commit to aofei/.GoogleCloudPlatform.compute-archlinux-image-builder that referenced this issue Nov 19, 2022
aofei added a commit to aofei/.GoogleCloudPlatform.compute-archlinux-image-builder that referenced this issue Nov 19, 2022
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

Successfully merging a pull request may close this issue.

2 participants