Managing WorkSpaces DNS on Ubuntu WorkSpaces
This article shows how to change DNS servers on existing Ubuntu WorkSpaces without any disruption.
Series: AD Connector and WorkSpaces (4 articles)
- …
- 3Managing WorkSpaces DNS on Ubuntu WorkSpaces This article
Managing WorkSpaces DNS on Existing Ubuntu WorkSpaces (No Rebuild)
Applies to Ubuntu WorkSpaces.
Background: how WorkSpaces pin the AD Connector's DNS
When using AD Connector, the directory requires you to specify DNS servers. These are the initial DNS servers used for the SRV lookups that discover LDAP and Kerberos services.
The key behavior (the same on every WorkSpaces OS): for WorkSpaces, these DNS servers are hard-defined on the customer VPC network adapter (
eth1 ) based on the value of the setting at the time the WorkSpace was built. This value is not updated when you change the AD Connector's DNS settings, and VPC DHCP Option Sets do not change it either. The WorkSpace pins the AD Connector's DNS servers onto eth1 and keeps them pinned across reboots — which is why simply changing the AD Connector, or the DHCP Option Set, has no effect on existing WorkSpaces.What differs between operating systems is where that pinned value lives. On Windows it's the
DomainJoinDns REG_SZ registry value, re-applied by the Skylight service on every start. Ubuntu has no registry — it is a deb distro, so the Linux Skylight agent uses the Netplan driver ( DnsConfigurationNetplan ). At domain-join the agent writes the AD Connector DNS servers into a WorkSpaces-owned Netplan file; from then on persistence is handled by the OS network stack (netplan / systemd-networkd), not by Skylight re-applying it each boot. That Netplan file — not the registry and not /etc/resolv.conf — is the enforcement point.File to edit:
/etc/netplan/zz-workspaces-domain.yaml (plus /etc/netplan/zz-workspaces-domain-v6.yaml if the fleet uses IPv6 DNS).The generated YAML sets
use-dns: false / use-domains: false on the eth1 DHCP overrides (so DHCP / DHCP Option Sets can't override it), then hard-codes nameservers.addresses and nameservers.search .This means that to switch the DNS servers your AD Connector uses, you have two options with regard to Ubuntu WorkSpaces:
- Rebuild the WorkSpaces after the new value is set on the AD Connector. This is highly disruptive.
- Update the pinned Netplan file on each WorkSpace and re-apply, then switch the DNS servers in the AD Connector console. This is the preferred option — it requires no disruptive actions and can be pushed fleet-wide.
Two-step change (non-disruptive)
- Update the pinned Netplan file on the WorkSpaces and apply.
- Update the AD Connector to point at the new DNS servers.
Do this one DNS-server change at a time, during off-peak, and avoid launching WorkSpaces within ~15 minutes of the change. The disruptive alternative is to rebuild the WorkSpaces after updating the AD Connector.
Don't touch these
- Don't edit
/etc/resolv.conf— it's managed bysystemd-resolvedand will be overwritten.
- Don't edit
/var/lib/skylight/ad-dns.json(orad-dns-v6.json) - these JSON files are written at domain-join and are informational only (read again only during custom-image cleanup). They are not the runtime source of DNS.
- The
zz-filename prefix makes the file sort last so it wins over other netplan files. Keep the prefix.
- Agent-written permissions are
0600(root). Match that.
Option A — Manual (generic text editor)
Run as root (or with
sudo ). Works on both Ubuntu 22.04 and 24.04.1. Back up the current file:
sudo cp /etc/netplan/zz-workspaces-domain.yaml \
/etc/netplan/zz-workspaces-domain.yaml.bak2. Open the file in your editor:
sudo nano /etc/netplan/zz-workspaces-domain.yaml
# or: sudo vim /etc/netplan/zz-workspaces-domain.yaml3. Update the
addresses: (and search: if needed) under eth1 . Netplan is YAML — indentation matters (2 spaces per level, no tabs). Leave the dhcp4-overrides / dhcp6-overrides block intact so DHCP can't override your DNS:# Configured by Amazon WorkSpaces
network:
ethernets:
eth1:
dhcp4-overrides:
use-hostname: false
use-ntp: false
use-routes: false
use-domains: false
use-dns: false
dhcp6-overrides:
use-hostname: false
use-ntp: false
use-routes: false
use-domains: false
use-dns: false
nameservers:
search: [ad.example.com]
addresses: [10.3.0.57, 10.3.1.33] # <-- new AD Connector DNS IPs
version: 24. Validate and apply:
sudo netplan generate # syntax check (no changes applied)
sudo netplan apply # apply livenetplan try (apply with auto-rollback after 120s) exists but will drop the session on a WorkSpace, so prefer netplan generate + netplan apply .5. Verify:
resolvectl status eth1 # confirm the new DNS servers on eth1
resolvectl query <hostname-in-your-domain>
Option B — Ansible (fleet-wide)
Pushes the change fleet-wide. Two approaches below — pick one.
B1. Template the whole WorkSpaces Netplan file (recommended, deterministic)
vars / inventory:ad_dns_servers:
- 10.3.0.57
- 10.3.1.33
ad_search_domains:
- ad.example.comtemplates/zz-workspaces-domain.yaml.j2 :# Configured by Amazon WorkSpaces (managed by Ansible)
network:
ethernets:
eth1:
dhcp4-overrides:
use-hostname: false
use-ntp: false
use-routes: false
use-domains: false
use-dns: false
dhcp6-overrides:
use-hostname: false
use-ntp: false
use-routes: false
use-domains: false
use-dns: false
nameservers:
search: [{{ ad_search_domains | join(', ') }}]
addresses: [{{ ad_dns_servers | join(', ') }}]
version: 2playbook.yml :- name: Update AD Connector DNS on Ubuntu WorkSpaces
hosts: ubuntu_workspaces
become: true
tasks:
- name: Back up existing WorkSpaces netplan file
ansible.builtin.copy:
src: /etc/netplan/zz-workspaces-domain.yaml
dest: /etc/netplan/zz-workspaces-domain.yaml.bak
remote_src: true
ignore_errors: true
- name: Write WorkSpaces netplan DNS config
ansible.builtin.template:
src: zz-workspaces-domain.yaml.j2
dest: /etc/netplan/zz-workspaces-domain.yaml
owner: root
group: root
mode: '0600' # matches the agent's own file permissions
notify: Apply netplan
handlers:
- name: Apply netplan
ansible.builtin.command: netplan applyB2. Surgical edit of just the addresses: line (leaves the rest untouched)
Use when you don't want to own the whole file. Relies on the agent-generated structure:
- name: Update only the eth1 DNS addresses line
hosts: ubuntu_workspaces
become: true
vars:
ad_dns_servers:
- 10.3.0.57
- 10.3.1.33
tasks:
- name: Replace nameservers.addresses under eth1
ansible.builtin.replace:
path: /etc/netplan/zz-workspaces-domain.yaml
regexp: '^(\s*)addresses:\s*\[.*\]\s*$'
replace: '\1addresses: [{{ ad_dns_servers | join(", ") }}]'
notify: Apply netplan
handlers:
- name: Apply netplan
ansible.builtin.command: netplan applyNote: B2 assumes a singleaddresses:line undernameservers:in this file (true for the agent-generated template). If your file also sets static interfaceaddresses:, use B1 instead to avoid matching the wrong line.
Post-run verification task (optional, either approach)
- name: Show resolved DNS on eth1
ansible.builtin.command: resolvectl status eth1
register: rc_status
changed_when: false
- name: Print eth1 DNS status
ansible.builtin.debug:
var: rc_status.stdout_linesSeries: AD Connector and WorkSpaces (4 articles)
- …
- 3Managing WorkSpaces DNS on Ubuntu WorkSpaces This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article