diff --git a/internal/dnsforward/dnsforward.go b/internal/dnsforward/dnsforward.go index f9ac8723..8afbd3df 100644 --- a/internal/dnsforward/dnsforward.go +++ b/internal/dnsforward/dnsforward.go @@ -247,7 +247,6 @@ func NewServer(p DNSCreateParams) (s *Server, err error) { privateNets: p.PrivateNets, // TODO(e.burkov): Use some case-insensitive string comparison. localDomainSuffix: strings.ToLower(localDomainSuffix), - etcHosts: p.EtcHosts, recDetector: newRecursionDetector(recursionTTL, cachedRecurrentReqNum), clientIDCache: cache.New(cache.Config{ EnableLRU: true, @@ -258,6 +257,9 @@ func NewServer(p DNSCreateParams) (s *Server, err error) { ServePlainDNS: true, }, } + if p.EtcHosts != nil { + s.etcHosts = p.EtcHosts + } s.sysResolvers, err = sysresolv.NewSystemResolvers(nil, defaultPlainDNSPort) if err != nil {