Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-30645

"getent hosts <hostname>" return "::1" instead of local address

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Normal Normal
    • rhel-8.10.z
    • rhel-8.9.0
    • systemd
    • None
    • None
    • Moderate
    • rhel-plumbers
    • ssg_core_services
    • 5
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • None
    • None
    • None

      What were you trying to do that didn't work?

      When systemd-resolved is used as the resolver, executing getent hosts $(hostname -s) returns the following:

      ::1       <hostname>
      

      This happens when IPv6 is disabled (using ipv6.disable=1).
      The customer (and myself) are expecting the the local IP to be returned instead, e.g.:

      192.168.122.254  vm-rhel8
      

      Please provide the package NVR for which bug is seen:

      systemd-239-78.el8.x86_64

      How reproducible:

      Always

      Steps to reproduce

      1. Boot the system with ipv6.disable=1
      2. Start systemd-resolved service with following configuration
        [Resolve]
        DNS=192.168.122.1
        Domains=libvirt
        DNSSEC=false
        LLMNR=no
      3. Make sure /etc/resolv.conf uses it
        search libvirt
        nameserver 127.0.0.53
      4. Execute getent hosts $(hostname -s)

      Expected results

      192.168.122.254 vm-rhel8
      

      Actual results

      ::1 vm-rhel8
      

      Additional notes

      Using FQDN returns the appropriate value:

      # getent hosts $(hostname -f)
      192.168.122.254 vm-rhel8.libvirt
      

              jmigacz@redhat.com Jacek Migacz
              rhn-support-rmetrich Renaud Métrich
              systemd maint mailing list systemd maint mailing list
              Frantisek Sumsal Frantisek Sumsal
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: