Dns

This scenario shows how to configure a DHCP client to receive information about a DNS server.

../../../../../_images/dnsdhcp.svg

Test DNS Server

Description

DUT0 is configured to obtain some information over DHCP: IP address and DNS host.

Scenario

Step 1: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address 10.215.200.100/24
set service dhcp-server shared-network dhcpserver options authoritative
set service dhcp-server shared-network dhcpserver subnet 10.215.200.0/24 options default-router 10.215.200.100
set service dhcp-server shared-network dhcpserver subnet 10.215.200.0/24 options dns-server 10.215.200.100
set service dhcp-server shared-network dhcpserver subnet 10.215.200.0/24 start 10.215.200.50 stop 10.215.200.50
set service dns forwarding
set service dns static host-name dut1.teldat.com inet 10.215.200.100
set service dns static host-name teldat.com inet 172.24.0.221
set service dns static host-name test1.teldat.com inet 172.24.0.225
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address dhcp
set service dns forwarding dhcp
set system cli configuration logging global info
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Ping IP address 10.215.200.50 from DUT0:

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

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

Step 4: Run command service dhcp-client show leases interface eth0 at DUT0 and check if output matches the following regular expressions:

DHCP server:\s+10.215.200.100
Subnet mask:\s+255.255.255.0
Routers:\s+10.215.200.100
Name-servers:\s+10.215.200.100
Show output
Interface:     eth0
IP address:    10.215.200.50
Subnet mask:   255.255.255.0
Routers:       10.215.200.100
Name-servers:  10.215.200.100
Domain-name:
NTP servers:
DHCP server:   10.215.200.100
Lease time:    43200
Expiry date:   Thu Feb 20 05:10:16 2025
Reason:        BOUND

Step 5: Run command interfaces ethernet eth0 show at DUT0 and check if output contains the following tokens:

10.215.200.50/24
Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.215.200.50/24              up     up
      fe80::dcad:beff:feef:6c00/64

Step 6: Run command service dns forwarding show nameservers at DUT0 and check if output contains the following tokens:

10.215.200.100
Show output
-----------------------------------------------------
  Nameserver    Domain     Available Via     Priority
-----------------------------------------------------
10.215.200.100  *       DHCP interface eth0  5

Step 7: Run command nslookup teldat.com at DUT0 and check if output contains the following tokens:

172.24.0.221
Show output
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   teldat.com
Address: 172.24.0.221
** server can't find teldat.com: REFUSED

Test Avoid Overlapping of Server With DNS

Description

DUT0 is configured to obtain DNS host over DHCP and from an static configuration being the IP of the server the same.

Scenario

Step 1: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address 10.215.200.100/24
set service dhcp-server shared-network dhcpserver options authoritative
set service dhcp-server shared-network dhcpserver subnet 10.215.200.0/24 options default-router 10.215.200.100
set service dhcp-server shared-network dhcpserver subnet 10.215.200.0/24 options dns-server 10.215.200.100
set service dhcp-server shared-network dhcpserver subnet 10.215.200.0/24 start 10.215.200.50 stop 10.215.200.50
set service dns forwarding
set service dns static host-name dut1.teldat.com inet 10.215.200.100
set service dns static host-name teldat.com inet 172.24.0.221
set service dns static host-name test1.teldat.com inet 172.24.0.225
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address dhcp
set service dns forwarding dhcp priority 2
set service dns forwarding name-server 10.215.200.100 priority 1
set system cli configuration logging global info
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Ping IP address 10.215.200.50 from DUT0:

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

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

Step 4: Run command service dns forwarding show nameservers at DUT0 and expect this output:

Show output
-----------------------------------------------------
  Nameserver    Domain     Available Via     Priority
-----------------------------------------------------
10.215.200.100  *       "static"             1
10.215.200.100  *       DHCP interface eth0  2