Question

How to change DNS nameserver for CoreOS?

  • Posted on September 19, 2014
  • bryantlukAsked by bryantluk

Hi,

I’m using the CoreOS image for my droplet. Is there any way to change which DNS name server is used? I would actually like to use consul.io for service lookup and have it fallback to the Google DNS servers.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

On CoreOS, /etc/resolve.conf is managed by systemd. One way to append to it would be to use the cloud-config metadata to add a new systemd unit file. Something like:

#cloud-config
coreos:
  etcd:
    # generate a new token for each unique cluster from https://discovery.etcd.io/new
    discovery: https://discovery.etcd.io/[your-token-here]
    # multi-region deployments, multi-cloud deployments, and droplets without
    # private networking need to use $public_ipv4
    addr: $private_ipv4:4001
    peer-addr: $private_ipv4:7001
  fleet:
    public-ip: $private_ipv4   # used for fleetctl ssh command
  units:
    - name: etcd.service
      command: start
    - name: fleet.service
      command: start
      units:
    - name: nameservers.network
      content: |
        [Network]
        DNS=8.8.4.4
        DNS=8.8.8.8