VMware vSphere

 View Only
  • 1.  Linux DNS and Domain Settings - Customization Specifications

    Posted Oct 30, 2014 01:22 PM

    I am looking for a little insight into an issue I am running into with the Customization Specifications for Linux on vCenter 5.1. The DNS and Domain Settings section of Guest Customization dialog for Linux has a field for DNS Search Path.  I typically add two domains to our search path via the resolve.conf.  This feature overwrites that and if I add two domains in this dialog, it writes them to the ifcfg-eth0 in the DOMAIN directive as well, causing an error on startup. If I just put one domain in, then the resolve.conf only contains that one domain in the resolve.conf and it would need to be edited later. Typically, I don't use the DOMAIN directive in the ifcfg-eth0 at all and rely upon the resolve.conf.  Any idea on how I can manage these settings better such as having the customization not write the DNS and Domain info into the ifcfg-* files?



  • 2.  RE: Linux DNS and Domain Settings - Customization Specifications

    Posted Jan 23, 2024 10:41 PM

    I realize this is a 10 year old post, but this was my solution.

    I couldn't get around  adding the domain name to the VM Customization Specifications, as otherwise it doesn't let you save it.

    However, you can leave the DNS settings blank in your customization specification and save it.

    Once you've done this, navigate to the Customization script section, and make it populate resolv.conf here. Note, you want to add the step as a postcustomization. eg:

    ---------------------

    #!/bin/sh
    if [ x$1 == x"precustomization" ]; then
    echo "No Precustomization tasks"
    elif [ x$1 == x"postcustomization" ]; then
    echo "Populating /etc/resolv.conf"
    cat > /etc/resolv.conf <<EOF
    # Our custom DNS config

    options rotate
    options timeout:1
    search mydomain.me
    nameserver 10.0.0.1
    nameserver 10.0.0.2
    EOF

    fi

    ---------------------------

    Your ifcfg-* file will still get populated with the DNS search domain, but at least it won't add the DNS servers in there (which we also don't use and has caused us problems in the past).

    Hope this helps...