diff --git a/pkg/crc/services/dns/dns.go b/pkg/crc/services/dns/dns.go index a8c79608d8..fd1fb739ec 100644 --- a/pkg/crc/services/dns/dns.go +++ b/pkg/crc/services/dns/dns.go @@ -20,9 +20,8 @@ import ( const ( dnsServicePort = 53 - dnsContainerIP = "10.88.0.8" publicDNSQueryURI = "quay.io" - crcDnsmasqService = "crc-dnsmasq.service" + dnsmasqService = "dnsmasq.service" ) func init() { @@ -54,12 +53,12 @@ func setupDnsmasq(serviceConfig services.ServicePostStartConfig) error { return err } sd := systemd.NewInstanceSystemdCommander(serviceConfig.SSHRunner) - if state, err := sd.Status(crcDnsmasqService); err != nil || state != states.Running { - if err := sd.Enable(crcDnsmasqService); err != nil { + if state, err := sd.Status(dnsmasqService); err != nil || state != states.Running { + if err := sd.Enable(dnsmasqService); err != nil { return err } } - return sd.Start(crcDnsmasqService) + return sd.Start(dnsmasqService) } func getResolvFileValues(serviceConfig services.ServicePostStartConfig) (network.ResolvFileValues, error) { @@ -89,7 +88,7 @@ func dnsServers(serviceConfig services.ServicePostStartConfig) ([]network.NameSe if err != nil { return nil, err } - return append([]network.NameServer{{IPAddress: dnsContainerIP}}, orgResolvValues.NameServers...), nil + return append([]network.NameServer{{IPAddress: serviceConfig.IP}}, orgResolvValues.NameServers...), nil } func CheckCRCLocalDNSReachable(ctx context.Context, serviceConfig services.ServicePostStartConfig) (string, error) { diff --git a/pkg/crc/services/dns/template.go b/pkg/crc/services/dns/template.go index 95e6181a82..8db3824fd6 100644 --- a/pkg/crc/services/dns/template.go +++ b/pkg/crc/services/dns/template.go @@ -8,9 +8,7 @@ import ( ) const ( - dnsmasqConfTemplate = `user=root -port= {{ .Port }} -bind-interfaces + dnsmasqConfTemplate = `listen-address={{ .IP }} expand-hosts log-queries local=/{{ .ClusterName}}.{{ .BaseDomain }}/ @@ -38,7 +36,6 @@ func createDnsmasqDNSConfig(serviceConfig services.ServicePostStartConfig) error dnsmasqConfFileValues := dnsmasqConfFileValues{ BaseDomain: domain, Hostname: serviceConfig.BundleMetadata.Nodes[0].Hostname, - Port: dnsServicePort, AppsDomain: serviceConfig.BundleMetadata.ClusterInfo.AppsDomain, ClusterName: serviceConfig.BundleMetadata.ClusterInfo.ClusterName, IP: serviceConfig.IP, @@ -50,7 +47,7 @@ func createDnsmasqDNSConfig(serviceConfig services.ServicePostStartConfig) error return err } - return serviceConfig.SSHRunner.CopyDataPrivileged([]byte(dnsConfig), "/var/srv/dnsmasq.conf", 0644) + return serviceConfig.SSHRunner.CopyDataPrivileged([]byte(dnsConfig), "/etc/dnsmasq.d/crc-dnsmasq.conf", 0644) } func createDNSConfigFile(values dnsmasqConfFileValues, tmpl string) (string, error) {