Skip to content
New issue

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

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

Already on GitHub? # to your account

Add pre-install user data #86

Merged
merged 3 commits into from
Mar 22, 2024
Merged

Add pre-install user data #86

merged 3 commits into from
Mar 22, 2024

Conversation

nickpetrovic
Copy link
Contributor

@nickpetrovic nickpetrovic commented Mar 21, 2024

I've been looking at adding NAT64 support to this and have been successful using the nat_instance_user_data_post_install variable. However, I noticed that when an instance is running in a dual stack network, DNS resolution is extremely slow (or possibly just API calls in general). For example, it takes 15m to provision an alternat instance + my post install script. I discovered it was the awscli calls that took forever.

I found a way to increase the precedence of IPv4 addresses on the host using the getaddrinfo config. To test it, I wanted to make sure it was the first thing that happened in the user data, so I added a nat_instance_user_data_pre_install variable and set it to this:

nat_instance_user_data_pre_install = <<-EOF
  # Prefer IPv4 over IPv6
  echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf
EOF

My instance setup time in a dual stack network went from ~15m to 2m.

Since I don't want to make any assumptions about people's networks (route table and subnet configurations) or whether they're using Jool vs Tayga (NAT64), I don't think it would make sense to add any of that stuff to this project, but a pre-install user data variable might?

@nickpetrovic nickpetrovic requested review from a team as code owners March 21, 2024 13:59
@nickpetrovic
Copy link
Contributor Author

Just added an ipv6-specific ingress variable to allow ipv6 ingress so that the internal network can communicate with the nat instance over ipv6 in a dual stack network.

@bwhaley
Copy link
Member

bwhaley commented Mar 21, 2024

Nice, thanks for this!

One small ask: could you add a note in README.md (in the Other Considerations section) about how to use this variable to set IPv4 precedence? Might save some time for others who may not search and find this PR.

@nickpetrovic
Copy link
Contributor Author

@bwhaley Added.

@bwhaley
Copy link
Member

bwhaley commented Mar 22, 2024

Thank you for the contribution.

@bwhaley bwhaley merged commit 53be0b9 into chime:main Mar 22, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants