Dns Priority

Test suite to check DNS service priorities

Valid Address

Description

Configures a simple, valid address and checks the DNS can resolve it. There is no priority involved as a single address is in use.

Scenario

Step 1: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 10.0.0.2/24
set service dns forwarding record host teldat.com ipv4-address 172.24.0.11
set service dns forwarding record host teldat.com ipv6-address ff00::dead:cafe
set service dns resolver local

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.0.0.1/24
set service dns forwarding logs
set service dns resolver local
set service dns forwarding name-server 10.0.0.2

Step 3: Ping IP address 10.0.0.2 from DUT0:

admin@DUT0$ ping 10.0.0.2 count 1 size 56 timeout 1
Show output
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.272 ms

--- 10.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.272/0.272/0.272/0.000 ms

Step 4: Run command show host lookup teldat.com type A wait 0 at DUT0 and check if output contains the following tokens:

172.24.0.11
Show output
teldat.com has address 172.24.0.11

Step 5: Run command service dns forwarding show logs | cat at DUT0 and expect this output:

Show output
-- Logs begin at Wed 2023-12-13 00:55:26 UTC, end at Wed 2023-12-13 00:55:30 UTC. --
Dec 13 00:55:30 osdx dnsmasq[19713]: dnsmasq: syntax check OK.
Dec 13 00:55:30 osdx dnsmasq[19720]: started, version 2.80 cachesize 150
Dec 13 00:55:30 osdx dnsmasq[19720]: DNS service limited to local subnets
Dec 13 00:55:30 osdx dnsmasq[19720]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
Dec 13 00:55:30 osdx dnsmasq[19720]: warning: ignoring resolv-file flag because no-resolv is set
Dec 13 00:55:30 osdx dnsmasq[19720]: using nameserver 10.0.0.2#53
Dec 13 00:55:30 osdx dnsmasq[19720]: read /etc/hosts - 1 addresses
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost.domain from ::1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded localhost.domain to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply error is REFUSED
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost.domain from 127.0.0.1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded localhost.domain to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply error is REFUSED
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost.domain from ::1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded localhost.domain to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply error is REFUSED
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost.domain from 127.0.0.1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded localhost.domain to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply error is REFUSED
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost from ::1
Dec 13 00:55:30 osdx dnsmasq[19720]: config localhost is NODATA-IPv4
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost.domain from ::1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded localhost.domain to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply error is REFUSED
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost.domain from 127.0.0.1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded localhost.domain to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply error is REFUSED
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost.domain from ::1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded localhost.domain to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply error is REFUSED
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost.domain from 127.0.0.1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded localhost.domain to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply error is REFUSED
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost from ::1
Dec 13 00:55:30 osdx dnsmasq[19720]: config localhost is NODATA-IPv4
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost.domain from ::1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded localhost.domain to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply error is REFUSED
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost.domain from 127.0.0.1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded localhost.domain to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply error is REFUSED
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost.domain from ::1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded localhost.domain to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply error is REFUSED
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost.domain from 127.0.0.1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded localhost.domain to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply error is REFUSED
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] localhost from ::1
Dec 13 00:55:30 osdx dnsmasq[19720]: config localhost is NODATA-IPv4
Dec 13 00:55:30 osdx dnsmasq[19720]: query[A] teldat.com from ::1
Dec 13 00:55:30 osdx dnsmasq[19720]: forwarded teldat.com to 10.0.0.2
Dec 13 00:55:30 osdx dnsmasq[19720]: reply teldat.com is 172.24.0.11

Valid Address IPv6

Description

Configures a simple, valid IPv6 address and checks the DNS can resolve it. There is no priority involved as a single address is in use.

Scenario

Step 1: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 10::2/64
set service dns forwarding record host teldat.com ipv4-address 172.24.0.11
set service dns forwarding record host teldat.com ipv6-address ff00::dead:cafe
set service dns resolver local

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10::1/64
set service dns forwarding logs
set service dns resolver local
set service dns forwarding name-server 10::2

Step 3: Ping IP address 10::2 from DUT0:

admin@DUT0$ ping 10::2 count 1 size 56 timeout 1
Show output
PING 10::2(10::2) 56 data bytes
64 bytes from 10::2: icmp_seq=1 ttl=64 time=387 ms

--- 10::2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 387.436/387.436/387.436/0.000 ms

Step 4: Run command show host lookup teldat.com type A wait 0 at DUT0 and check if output contains the following tokens:

172.24.0.11
Show output
teldat.com has address 172.24.0.11

Step 5: Run command service dns forwarding show logs | cat at DUT0 and expect this output:

Show output
-- Logs begin at Wed 2023-12-13 00:55:38 UTC, end at Wed 2023-12-13 00:55:45 UTC. --
Dec 13 00:55:42 osdx dnsmasq[20168]: dnsmasq: syntax check OK.
Dec 13 00:55:42 osdx dnsmasq[20175]: started, version 2.80 cachesize 150
Dec 13 00:55:42 osdx dnsmasq[20175]: DNS service limited to local subnets
Dec 13 00:55:42 osdx dnsmasq[20175]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
Dec 13 00:55:42 osdx dnsmasq[20175]: warning: ignoring resolv-file flag because no-resolv is set
Dec 13 00:55:42 osdx dnsmasq[20175]: using nameserver 10::2#53
Dec 13 00:55:42 osdx dnsmasq[20175]: read /etc/hosts - 1 addresses
Dec 13 00:55:45 osdx dnsmasq[20175]: query[A] teldat.com from ::1
Dec 13 00:55:45 osdx dnsmasq[20175]: forwarded teldat.com to 10::2
Dec 13 00:55:45 osdx dnsmasq[20175]: reply teldat.com is 172.24.0.11

