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.543 ms

--- 10.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.543/0.543/0.543/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 Tue 2024-02-13 15:07:47 UTC, end at Tue 2024-02-13 15:07:51 UTC. --
Feb 13 15:07:51 osdx dnsmasq[21994]: dnsmasq: syntax check OK.
Feb 13 15:07:51 osdx dnsmasq[22001]: started, version 2.80 cachesize 150
Feb 13 15:07:51 osdx dnsmasq[22001]: DNS service limited to local subnets
Feb 13 15:07:51 osdx dnsmasq[22001]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
Feb 13 15:07:51 osdx dnsmasq[22001]: warning: ignoring resolv-file flag because no-resolv is set
Feb 13 15:07:51 osdx dnsmasq[22001]: using nameserver 10.0.0.2#53
Feb 13 15:07:51 osdx dnsmasq[22001]: read /etc/hosts - 1 addresses
Feb 13 15:07:51 osdx dnsmasq[22001]: query[A] teldat.com from ::1
Feb 13 15:07:51 osdx dnsmasq[22001]: forwarded teldat.com to 10.0.0.2
Feb 13 15:07:51 osdx dnsmasq[22001]: 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=425 ms

--- 10::2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 424.512/424.512/424.512/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 Tue 2024-02-13 15:07:58 UTC, end at Tue 2024-02-13 15:08:04 UTC. --
Feb 13 15:08:02 osdx dnsmasq[22454]: dnsmasq: syntax check OK.
Feb 13 15:08:02 osdx dnsmasq[22461]: started, version 2.80 cachesize 150
Feb 13 15:08:02 osdx dnsmasq[22461]: DNS service limited to local subnets
Feb 13 15:08:02 osdx dnsmasq[22461]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
Feb 13 15:08:02 osdx dnsmasq[22461]: warning: ignoring resolv-file flag because no-resolv is set
Feb 13 15:08:02 osdx dnsmasq[22461]: using nameserver 10::2#53
Feb 13 15:08:02 osdx dnsmasq[22461]: read /etc/hosts - 1 addresses
Feb 13 15:08:04 osdx dnsmasq[22461]: query[A] teldat.com from ::1
Feb 13 15:08:04 osdx dnsmasq[22461]: forwarded teldat.com to 10::2
Feb 13 15:08:04 osdx dnsmasq[22461]: 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.462 ms

--- 10.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.462/0.462/0.462/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 Tue 2024-02-13 15:08:11 UTC, end at Tue 2024-02-13 15:08:17 UTC. --
Feb 13 15:08:15 osdx dnsmasq[22916]: dnsmasq: syntax check OK.
Feb 13 15:08:15 osdx dnsmasq[22923]: started, version 2.80 cachesize 150
Feb 13 15:08:15 osdx dnsmasq[22923]: DNS service limited to local subnets
Feb 13 15:08:15 osdx dnsmasq[22923]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
Feb 13 15:08:15 osdx dnsmasq[22923]: warning: ignoring resolv-file flag because no-resolv is set
Feb 13 15:08:15 osdx dnsmasq[22923]: using nameserver 10.0.0.10#53
Feb 13 15:08:15 osdx dnsmasq[22923]: using nameserver 10.0.0.2#53
Feb 13 15:08:15 osdx dnsmasq[22923]: read /etc/hosts - 1 addresses
Feb 13 15:08:15 osdx dnsmasq[22923]: query[A] teldat.com from ::1
Feb 13 15:08:15 osdx dnsmasq[22923]: forwarded teldat.com to 10.0.0.10
Feb 13 15:08:16 osdx dnsmasq[22923]: query[A] teldat.com from 127.0.0.1
Feb 13 15:08:17 osdx dnsmasq[22923]: query[A] teldat.com from ::1
Feb 13 15:08:17 osdx dnsmasq[22923]: forwarded teldat.com to 10.0.0.2
Feb 13 15:08:17 osdx dnsmasq[22923]: 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=421 ms

--- 10::2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 421.251/421.251/421.251/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 Tue 2024-02-13 15:08:24 UTC, end at Tue 2024-02-13 15:08:33 UTC. --
Feb 13 15:08:28 osdx dnsmasq[23372]: dnsmasq: syntax check OK.
Feb 13 15:08:28 osdx dnsmasq[23379]: started, version 2.80 cachesize 150
Feb 13 15:08:28 osdx dnsmasq[23379]: DNS service limited to local subnets
Feb 13 15:08:28 osdx dnsmasq[23379]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
Feb 13 15:08:28 osdx dnsmasq[23379]: warning: ignoring resolv-file flag because no-resolv is set
Feb 13 15:08:28 osdx dnsmasq[23379]: using nameserver 10::10#53
Feb 13 15:08:28 osdx dnsmasq[23379]: using nameserver 10::2#53
Feb 13 15:08:28 osdx dnsmasq[23379]: read /etc/hosts - 1 addresses
Feb 13 15:08:31 osdx dnsmasq[23379]: query[A] teldat.com from ::1
Feb 13 15:08:31 osdx dnsmasq[23379]: forwarded teldat.com to 10::10
Feb 13 15:08:32 osdx dnsmasq[23379]: query[A] teldat.com from 127.0.0.1
Feb 13 15:08:33 osdx dnsmasq[23379]: query[A] teldat.com from ::1
Feb 13 15:08:33 osdx dnsmasq[23379]: forwarded teldat.com to 10::2
Feb 13 15:08:33 osdx dnsmasq[23379]: reply teldat.com is 172.24.0.11