Dns
This scenario shows how to configure a DHCP client to receive information about a DNS server.
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 start 10.215.200.50 stop 10.215.200.50 set service dhcp-server shared-network dhcpserver subnet 10.215.200.0/24 options dns-server 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 service dns static host-name dut1.teldat.com inet 10.215.200.100 set service dns forwarding logs
Step 2: Set the following configuration in DUT0
:
set interfaces ethernet eth0 address dhcp set service dns forwarding dhcp set service dns forwarding logs
Step 3: Ping IP address 10.215.200.50
from DUT0
:
admin@DUT0$ ping 10.215.200.50 count 1 size 56 timeout 1Show 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.027 ms --- 10.215.200.50 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.027/0.027/0.027/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.100Show 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 Jan 25 12:24:47 2024 Reason: BOUND
Step 5: Run command interfaces ethernet eth0 show
at DUT0
and check if output contains the following tokens:
10.215.200.50/24Show output
----------------------------------------------------------------- Name IP Address Admin Oper Vrf Description ----------------------------------------------------------------- eth0 10.215.200.50/24 up up fe80::dcad:beff:feef:6c10/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