# Data Networking/Fall 2014/Olaoluwa Oloniniyi
## Group Members

* Devandra Sharma
* Elyes Ighilaza
* Olaoluwa Oloniniyi
* Chris Lazar

## Introduction

The aim of this Linux project was to demonstrate the interoperability of certain network components on a small scale by creating a complete network solution for a start up company. It was required to create a private network with its own DNS and DHCP. The network was implemented using a switch and Ubuntu operating system on 3 computers.
The network components being combined are
* DNS : Domain Name Server
* DHCP: Dynamic Host Configuration Protocol
* Web server & firewall
* Client
The general operation of the network is such that
* The client who does not have an IP address gets its IP address from the DHCP server. This IP address must be within a specified range and adhere to specified conditions.
* The client would try to access the web page by the hostname, this request goes to the DNS which resolves this hostname and directs the client's web browser to the appropriate webserver.
* The firewall serves to monitor incoming and outing traffic on the network.

## DNS

Domain Name System (DNS) is a hierarchical distributed system for naming services, systems that are connected either via the internet or a private network. The most common service or well-known service is its resolution of hostname to IP address. As human’s it would be very difficult for us to keep track of IP addresses that enable us to get to our favourite websites, this is where the DNS comes into play. The DNS resolves the hostname i.e www.google.com, www.yahoo.com to the appropriate IP addresses hence saving us the stress of having to memorize tons of numbers. The DNS service is hierarchical for many reasons such but the most important is to prevent a single point of failure in the naming system. DNS follows a hierarchical model with 4 layers starting from
* Global root servers (13 in total)
* Top level domain servers (.net, .edu, .com, .org )
* Authoritative DNS servers providing authoritative hostname to IP mappings for organisations servers (e.g. web, mail)
* Local Name server, strictly speaking does not belong to the hierarchy. Each ISP has one, when a host makes a DNS query, the query is sent to its local DNS server

### Configuration steps

1. Sudo apt-get install bind9
Downloading the bind package
2. Sudo nano /etc/hosts
Provide domain name for server
3. Sudo nano /etc/bind/named.conf.local
Creating the forward and reverse lookup zones
4. Sudo mkdir zones
Making a directory “zones” in bind directory
5. Sudo cp /etc/bind/db.local /etc/bind/zones/sharma.com.db
Copying the forward lookup files in the zones directory and edit them to contain forward records
6. Sudo cp /etc/bind/db.127 /etc/bind/zones/1.168.192.in- addr.arpa.db
copying the lookup files in the zones directory
7. Sudo nano /etc/bind/zones/sharma.com.db
Edit the forward lookup zone file
8. Sudo nano /etc/bind/zones/1.168.192.in-addr.arpa.db
Edit the reverse lookup zones file
9. Sudo nano /etc/resolv.conf
Edit the resolv.conf file to provide server details

## DHCP

Dynamic Host Configuration Protocol is used to dynamically assign network configuration parameters such as IP addresses, gateway, network mask, etc. It prevents the need to statically assign IP addresses to every host in a particular network, rather the host undergoes the process described below upon discovering that it does not have an IP address.
* Host broadcasts “DHCP discover” message (optional)
* DHCP server responds with “DHCP offer” message [optional]
* Host requests IP address: “DHCP request” message
* DHCP server sends address: “DHCP ACK” message
After initially getting the IP address the host only repeats the last two steps to renew its lease on the IP address it already has

### configuration steps

1. Install DHCP Server
2. Create IP pool
3. Assign static IP address to the DHCP
4. Restart the dhcp server

## Web server

In simple terms a web server is the system that hosts a web page. It renders the service of providing the webpage upon a request from a client. It processes these requests via HTTP, which is the basic network protocol used to distribute information on the world wide web. In the case of this project the client the following steps take place
* The client communicates with the DNS which resolves the hostname elyes.sherma.com to the IP address 192.168.1.108
* Using the HTTP protocol, the browser sent a GET request to the webserver asking for the web page elyes.sherma.com
* The webserver then responds with the HTML text for the webpage to the browser

### Configuration steps

1. downloaded apache using the command sudo apt-get install apache2
2. We crosschecked that the webpage had downloaded properly by typing localhost into our web browser
3. the webpage was created in the folder /var/www/html
4. We created a file index.html and wrote the following html code shown above
5. The IP address of the webserver and the DHCP are static since they are located on the same machine

## Fire Wall

With the increase in threats to network security, there is the need to have several lines of defence against unwanted access to network resources. In this project case, the network resource is the webpage and the line of defence implemented is a firewall. The firewall serves to control incoming and outgoing network traffic by using several parameters to check if traffic is meant to be allowed or blocked by the wall.
To implement the fire wall iptables were used. IP tables is used in linux to allow a system discern between allowed and banned traffic unto a network via chains and rules it stores. IP tables has several chains such as pre-routing, input, forward, output and post-routing. Each of these chains controls the flow of traffic from different incoming and outgoing directions on the network.

### Configuration steps

Configuration used

## Back up

There is always a need to provide a contingency plan with regards to networks hence the need for a backup. Configuring a backup involves two phases, firstly the transfer of the actual files is carried out via ‘rsync’ then this file transfer is scheduled to be carried out intermittently via the cron job.
Configuration process
* Install rsync if not already available- apt –get install rsync
* create target directory
* use the command rsync –v –e ssh /root/(source folder)/* root@(destination folder)
* The crontab was edited and a new cron job created for the rysnc
* 1 2 3 4 5 /path/to/command arg1 arg2 (1=minute, 2=hours, 3day, 4=month, 5=day of the week)
It can be seen that the crontab is a very flexible command which allows for commands to be carried out various times which can easily be specified. It also has several short cuts which can be put before the cronjob such @daily/path/to/command arg1 , @hourly/path/to/command arg1 to specify that the cronjob occur daily and hourly respectively.
Additionally crontab can be instructed to send a mail to specified destination upon successfully carrying out the command using MAILTO = “example@example.com”

## Add-ons

The following add-ons were carried out to make the project more robust
* NFS
* NIS
* VPN

### NFS

Network File System (NFS) is a distributed file system protocol that allows a user on a client computer to access files over a network much like local storage is accessed. The process follows the following steps
* The server implements NFS processes, which makes its data available to clients over the LAN.
* The server determines what to make available.
* The server security-administration ensures that it can recognize and approve validated clients.
* The server network configuration ensures that appropriate clients can negotiate with it through any firewall system.
* The client machine requests access to exported data which the server grants to the allowed client.

#### configuration steps
### NIS

NIS is a client–server directory service protocol for distributing system configuration data such as user and host names between computers. Its purpose is to provide information that is to be known throughout the network. Information likely to be distributed by NIS include login names/passwords, group information, hostnames etc.

#### Configuration steps

1. On the server side
2. Add the users
3. Assign passwords to the users
4. On the client
Permission to read, write and execute files

### VPN

VPN is used to extend a private network across a public network. It enables the sender benefit from the security of being on a private network while still communicating over a public network.

#### Configuration steps
## Testing

The network components were all connected via a switch. The following checks were carried out to ensure that the basic configurations of the network were working properly