Tuesday, July 23, 2013

Linux Router and Protocol Analysis

This exercises focuses on establishing a connection on a remote computer using another computer to act as a router. To be able to perform this we need to follow the steps below.

A. Linux Router Configuration


Topology

We need to accomplish this topology but with minor variations. We will not use Cross cable in connecting Computer A and Computer B. Instead we will be using Wifi Connection to establish a network connection between A and B then use a cable directly connected to the internet.

In this exercise we used Ubuntu 12.04 to act as a server and a client. Then follow the steps below.

Step 1: We need to have a root access in order to modify the settings. Type sudo -s then enter your password.
Root Access

Step 2: Get the information on which devices your computer use that will be configured. In our case it is wlan0 and eth0. We will not be using eth1 since eth1 is used on a wired connection. On computer B eth0 is used in the wire directly connected to the internet while wlan0 is the connection between computer A and B.

Acquiring Device Information

Step 3 (Configuring the Router):

In this step we configured Computer B to act as a router for Computer A. We changed the IP address of wlan0 (the interface connected to Computer A) to 192.168.1.254 with a netmask of 255.255.255.0 . Then we checked if is Disabled. If disabled we set it to 1 to enable it. After checking the IP forwarding setting we now configure the Firewall settings using IPTABLES. The parameters used will be discussed later.

Configuring Computer B

Step 4 (Configuring the Client):

After configuring the router we now configure the client. First we assign the IP 192.168.1.1 to wlan0 (this is the interface of computer A connected to computer B). Afterwards we set the IP Address of Computer B as a default gateway using route.


Configuring the Client ( Computer A )
Now that we have configured computer A. We will try to ping the address 10.0.4.254 and 10.0.4.0.
Notice that this will result to a unreachable state because we have now changed the IP of Computer B to 192.168.1.254. Also the /etc/resolv.conf of computer A is empty. We need to copy the resolv.conf of computer B to A in order to have internet access. Resolv.conf contains a setting with nameserver and search. I think this is the default setup used by the network to connect to the internet.

Copying result.conf


Pinging Computer B
Since we have succesfully pinged our router Computer B. We are now sure that we can connect to the internet since computer B that is acting as a router has an internet access (As of this moment I'm currently using the connection from A to B to write this blog).


B. DHCP Server Configuration

In the previous activity we have successfully established a connection in Computer A manually. Now we will try the same but only using DHCP. This means that we will make a that will enable our router Computer B to assign IP addresses automatically to other computers that is connected to its network. We need to edit /etc/dhcp/dhcpd.conf in oreder to achieve this.

dhcpd.conf
The parameters used in dhcpd.conf will be discussed later. 

After we have configured dhcpd.conf we will now try to acquire IP of Computer A automatically by using dhclient wlan0 (since wlan0 is the one used by comptuer A to connect to computer B). Next we will check the information that Computer B gave to Computer A using cat /var/lib/dhcp/dhcpd.leases.

dhclient wlan0
Lease information
We have successfully assigned an automatic IP on computer A using dhclient 

QUESTIONS:


1. Using the man pages for iptables, briefly explain what was done in step 5 in configuring
Computer B. Describe the parameters used in the iptables command. (5 points)

Iptables -F = flush all the chains in the table if none is given, equivalent to deleting all the rules one by one

iptables -P  = set the policy for the chain to the given target.

Iptables -t = specifies the packet matching table which the command should operate on.

nat = table consulted when a packet that creates a new connection is encountered. 

2. What are the options you used in /etc/dhcpd.conf? (5 points)

We used router, broadcast-address, subnet-mask, domain-name-servers as options. We also added range (this is used if there are many computers connecting to the router), max-lease time and default lease time. Lease time is used in defining how long the computer can keep the connection established.

3. How do you assign a fixed IP address to a computer?What information do you need? (3 points)

ifconfig - we need the device to be used, the netmask and an optional broadcast.



No comments:

Post a Comment