Skip to content

Commit e93f339

Browse files
committed
ansible: add getaddrinfo config to prefer IPv4
On some hosts, IPv6 connectivity is limited and may result in DNS lookups returning IPv6 addresses that the host is unable to reach. Add a config file for glibc's getaddrinfo function that configures IPv4 addresses to have higher precedence for such hosts.
1 parent c5ad990 commit e93f339

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# getaddrinfo(3) configuration file
2+
# Settings to prefer IPv4 addresses for hosts with limited IPv6 connectivity.
3+
4+
# Below settings are documented defaults but need to be duplicated since
5+
# setting any precedence line means the default table is not used.
6+
precedence ::1/128 50
7+
precedence ::/0 40
8+
precedence 2002::/16 30
9+
precedence ::/96 20
10+
11+
# This line is changed from the default to give IPv4 higher precedence.
12+
precedence ::ffff:0:0/96 100
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
3+
# LinuxONE Community Cloud Red Hat Enterprise Linux 9
4+
5+
- name: Configure getaddrinfo to prefer IPv4 addresses
6+
ansible.builtin.copy:
7+
dest: /etc/gai.conf
8+
group: root
9+
mode: 0644
10+
owner: root
11+
src: "gai.conf"

ansible/roles/bootstrap/tasks/partials/rhel8-s390x.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,11 @@
4848
insertafter: ":OUTPUT ACCEPT.*]"
4949
line: "-A INPUT -s 127.0.0.2/32 -d 127.0.0.1/32 -j ACCEPT"
5050
notify: restart iptables
51+
52+
- name: Configure getaddrinfo to prefer IPv4 addresses
53+
ansible.builtin.copy:
54+
dest: /etc/gai.conf
55+
group: root
56+
mode: 0644
57+
owner: root
58+
src: "gai.conf"

0 commit comments

Comments
 (0)