1 of 22

WEEK 12

Server Setup

2 of 22

Domain Name System

  • Maps the domain name to its numerical IP address on the network.
  • Computers use IP addresses but we use domain names.
  • Example: A user could visit google.com by going directly to IP address 172.217.160.206 or use google.com domain name

Domain Name System - Terminology

  • Domain Name
  • Top-Level Domain [TLD]
  • Sub Domain
  • Fully Qualified Domain Name
  • Name Server & Client
  • Zone File
  • Records

3 of 22

Domain Name System – Name Servers

  • Primary Server – Acts as Authoritative Server, maps domain name to IP address using zone files.
  • Secondary Servers – Acts as Back Up Server, copies zone files from primary server.
  • Caching Servers – Provides Cashing Query Service, do not store any zone files.

Domain Name System – Installation

  • WINDOWS – Install windows server 2019 operating system or any other version. Install DNS server and configure it using server manager.
    • Step 1: Open Server Manager, Select “Role-based or feature-based installation”.
    • Step 2: Select DNS Server and click on Add Features. Note use static IP address.
    • Step 3: Confirm your selections then hit “Install”.
    • Step 4: Wait for the Installation then hit “Close”.

4 of 22

  • LINUX - BIND (Berkley Internet Naming Daemon) is used for maintaining a name server on Linux.
    • Install the bind program by running the command sudo apt-get install bind9 on linux terminal.

Domain Name System – Configuration

  • Once DNS server is installed, zone has to be created.
  • A forward lookup zone converts a domain name to an IP address.
  • Reverse lookup zone converts an IP address to domain name.
  • Both have to be configured for proper functioning of DNS.

5 of 22

Domain Name System – Forward & Reverse Lookup Zone

  • Open DNS Configuration window from Server Manager.
  • Select your server and click on new zone and choose primary zone.
  • Add Forward Lookup Zone – enter zone name (domain name).
  • Add Reverse Lookup Zone – choose IPv4, enter zone name or IP address
  • Input Zone File – auto created name is sufficient.
  • Check or uncheck dynamic updates
  • Complete the zone creation wizard by clicking finish
  • Confirm zones by checking DNS Manager.

6 of 22

Domain Name System – Record Creation

  • Open DNS Configuration window from Server Manager.
  • Expand the “Forward Lookup Zones” , right-click to add an A and PTR record and choose “New Host (A or AAAA)”
  • Key in your sub-domain and corresponding IP Address. Click “Add Host” after that.
  • Confirm by clicking “OK”. A Record will be visible inside the forward lookup zone and PTR record will be visible inside reverse lookup zone.
  • Open up a command prompt or Powershell and issue “nslookup” or any dns tool to confirm

7 of 22

Domain Name System – Configuration

  • Once DNS server is installed, zone has to be created.

  • A forward lookup zone converts a domain name to an IP address.

  • Reverse lookup zone converts an IP address to domain name.

  • Both have to be configured for proper functioning of DNS

8 of 22

Domain Name System – Tools

  • nslookup – perform query testing of the DNS domains & hostnames.

  • ping - send ICMP ECHO_REQUEST to remote hosts across the network.
  • dig - querying DNS servers when you are looking for address records, name server records, etc.
  • whois - to find whether the domain is registered or not.

  • host - know the host assigned to an IP address and vice-verca

9 of 22

File Transfer Protocol - Introduction

  • Network protocol for transmitting files between computers.

  • FTP uses standard TCP/IP protocol .

  • FTP works based on Client-Server Architecture.

10 of 22

File Transfer Protocol - Installation

PREREQUISITES

  • To install FTP on UNIX/LINUX operating system, we require FTP servers like PureFTPD, ProFTPD, VsFTPD etc

  • Administrative rights for LINUX user.

  • Use sudo command to become root user.

11 of 22

File Transfer Protocol – Installation Procedure

  • Step 1: Update System Packages. Use “sudo apt update” command.
  • Step 2: Install vsftpd Server on Ubuntu. Use “sudo apt install vsftpd” command.

To launch the service and enable it at startup, run the commands

