# Data Networking/Fall 2015/ADSU
## Team Members

Anuj Tyagi
Deepanshu Lulla
Swarnashruti Jupudi
Umakant Kulkarni

## Project Objective

The goal of the Linux project is to build a DNS implementation for a start-up company. We had to design a DNS server for a startup company, a DHCP server, a domain that hosts a webserver, and a firewall to make the network more secured and efficient. We are using the following IP addresses:
Components IPV4 ADDRESS
DNS SERVER-192.168.43.72
DHCP SERVER-192.168.43.254
WEB SERVER-192.168.43.238
MAIL SERVER-192.168.43.238
BACKUP SERVER-192.168.43.159
NFS SERVER-192.168.43.72
CLIENT-It will get the IP from the DHCP Pool

## Domain Name System (DNS)
### Behavior of protocol

DNS translates hostnames/Domain names to IP addresses. It is an application level protocol that stores the DNS records for domain name, address records, name server records, and mail exchanger records. This protocol consists of distributed database which is implemented in a hierarchy of DNS servers. Hosts can request the distributed database using DNS protocol. The DNS protocol can use either TCP or UDP using port number 53. The DNS protocol consists of a UDP single request from the client and is served by a single reply from the server.

### Signalling

1. The client will first contact the local DNS server with the DNS query containing the hostname.
2. The local DNS server forwards the query to the root DNS server. The root DNS server sends a reply to the local DNS with a list of the possible TLD servers.
3. The local DNS server sends its query message to one of the TLD servers.
4. The TLD server responds back with the IP address of the authoritative name server to the local DNS server.
5. The local DNS server then sends its query to the authoritative DNS server which responds back with the IP address for the queried hostname.

### Configuration

Step 1: Install bind
Step2: Then edit the file named.conf.options in the /etc/bind/ directory
Step3: Our system must work atleast as a forwarder.
Step4: Next open the file named.conf.local in the /etc/bind/ directory
Step 5: Create a file in /etc/bind/ , copy the local file to it and open it in editor
Step 6: Then open db.adsu.rev in editor.
Step 7: Then open db6.adsu.rev in editor
Step 8: The command below restarts the bind server.
Slave DNS

### Testing

We basically use nslookup command to test DNS. Try nslookup <hostname> from all PCs in the network and it should show the translated IP. Also test reverse lookup. Apart from nslookup we can also use dig, host commands to test DNS.

## Dynamic Host Configuration Protocol (DHCP)
### Behavior of protocol

IP addresses are automatically assigned by the DHCP server to the clients. This helps reduce the load on the network administrator or a user to configure these settings manually on thousands of computers. It is an application layer protocol that operates on a client-server model. It manages a pool of Ip addresses, default gateway, domain name, name server and time servers. When a host leaves, its IP address is resolved to the pool. ISC-DHCP is a software which performs all of DHCP functions such as client, server and relay agent. The protocol was designed as an extension to the Boot Strap Protocol (BOOTP). Bootp did not have a mechanism to allow the re-usage of ip address and involves extensive manual configuration to assign information to each client individually. It facilitates automatic configuration of computers even if a user changes networks. The advantage of DHCP is that if there is any change in the address of DNS server it has to be updated only in the DHCP server. When the client queries, all the hosts will be automatically reconfigured. Another advantage is that new computers can be directly added to the network and the IP address will be automatically allocated.

### Signalling

* When a client enters the network, it broadcasts a DHCPdiscover message to all the DHCP servers.
* The DHCP server on receiving the discover message, unicasts an offer message to the client.
* The client accepts the offer and responds with a request message for the IP address.
* The server responds back with an acknowledgement message.

### Configuration

Step 1: Install the package
For IPV4:
Step 2: Edit /etc/network/interfaces file and set up static IP address to the interface
* gedit /etc/network/interfaces
Step 3: Restart network Interface
step 4: Configure DHCP server and provide the range of ip address for clients and bind the ip corresponding to mac-address of servers to assign same ip to all servers everytime.
For IPV6
Create new file /etc/init.d/isc-dhcp6-server and copy the contents of /etc/init.d/isc-dhcp-server to it. Add -6 everywhere the dhcpd process is called.

### Testing

DHCP is tested successfully by checking if the DHCP server assigns IP address to the connected client in the communication network from a given range of IP addresses as mentioned in the conf file.

## Web Server and firewall
### Behaviour protocol

Web server serves the requests via HTTP, it can be used to host websites,gaming data storage, to handle emails, FTP files etc. It delivers the webpages to clients. The webpages are generally HTML documents that includes images, scripts and text. It can be implemented in kernel this makes it work faster and it can also directly access the hardware resources.

#### Signalling

The client initiates a TCP connection with the web server IP provider. The connection involves a 3 way handshake mechanism. First, the clients sends a SYN message requesting TCP connection to the browser at port 80. The server responds with a SYN-ACK message acknowledging the request and requests the client to open a port for the server to send information. The client responds with the ACK message and also sends a request for the HTML page.

### Configuration

