# Data Networking/Spring 2017/RADAR
## LINUX PROJECT
### THE TEAM

1. RISHABH AGARWAL 2. ARIF JAN ASHRAF JAN 3. DIVYA SHARMA 4. ABHISHEK RAO JANARDHAN RAO

### MOTIVATION

This project helps us build a deeper understanding of the basic networking fundamentals with the practical implementation of a Dynamic Host Configuration Protocol (DHCP) Server, Domain Name System (DNS) Server, Web Server, Firewall and Backup Server.
The main purpose of this project is to create a complete network environment in which the servers and clients will be able to dynamically get IP addresses from the DHCP server created, after which with the help of the DNS server created, the users in the created network would be able to successfully fetch and ping www.radar.com which is the webserver hosted by us.
Configuration of components such as backup server, firewall, Network File System(NFS) and IPSec VPN tunnels to create a very complex, intricate, robust and secure inter-networking system which can be implemented and used by organizations and companies.

### BEHAVIOR OF THE PROTOCOL
#### Dynamic Host Configuration Protocol

Dynamic Host Configuration Protocol (DHCP) is an internet protocol that allows the server to assign IP addresses to the systems(client) in the network it’s a part of, also it can be configured to assign IP addresses from a selected range of IP’s provided by the person that constructed and configured the server. The DHCP server can lease IP addresses to the cliest which are enabled to get IP’s assigned by the DHCP server. The IP addresses which are no longer used by the clients are returned back to the pool for reallocation. Both IPV4 and IPV6 addresses can be assigned using DHCP server.
DHCP assigns IP’s in the following manner.
* Automatic allocation: DHCP assigns IP address to a client when it gets the IP request packet.
* Dynamic allocation:DHCP assigns IP addresses to clients for a particular time limit(or till the client is no longer using it) which is basically leasing of the IP’s. When the lease period is completed, the client will request an extension on the lease or request for a new IP to be assigned.
* Manual allocation:Another not so commonly used method of allocation is manual allocation in which the client is assigned the same IP address using the MAC address of the system as a label or tag.

#### Domain Name System

DNS is an application layer protocol with the ability to translate domain names to IP addresses and vice versa. The basic job of the DNS is to provide simplicity for the application user; i.e. it provides an easier way that will translate the user-friendly domain name to a machine understanding IP address which is then used to fetch and forward data. With the explosion in the use of internet and World Wide Web in commercial, security, social markets among many others, it is not possible for a user to remember the logical IP addresses of the sites. This is where DNS steps in and makes it possible such that the user just needs to remember the user-friendly domain name like www.google.com from which the DNS will translate it into an IP address as 8.8.8.8.
Jumping further into the behavior of the protocol, the DNS stores DNS records for a domain name with corresponding IP addresses and it will respond to queries from the user with answers from its database.
DNS Records are nothing but the database files from which the mappings are fetched. Some of the commonly used DNS records are A, CNAME, MX, PTR, NS.
| RECORD TYPE | EXAMPLE NAME | MAPPED DATA | DESCRIPTION |
| NS | radar.com | Ns1.radar.com Ns2.radar.com | This record indicates the host/user about the authoritative servers and also provides with information about the Master and Slave servers of the zone. |
| A | Ns1.radar.com Ns2.radar.com | 192.168.27.8 192.168.27.10 | This is the most basic type of DNS Record which indicates the 32 bit IPv4 address of the domain, i.e. mapping the FQDN to an IP address. |
| CNAME | radar.com | a.radar.com | This record maps to the canonical name (CNAME) details for the alias that is mentioned in the FQDN. |
| AAAA | 192.168.27.8 192.168.27.10 | www.radar.com | EThis record is used for the mapping of mail exchange server information to a specific domain name. |
| PTR | 192.168.27.8 | ns1.radar.com | This is an interesting record type where the user actually has the IP address of the domain from which he can map it to a CNAME, these mappings are stored in this record type. |

#### Webserver & Firewall

A webserver should run on the Linux OS to host a website. Apache2 is the used webserver.A firewall is used to provide a layer of security to control the incoming and outgoing traffic in a network and to block and filter packets to go into the system. The firewall can for a system or even a specific server with bunches of databases or confidential data which is being shielded from unapproved clients in/outside the system.