Multiple Addresses

Description

Configures two DNS addresses: one invalid and the other valid. Checks that the resolution works against the second address, while the first one does not respond.

Scenario

Step 1: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 10.0.0.2/24
set service dns forwarding record host teldat.com ipv4-address 172.24.0.11
set service dns forwarding record host teldat.com ipv6-address ff00::dead:cafe
set service dns resolver local

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.0.0.1/24
set service dns forwarding logs
set service dns resolver local
set service dns forwarding name-server 10.0.0.10 priority 0
set service dns forwarding name-server 10.0.0.2 priority 1

Step 3: Ping IP address 10.0.0.2 from DUT0:

admin@DUT0$ ping 10.0.0.2 count 1 size 56 timeout 1
Show output
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.482 ms

--- 10.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.482/0.482/0.482/0.000 ms

Step 4: Run command show host lookup teldat.com type A wait 0 at DUT0 and check if output contains the following tokens:

172.24.0.11
Show output
teldat.com has address 172.24.0.11

Step 5: Run command service dns forwarding show logs | cat at DUT0 and expect this output:

Show output
-- Logs begin at Wed 2023-12-13 00:55:52 UTC, end at Wed 2023-12-13 00:55:58 UTC. --
Dec 13 00:55:56 osdx dnsmasq[20628]: dnsmasq: syntax check OK.
Dec 13 00:55:56 osdx dnsmasq[20635]: started, version 2.80 cachesize 150
Dec 13 00:55:56 osdx dnsmasq[20635]: DNS service limited to local subnets
Dec 13 00:55:56 osdx dnsmasq[20635]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
Dec 13 00:55:56 osdx dnsmasq[20635]: warning: ignoring resolv-file flag because no-resolv is set
Dec 13 00:55:56 osdx dnsmasq[20635]: using nameserver 10.0.0.10#53
Dec 13 00:55:56 osdx dnsmasq[20635]: using nameserver 10.0.0.2#53
Dec 13 00:55:56 osdx dnsmasq[20635]: read /etc/hosts - 1 addresses
Dec 13 00:55:56 osdx dnsmasq[20635]: query[A] teldat.com from ::1
Dec 13 00:55:56 osdx dnsmasq[20635]: forwarded teldat.com to 10.0.0.10
Dec 13 00:55:57 osdx dnsmasq[20635]: query[A] teldat.com from 127.0.0.1
Dec 13 00:55:58 osdx dnsmasq[20635]: query[A] teldat.com from ::1
Dec 13 00:55:58 osdx dnsmasq[20635]: forwarded teldat.com to 10.0.0.2
Dec 13 00:55:58 osdx dnsmasq[20635]: reply teldat.com is 172.24.0.11

Multiple IPv6 Addresses

Description

Configures two IPv6 DNS addresses: one invalid and the other valid. Checks that the resolution works against the second address, while the first one does not respond.

Scenario

Step 1: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 10::2/64
set service dns forwarding record host teldat.com ipv4-address 172.24.0.11
set service dns forwarding record host teldat.com ipv6-address ff00::dead:cafe
set service dns resolver local

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10::1/64
set service dns forwarding logs
set service dns resolver local
set service dns forwarding name-server 10::10 priority 0
set service dns forwarding name-server 10::2 priority 1

Step 3: Ping IP address 10::2 from DUT0:

admin@DUT0$ ping 10::2 count 1 size 56 timeout 1
Show output
PING 10::2(10::2) 56 data bytes
64 bytes from 10::2: icmp_seq=1 ttl=64 time=407 ms

--- 10::2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 407.349/407.349/407.349/0.000 ms

Step 4: Run command show host lookup teldat.com type A wait 0 at DUT0 and check if output contains the following tokens:

172.24.0.11
Show output
teldat.com has address 172.24.0.11

Step 5: Run command service dns forwarding show logs | cat at DUT0 and expect this output:

Show output
-- Logs begin at Wed 2023-12-13 00:56:05 UTC, end at Wed 2023-12-13 00:56:13 UTC. --
Dec 13 00:56:09 osdx dnsmasq[21089]: dnsmasq: syntax check OK.
Dec 13 00:56:09 osdx dnsmasq[21096]: started, version 2.80 cachesize 150
Dec 13 00:56:09 osdx dnsmasq[21096]: DNS service limited to local subnets
Dec 13 00:56:09 osdx dnsmasq[21096]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
Dec 13 00:56:09 osdx dnsmasq[21096]: warning: ignoring resolv-file flag because no-resolv is set
Dec 13 00:56:09 osdx dnsmasq[21096]: using nameserver 10::10#53
Dec 13 00:56:09 osdx dnsmasq[21096]: using nameserver 10::2#53
Dec 13 00:56:09 osdx dnsmasq[21096]: read /etc/hosts - 1 addresses
Dec 13 00:56:10 osdx dnsmasq[21096]: query[A] localhost.domain from ::1
Dec 13 00:56:10 osdx dnsmasq[21096]: forwarded localhost.domain to 10::10
Dec 13 00:56:11 osdx dnsmasq[21096]: query[A] teldat.com from ::1
Dec 13 00:56:11 osdx dnsmasq[21096]: forwarded teldat.com to 10::10
Dec 13 00:56:12 osdx dnsmasq[21096]: query[A] teldat.com from 127.0.0.1
Dec 13 00:56:13 osdx dnsmasq[21096]: query[A] teldat.com from ::1
Dec 13 00:56:13 osdx dnsmasq[21096]: forwarded teldat.com to 10::2
Dec 13 00:56:13 osdx dnsmasq[21096]: reply teldat.com is 172.24.0.11