Skip to content

Commit 27baee0

Browse files
committed
chore: direct ipv4 traffic via EIP instead of NatGW
1 parent 1211077 commit 27baee0

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

ansible/files/gai.conf

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Configuration for getaddrinfo(3).
2+
#
3+
# So far only configuration for the destination address sorting is needed.
4+
# RFC 3484 governs the sorting. But the RFC also says that system
5+
# administrators should be able to overwrite the defaults. This can be
6+
# achieved here.
7+
#
8+
# All lines have an initial identifier specifying the option followed by
9+
# up to two values. Information specified in this file replaces the
10+
# default information. Complete absence of data of one kind causes the
11+
# appropriate default information to be used. The supported commands include:
12+
#
13+
# reload <yes|no>
14+
# If set to yes, each getaddrinfo(3) call will check whether this file
15+
# changed and if necessary reload. This option should not really be
16+
# used. There are possible runtime problems. The default is no.
17+
#
18+
# label <mask> <value>
19+
# Add another rule to the RFC 3484 label table. See section 2.1 in
20+
# RFC 3484. The default is:
21+
#
22+
#label ::1/128 0
23+
#label ::/0 1
24+
#label 2002::/16 2
25+
#label ::/96 3
26+
#label ::ffff:0:0/96 4
27+
#label fec0::/10 5
28+
#label fc00::/7 6
29+
#label 2001:0::/32 7
30+
#
31+
# This default differs from the tables given in RFC 3484 by handling
32+
# (now obsolete) site-local IPv6 addresses and Unique Local Addresses.
33+
# The reason for this difference is that these addresses are never
34+
# NATed while IPv4 site-local addresses most probably are. Given
35+
# the precedence of IPv6 over IPv4 (see below) on machines having only
36+
# site-local IPv4 and IPv6 addresses a lookup for a global address would
37+
# see the IPv6 be preferred. The result is a long delay because the
38+
# site-local IPv6 addresses cannot be used while the IPv4 address is
39+
# (at least for the foreseeable future) NATed. We also treat Teredo
40+
# tunnels special.
41+
#
42+
# precedence <mask> <value>
43+
# Add another rule to the RFC 3484 precedence table. See section 2.1
44+
# and 10.3 in RFC 3484. The default is:
45+
#
46+
#precedence ::1/128 50
47+
#precedence ::/0 40
48+
#precedence 2002::/16 30
49+
#precedence ::/96 20
50+
#precedence ::ffff:0:0/96 10
51+
#
52+
# For sites which prefer IPv4 connections change the last line to
53+
#
54+
#precedence ::ffff:0:0/96 100
55+
#
56+
# Prefer IPv4 over IPv6
57+
precedence ::ffff:0:0/96 100
58+
precedence ::/0 50
59+
#
60+
# The 'label' directive in gai.conf assigns a priority value to specific
61+
# address ranges. Lower numbers are preferred over higher numbers.
62+
# By assigning the label 2 to 2002::/16, we're giving 6to4 addresses a
63+
# higher priority than regular IPv6 addresses (labeled 6) but a lower
64+
# priority than IPv4 addresses (labeled 4).
65+
# Label IPv4 addresses
66+
label ::ffff:0:0/96 4
67+
# Label IPv6 addresses
68+
# The prefix 2002::/16 refers to 6to4 addresses. 6to4 is a transitional
69+
# mechanism designed to transmit IPv6 packets over an IPv4 network,
70+
# essentially allowing IPv6 connectivity via IPv4 infrastructure.
71+
# 6to4 is not used in AWS and is probably unnecessary
72+
label 2002::/16 2
73+
label ::/0 6
74+
#
75+
#
76+
# scopev4 <mask> <value>
77+
# Add another rule to the RFC 6724 scope table for IPv4 addresses.
78+
# By default the scope IDs described in section 3.2 in RFC 6724 are
79+
# used. Changing these defaults should hardly ever be necessary.
80+
# The defaults are equivalent to:
81+
#
82+
# Decrease scope of private IPv4 to allow quicker IPv6 fallback
83+
scopev4 ::ffff:169.254.0.0/112 2
84+
scopev4 ::ffff:127.0.0.0/104 2
85+
# scopev4 ::ffff:10.0.0.0/104 2
86+
# scopev4 ::ffff:172.16.0.0/108 2
87+
# scopev4 ::ffff:192.168.0.0/112 2

ansible/tasks/internal/optimizations.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,12 @@
3737
- popularity-contest
3838
- ubuntu-advantage-tools
3939
when: debpkg_mode or stage2_nix
40+
41+
- name: prefer IPv4 connection resolution
42+
become: yes
43+
copy:
44+
src: "files/gai.conf"
45+
dest: "/etc/gai.conf"
46+
owner: root
47+
group: root
48+
mode: 0644

0 commit comments

Comments
 (0)