### STEPS AND COMMANDS
#### Dynamic Host configuration Protocol (DHCP) Server

Step 1. Install DHCP Server Command:
Step 2. Install radvd package Command:
Step 3. Set the static IP address of the DHCP server Command:
IPv4 Configuration
IPv6 Configuration
Step 4. Configure the IPv6 and IPv4 forwarding Command:
Step 5. Make ens33 as the default interface Command:
Step 6. Configure the DHCP server for ipv4 Command:
Step 7. Edit the resolv.conf file Command:
Step 8. Configure the DHCP server for ipv6 Command:
Step 9. Configuration of the radvd module Command:
Step 10. Reboot the System Command:
Step 11. Restart the DHCP server Command:

#### Domain Name System (DNS) Server
##### DNS Master Server

Step 1: Install Bind9 Command:
Step 2: Restart the networking daemon Command:
Step 3: Add a DNS zone to BIND9 Command:
Step 4: use an existing zone file as a template to create the /etc/bind/db.radar.com file Command:
Now restart the BIND9: Command:
Step 5: Setup reverse zone Command:
Command:
Zone for ipv6
Step 7 : Create Network Interface
Command:

##### DNS Slave Server
#### Web Server

Download and update package list Command:
Install apache2 for Webserver Command:
Make directories Command:
Assign owners and permission Command:
Creates webpage. index.html is an HTML document that contains code for the company webpage Command:
Make HTML page Command:
Create and copy virtual host file Command:
Edit virtual host file radar.com.conf Command:
Setup local host file

#### Firewall

Step 1
Command:
Step 2: Check UFW status Command:
Step 3: Set Up Default Policies
Command:
Step 4: Allow SSH,http,ftp,https Connections
Command:
Step 5: Disabling ping
Command:
//Comment out this line:
Step 6: Enable UFW
Command:

#### Backup Server

Step 1: Install open-ssh on the linux server Command:
Step 2: Install expect package Command:
Step 3: Create a new file and type the following script to create the backup script file. Command:
The script zips the file that needs to be backed up and sends the file from the source directory to the destination directory and from the destination directory it gets transferred to the remote backup server. The same procedure is repeated for all webservers.
Step 4 : Crontab is used for scheduling the backup using a cronjob which includes the bash script to dump the file for every 5 mins.
You can edit the frequency of the backup using crontab. The following screenshot shows the backup scheduling of the webserver.

### ALGORITHM

1. Create a DHCP server and give IP Address range 192.168.27.50 – 192.168.27.200
2. Create a client, it fetches its IP Address from the DHCP in the range specified
3. Create a webserver and host a HTML page for “radar.com”
4. The client can access the webpage hosted and can ping it
5. The DNS server is created to resolve domain IP Address
6. Backup server is created for backing up and securing the cache created at a scheduled time by the webserver
7. To increase the security, IPSec tunnel is implemented which helps to ping two servers in a private network, on a public network using encryption
8. NFS is created to share files between two hosts

### ADD-ONS
#### Address Resolution Protocol (ARP)

ARP poisoning has been implemented using Scapy. Here an attacker tries to intrude in the client's network. When the client requests the webserver page initially, he'll be able to view the webpage requested, but when the attacker uses the Scapy script he floods the ARP cache of the victim(client) with its own MAC address. Now when the client tries to request the webpage of the webserver instead of the original webpage, the hacked webpage hosted by the attacker is visible.

#### Network File System (NFS)

Step 1:Configuring the NFS-server Command:
Edit the file
On the last line append below
Save and Exit Change the directory
Create a sample fie named "new1"
Start the server
Step 2:Configuring the NFS-client To Install NFS client: Command
Make directory in a location
To verify whether it is mounted

#### IPSec VPN tunnel

Server 1
Server 2

### TESTING

1. DHCP Dynamic IP Assigning to client
2. Client pinging to DNS Master
3. Client pinging to DNS Master
4. Client pinging the webserver
5. Checking if the webserver hosts the website
6. NFS testing
7. nslookup to check DNS capability
* The detailed screenshots are provided in the report