Question

How to change DNS nameserver for CoreOS?

  • Posted September 19, 2014

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.

Subscribe
Share

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

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.

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