sudo systemctl start vsftpd

sudo systemctl enable vsftpd

  • Step 3: Backup Configuration Files. Use the following command

sudo cp /etc/vsftpd.conf /etc/vsftpd.conf_default

12 of 22

  • Step 4: Create FTP User. Use the command

sudo useradd -m testuser

sudo passwd testuser

  • Step 5: Configure Firewall to Allow FTP Traffic

sudo ufw allow 20/tcp

sudo ufw allow 21/tcp

  • Step 6: Connect to Ubuntu FTP Server

sudo ftp ubuntu-ftp // (system_name)

13 of 22

File Transfer Protocol – Configuration

  • Change Default Directory - /srv/ftp

Use mkdir to create new directory and usermod to change user home directory.

Restart vsftpd service to apply the change.

sudo systemctl restart vsftpd.service

  • Authenticate FTP Users

Edit the vsftpd.conf using cat command or nano text editor

write_enable=NO, and change the value to “YES.”

Restart vsftpd service to apply the change.

14 of 22

File Transfer Protocol – Secure

  • Limit User Access

Open vsftpd.conf in an editor and uncomment the following command:

chroot_local_user=YES

  • Create a User List File

Edit /etc/vsftpd.chroot_list, and add one user per line.

Open vsftpd.conf , set chroot_list_file=/etc/vsftpd.chroot_list

Restart the vsftpd service:

sudo systemctl restart vsftpd.service

15 of 22

  • The list of blocked users from FTP access is stored in /etc/ftpusers.

To add blocked users, edit this file and add one user per line.

  • Encrypt Traffic With FTPS

To encrypt the traffic, use FTPS – FTP over SSL (Secure Socket Layer).

  • Creating a new certificate with openssl
  • Edit vsftpd.conf file and change the line ssl_enable=NO to ssl_enable=YES:
  • Add set of defined codes. Save the changes and exit the file.
  • Finally, restart the service to apply the changes:

16 of 22

Apache Web Server - Introduction

  • Network service that serves content to a client over the web

  • The Apache HTTP Server, httpd, is an open source web server developed by the Apache Software Foundation

  • Web servers are also known as HTTP servers, use the hypertext transport protocol (HTTP).

17 of 22

Apache Web Server - Installation

  • Web Server can be installed using third party software such as LAMP, MAMP, WAMP or

XAMPP etc.

  • To install apache http server on linux platform, use the following commands.
  • sudo apt-get update
  • sudo apt-get install apache2

18 of 22

Apache Web Server - Configuration

  • Step 1: Create the Directory Structure

The default directory structure is /var/www.

Create a new directory under this directory using the command

sudo mkdir -p /var/www/example.com

  • Step 2: Grant Permission

Change the root ownership to others normal

sudo chown -R $USER:$USER /var/www/example.com

sudo chmod -R 755 /var/www

19 of 22

  • Step 3: Create Demo Pages for Virtual Host

Design a very simple Web page.

nano /var/www/example.com/index.html

  • Step 4: Create New Virtual Host Files

A default virtual host file is 000-default.conf. Now copy it

sudo cp /etc/apache2/sites-available/000-default.conf

/etc/apache2/sites-available/example.com.conf

Add server admin, name, alias and document root information

20 of 22

  • Step 5: Enabling the New Virtual Host Files

Use the a2ensite tool to enable sites

sudo a2ensite example.com.conf

Disable the default site

sudo a2dissite 000-default.conf

Restart Apache to make these changes take effect:

sudo systemctl restart apache2

21 of 22

  • Step 6: Create New Virtual Host Files

Edit local file with administrative privileges by typing:

sudo nano /etc/hosts

For example, for the domains machine with IP address 172.16.20.107 is used then, add the following lines to the bottom of hosts file:

127.0.0.1 localhost

127.0.1.1 guest-desktop

172.16.20.107 example.com

22 of 22

  • Step 7: Testing working of Web Server

Go to the other machines /etc/hosts and do the above settings (step 6) like

172.16.20.107 example.com

Try http://example.com, this will display the web page of virtual host.