YAML examples for DNS use cases
Static DNS with auto IP interface
Getting IP from DHCP or IPv6 autoconf/RA but use static DNS configurations.
---
dns-resolver:
config:
search:
- example.com
- example.org
server:
- 2001:db8:f::1
- 192.0.2.251
interfaces:
- name: eth1
type: ethernet
state: up
ipv4:
enabled: true
dhcp: true
auto-dns: false
ipv6:
enabled: true
dhcp: true
autoconf: true
auto-dns: false
Static DNS with static IP interface
---
dns-resolver:
config:
search:
- example.com
- example.org
server:
- 2001:4860:4860::8844
- 192.0.2.251
interfaces:
- name: eth1
type: ethernet
state: up
ipv4:
enabled: true
dhcp: false
address:
- ip: 192.0.2.251
prefix-length: 24
ipv6:
enabled: true
dhcp: false
autoconf: false
address:
- ip: 2001:db8:1::1
prefix-length: 64
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.0.2.1
next-hop-interface: eth1
- destination: ::/0
next-hop-address: 2001:db8:1::3
next-hop-interface: eth1
Static DNS name servers append to DHCP/autoconf name servers
When using with dnsmasq or other DNS caching system, you might want 127.0.0.1
been append to auto DNS learn from DHCP/autoconf.
---
dns-resolver:
config:
search:
- example.com
- example.org
server:
- 127.0.0.1
interfaces:
- name: eth1
type: ethernet
state: up
ipv4:
enabled: true
dhcp: true
auto-dns: true
ipv6:
enabled: true
dhcp: true
autoconf: true
auto-dns: true
Static DNS search option with DHCP/autoconf name servers
---
dns-resolver:
config:
search:
- example.com
- example.org
interfaces:
- name: eth1
type: ethernet
state: up
ipv4:
enabled: true
dhcp: true
ipv6:
enabled: true
dhcp: true
autoconf: true
Static IPv6 link local name server
---
dns-resolver:
config:
search:
- example.com
- example.org
server:
- fe80::deef:1%eth1
- 2001:db8:f::1
- 192.0.2.251
interfaces:
- name: eth1
type: ethernet
state: up
ipv4:
enabled: true
dhcp: false
address:
- ip: 192.0.2.251
prefix-length: 24
ipv6:
enabled: true
dhcp: false
autoconf: false
address:
- ip: 2001:db8:1::1
prefix-length: 64
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.0.2.1
next-hop-interface: eth1
- destination: ::/0
next-hop-address: 2001:db8:1::3
next-hop-interface: eth1