Firewalld Domain Resolution Problem on Docker Container

Ketika menggunakan docker dengan mesin berbasis Redhat (e.g Almalinux, Rockylinux, Centos) dan menerapkan rules pada Firewalld maka container docker tidak bisa melakukan resolusi domain

Test ping:

[root@internal cemiks]# docker exec -it smoke-cs /bin/bash
root@:/# ping google.com
ping: bad address 'google.com'

Test dig:

root@internal/# dig google.com
; <<>> DiG 9.18.27 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 41334
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;google.com. IN A

;; Query time: 2 msec
;; SERVER: 127.0.0.11#53(127.0.0.11) (UDP)
;; WHEN: Fri Dec 13 13:20:34 WIB 2024
;; MSG SIZE rcvd: 28

Test dig menggunakan public DNS:

root@internal:/# dig @1.1.1.1 google.com
;; communications error to 1.1.1.1#53: host unreachable
;; communications error to 1.1.1.1#53: host unreachable
;; communications error to 1.1.1.1#53: host unreachable

; <<>> DiG 9.18.27 <<>> @1.1.1.1 google.com
; (1 server found)
;; global options: +cmd
;; no servers could be reached

Solusi dari masalah ini yaitu mengganti backend pada firewalld dari nftables ke iptables

$ sed 's/nftables/iptables/' /etc/firewalld/firewalld.conf

Last modified: January 14, 2025

Author

Comments

Write a Reply or Comment

Your email address will not be published.