Step 1: Install Apache2 on your server using apt-get
Step 2: Since the webpage that we are going to host has to be accessed by other clients on network, it will be stored in /var www directory in a specified domain (here adsu.com) under public_html folder.
Step 3: Grant the permission for other clients to access those files as these are not specified in rood directories.
Step 4: Create an html page inside the directory. Sudo gedit /var/www/adsu.com/public_html/index.html
Step 5: Now the default virtual host file in apache 2 is 000-default.conf We will copy it over to create a virtual host file for our domain.
Step 6: Open the new file in your editor with root privileges:
Step 7: Enable new host files
Step 6: Restart the apache server sudo service apache2 restart
Firewall:
A firewall is a network security system, either hardware or software based, that controls incoming and outgoing network traffic based on set of rules.

### Configuration

Step 1: Install UFW, or Uncomplicated Firewall (is a front-end to iptables)
Step 2:Enable it
Step 3:Allow ftp on port 20
Step 4:Allow other users to access the webpage on port 80
Step 5:Deny the access for POP3 a
Step 6:Allow particular user to ssh on server
IPTABLES are firewall utility in linux. It comes pre-installed in ubuntu. Firewall can filter the packet on the basis of source ip, destination ip or port.

## Backup
### Behavior of Protocol

Backup is created at every minute and sent to the backup server using ftp.

### Configurations for web server

Step 2: Edit the following file:
Step 3: restart the ftp service:
Step 4: test the service by:
Step 5: To run this shell script using crontab after every minute modify the crontab as:

### Configurations for backup server

Step 1: Create a user
Step 2: Edit the following file:
Step 3: make directory for this user to store the backup path
Step 4: change priority and accessibility

## Algorithm

1. Client attempts to join the network : dknr
       If the client is valid
          Successfully connect to dknr
       Else
          Restart connection or contact network administrator for troubleshooting
2. Client needs to acquire IP address from the DHCP server
       Check if wlan interface is set to static or to automatic (DHCP)
       If static
          Change to automatic (DHCP)
       Else (DHCP discover)
          Contact DHCP server to get the IP address, gateway IP address, DHCP server details, DNS server details.
       If DHCP allocation is successful
          Server replies with an IP address to be allocated
       Else
          DHCP server replies with a request failed response
       Then

## AD-ONS
### Network File System (NFS)

It is a file distribution system protocol. NFS allows a client to share its content with other users on the network. In order to access the file, all clients have to mount the shared directory to make it their own directory. Configuration
Server
Step1: Install NFS server
Step2: Create a directory to share and change its permissions
Step 3: Open the file exports in etc folder of root directory
Type the directory to shared followed by the network to share and finally the permissions(rw standing for read write).
Client
Step 1: Install NFS client
Step2: Create a folder called sharedDrive on client and sharing permissions
Check if there are any files already in that folder.
Step 3: Mount your drive
Now if we create files on any one the client or server it gets updated on the other side.

### NTP

NTP Server: NTP is used to synchronize the date and time of clients with the server.
Step 1: Install NTP server
step 2: Edit the ntp.conf file and enter ntp server ip Step 3: Place the word iburst onto one pool to indicate you want to retrieve from this as soon as possible.
On client side, we need to put ntp server ip.
Step 1: Restart the daemon on NTP server
Testing
On windows client, change the NTP server ip in date and time settings.

### VPN Server

PPTP
PPTPD is the Poptop PPTP daemon, which manages tunneled PPP connections encapsulated in GRE using the PPTP VPN protocol. Contain features such as IP addressing management and TCP wrappers.
Step 1: install package:
Step 2: Now, edit sudo /etc/pptpd.conf
Step 3: add users /etc/ppp/chap-secrets
Step 4: Edit the file sysctl.conf , by using the command:
Test
Connect from using vpn client. Input user, password and VPN server ip.On server after connection, it will create a new ppp0 interface which will be visible in #ifconfig

### Mail server

Step 1: install the postfix package
Step 2: Configure step by step:
Step 3: Configure mailbox format for Maildir
Step 4: Edit /etc/postfix/sasl/smtpd.conf as follow:
step 5: Configure postfix and TLS for both incoming and outgoing mails
Step 6: Restart the postfix service:
Testing 1) telnet localhost 25 2) ehlo localhost 3) Verify the status codes

### Network Information Service (NIS)

This is a client-server protocol which is used to exchange system configuration data between users on a computer network. NIS contains a central directory of user & group information along with other useful data.
Configuration:
Step 1: Install nis portmap sudo apt-get install nis portmap
Step 2: Edit domain as well as server name and refresh the database. sudo nano /etc/default/nis set nisserver=master sudo nano /etc/yp.conf domain Group1Server server ritesh sudo nano /etc/ypserv.securenets “255.255.255.0 192.168.3.*” Sudo /user/lib/yp/ypinit -m
Step 5: For NIS client, type following command sudo apt-get install portmap nis
Step 4: Edit domain & server name sudo nano /etc/passwd
step 5: Make following changes After making above changes update the database in the server. Add a line +: : : sudo nano /etc/shadow Add a line +: : : : : : : sudo nano /etc/yp.conf set the ypserver’s IP address
Testing:
Use commands ‘yptest ypswitch’ and ‘ypcat –x’ to test NIS.