private network. The IP address of PLABFED01 is 192.168.240.11 and the IP address of PLABFED01

WEB375 Lab 2: Configure a DNS server in Linux Lab Scenario Assignment The purpose of this lab is to create a DNS server in Linux. Use the IP addresses that exist when you start Linux. Virtual Machine Login Information for PLABFED01 and PLABFED02 Username: Student Password: Password Username: root Password: Password Lab Diagram During your session, you will have access to the following lab configuration. WINCONSOLE PLABFED01 PLABFED02 The Linux servers also connect to a private network. The IP address of PLABFED01 is 192.168.240.11 and the IP address of PLABFED01 is 192.168.240.12. Connecting to Your Lab In this module you will be working on the following equipment to carry out the steps defined in each exercise. • WINCONSOLE (Management Server) • PLABFED01 (Linux Server) • PLABFED02 (Linux Server) Each exercise will detail which console you are required to work on to carry out the steps. To start simply click on the named Server from the device list (located on the left hand side of the screen) and click “Power on” from the Tools bar. In some cases the devices may power on automatically. During the boot-up process an activity indicator will be displayed in the name tab: • Black—Powered off • Orange—Working on your request • Green—Ready to access If the remote console is not displayed automatically in the main window (or pop-up), click the Connect icon located in the Tools bar to start your session. If the remote console does not appear, please try the following option: • Switch between the HTML 5 and Java client versions in the Tools bar. In the event this does not resolve your connectivity problems, please visit our Help and Support pages for additional resolution options. DNS Configuration Step by Step General Information We are going to create a DNS server with the following assumptions: • Domain name is linuxlab.org • DNS server name is dnsserv • IP address of the DNS server is192.168.240.11 • IP address of the other Linux system on the network is 192.168.240.12 TASK A—Configure DNS server Step 1. Use TigerVNC to logon to the PLABFED01 system. Open a terminal window, switch to root, and make sure the bind package is installed. Type the following command. rpm -q bind bind-utils Step 2. If it tells you that the package is not installed then you need to install it; otherwise skip Step 2. To install bind on Fedora Linux system, type the following. yum –y install bind bind-utils Step 3. To enable the name server at boot time, type the following. systemctl enable named.service Step 4. Configure the “/etc/named.conf” file. Use a text editor (vi, nano) to edit the /etc/named.conf, comment out two line as shown, then insert the shaded lines below. // listen-on port 53 { 127.0.0.1; }; // listen-on-v6 port 53 { ::1; }; zone “linuxlab.org” IN { type master; file “forward.zone”; notify no; }; zone “240.168.192.in-addr.arpa” IN { type master; file “reverse.zone”; notify no; }; The final /etc/named.conf file should look like below. // named.conf // // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS // server as a caching only nameserver (as a localhost DNS resolver only). // // See /usr/share/doc/bind*/sample/ for example named configuration files. // options { // listen-on port 53 { 127.0.0.1; }; // listen-on-v6 port 53 { ::1; }; directory “/var/named”; dump-file “/var/named/data/cache_dump.db”; statistics-file “/var/named/data/named_stats.txt”; memstatistics-file “/var/named/data/named_mem_stats.txt”; allow-query { localhost; }; /* – If you are building an AUTHORITATIVE DNS server, do NOT enable recursion. – If you are building a RECURSIVE (caching) DNS server, you need to enable recursion. – If your recursive DNS server has a public IP address, you MUST enable access control to limit queries to your legitimate users. Failing to do so will cause your server to become part of large scale DNS amplification attacks. Implementing BCP38 within your network would greatly reduce such attack surface */ recursion yes; dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto; /* Path to ISC DLV key */ bindkeys-file “/etc/named.iscdlv.key”; managed-keys-directory “/var/named/dynamic”; pid-file “/run/named/named.pid”; session-keyfile “/run/named/session.key”; }; logging { channel default_debug { file “data/named.run”; severity dynamic; }; }; zone “.” IN{ type hint; file “named.ca”; notify no; }; zone “linuxlab.org” IN{ type master; file “forward.zone”; notify no; }; zone “240.168.192.in-addr.arpa” IN{ type master; file “reverse.zone”; notify no; }; include “/etc/named.rfc1912.zones”; include “/etc/named.root.key”; Step 5. Configure the “/var/named/forward.zone” file. Use a text editor (vi, nano) to create forward.zone file as below, then use the Tab key to insert blank spaces. ; ;forward.zone ; ;zone file for dnsserv.linuxlab.org ; $TTL 1H @ IN SOA dnsserv.linuxlab.org. root.dnsserv.linuxlab.org. ( 2002011800 ; Serial 1D ; Refresh 1 day 1H ; Retry 1 hour 1W ; Expire 1 week 2H ) ; Minimum TTL 2 hour IN NS dnsserv.linuxlab.org. localhost IN A 127.0.0.1 dnsserv IN A 192.168.240.11 plabfed02 IN A 192.168.240.12 Step 6. Configure the “/var/named/reverse.zone” file. Create reverse.zone file as below. ; ;reverse.zone ; ;reverse zone file for lookup ; $TTL 1H @ IN SOA dnsserv.linuxlab.org. root.dnsserv.linuxlab.org. ( 2002011800 ; Serial 1D ; Refresh 1 day 1H ; Retry 1 hour 1W ; Expire 1 week 2H ) ; Minimum TTL 2 hour IN NS dnsserv.linuxlab.org. 11 IN PTR dnsserv.linuxlab.org. 12 IN PTR plabfed02.linuxlab.org. Tip Check the two zone files and make sure that each FQDN, such as dnsserv.linuxlab.org, ends with a period. Missing periods are by far the most common reason that the DNS server does not work. Step 7. To change the ownership of the zone files, type the following. chown root.named forward.zone chown root.named reverse.zone Step 8. To stop, start up, and check status for the DNS server, type the following. systemctl stop named.service systemctl start named.service systemctl status named.service • If the nameserver failed to start, view the error messages in the /var/log/messages. Below is an example. tail /var/log/messages or journalctl -xn • You may have to edit the files /etc/named.conf, /var/named/forward.zone, or /var/named/reverse.zone to correct typos. • To restart the DNS server, type the following. Systemctl restart named.service TASK B—Configure DNS client You can configure the DNS server and client on the same system. If you want to use the plabfed02 as a DNS client, you need to log in as root and complete the following steps. We are going to configure the DNS client and server on the same system. Step 1. Configure the “/etc/hosts” file (only keep below three lines). # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost Step 2. Configure the “/etc/resolv.conf” file (only three lines). search linuxlab.org domain linuxlab.org nameserver 192.168.240.11 Step 3. View the “/etc/nsswitch.conf” file (make sure this line exists). hosts: files dns Step 4. View the “/etc/host.conf” file (only two lines), making sure this line exists. order hosts,bind TASK C—Testing the DNS Server on a DNS Client Step 1. Sample a DNS testing with correct results. Step 2. DNS testing Follow the below steps closely. • Make sure your name server IP address is 192.168.240.11. • Restart the named. • Check the /etc/resolv.conf; it should contain three lines. search linuxlab.org domain linuxlab.org nameserver 192.168.240.11 • Issue the following commands. 1) host dnsserv 2) host dnsserv.linuxlab.org 3) host 192.168.240.11 Step 3. Disable DNS on bootup. #systemctl disable named.service TASK D—Lab Report Preparation Step 1. Use the cat command to display the forward.zone file and capture the Linux desktop, then save this image to your Lab Report document in the space allocated for the forward.zone file. Step 2. Use the cat command to display the reverse.zone file and capture the Linux desktop, then save this image to your Lab Report document in the space allocated for the reverse.zone file. Step 3. Clear the screen and issue the following commands, then capture the Linux desktop and save this image to your Lab Report document in the space allocated for host commands. • host dnsserv • host dnsserv.linuxlab.org • host 192.168.240.11 This concludes Lab 2.