Difference between revisions of "Lab 8 Warnings / Debrief"

From CDOT Wiki
Jump to: navigation, search
 
(31 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
[[Image:wifi.png|thumb|right|125px|'''Hot-spots''' offer the ability for users to connect to the Internet via their mobile devices. '''Hybrid solutions''' combine DHCP and fixed IP Address.  ]]
 
[[Image:wifi.png|thumb|right|125px|'''Hot-spots''' offer the ability for users to connect to the Internet via their mobile devices. '''Hybrid solutions''' combine DHCP and fixed IP Address.  ]]
 
|}
 
|}
There are various ways in which computers can be networked together. Some computer networks (such as computer labs) configure their workstations for '''static IP addresses for security and to provide other interesting features such as WOL''' (Wake Up on Lan) which allows a signal from a computer system to remotely start all or specified workstations within the lab. '''Hot-spots (such as cafes or airport lounges) offer the ability for users to connect to the Internet (via DHCP) from their mobile devices''' (notebooks, netbooks, tablets, or smart phones). Finally, there are '''hybrid solutions that may offer both fixed IP address (computer workstations) and allow for wireless connections (via DHCP) to a mobile devices''' (like at your Seneca computer labs).
+
There are various ways in which computers can be networked together. Some computer networks (such as computer labs) configure their workstations for '''static IP addresses for security and to provide other interesting features such as WOL''' (Wake Up on Lan) which allows a signal from a computer system to remotely start all or specified workstations within the lab. '''Hot-spots (such as cafes or airport lounges) offer the ability for users to connect to the Internet (via DHCP) from their mobile devices''' (notebooks, netbooks, tablets, or smart phones). Finally, there are '''hybrid solutions that may offer both fixed IP address (computer workstations) and allow for wireless connections (via DHCP) to a mobile devices''' (like at your Seneca computer labs). Lab 6 involved setting up fixed IP address (eg. for workstations) whereas Lab 8 will deal with IP addresses assigned (via DHCP) when discovered (for example: mobile devices).
  
  
 +
<u>'''What is DHCP?'''</u>
  
 +
The term '''DHCP''' stands for '''Dynamic Host Configuration Protocol'''. DHCP allows computers (eg. workstations, notebooks, smart-phones) to be automatically configured so that they can communicate over a network. This automatic configuration has gained popularity over the years, especially as the need for detecting and configuring portable computer devices increases. DHCP configuration allows for various setups including: '''Dynamic''', '''Automatic''', and '''Static''' allocation.
 +
<br><br>
 +
The term '''DORA''' best describes how DHCP Works:
 +
<br><br>
 +
{|cellpadding="2" width="60%" border="1" cellspacing="0"
 +
 +
|- valign="top"
 +
|width="8%" | <u>'''D'''</u>iscovery:
 +
|width="90%" |The client broadcasts a '''message''' (IP lease request) on a sub-network to '''discover''' available DHCP servers
 +
|- valign="top"
 +
|width="8%" | <u>'''O'''</u>ffer:
 +
|width="90%" |The DHCP server receives the request from the client, '''reserves an IP ADDRESS''' for the client and sends a '''DHCPOFFER'''
 +
|- valign="top"
 +
|width="8%" | <u>'''R'''</u>equest:
 +
|width="9%" |The DHCP server broadcasts a message '''request for acceptance''', but also notifies other DHCP server
 +
|- valign="top"
 +
|width="8%" | <u>'''A'''</u>cknowledgement:
 +
|width="90%" |The client sends a '''message of acceptance to the server'''. In turn, the client receives from the server a '''packet of information''' containing the lease duration and other configuration information
 +
|}
 +
 +
 +
 +
== Setting-up / Running a DHCP Sever (dhcpd) ==
 +
[[Image:dhcp-config.png|thumb|right|500px|The '''dhcpd.config''' file allows the Linux system administrator to customize the DCHP server. Generally in this file are '''global settings''' (options that apply throughout entire network) and '''subnet declarations''' (options that apply only to that subnet). Whenever changes are made to this file, the '''DCHP service needs to be restarted''' to allow new settings to take effect.<br><br>'''NOTE: Any errors in this file (such as typos or missing semi-colons) can cause the DHCP server not to restart!''' ]]
 +
<u>'''Obtaining dhcp Package'''</u>
 +
 +
 +
In order to setup a '''dhcp''' server, you may be required to install the package on your server. The program called dhcpd is a daemon which runs the dchp server in the background waiting to accept requests from potential clients (eg. mobile computers, etc). In our case, we will install and configure ''dhcpd'' on our '''centos3''' VM.
 +
 +
<u>Useful commands</u>
 +
 +
:*<b><code><span style="color:#3366CC;font-size:1.2em;">rpm -q dhcp</span></code></b>  (checks to see if dhcp package is setup on server. If not installed, can issue command: <b><code><span style="color:#3366CC;font-size:1.2em;">yum install dhcp</span></code></b>)
 +
:*<b><code><span style="color:#3366CC;font-size:1.2em;">dhclient</span></code></b>  (usefull command to initiate a new dhcp connection to dhcp server)
 +
 +
 +
Once dhcp package has been installed on your system, you will need to create the '''dhcpd.conf''' file to setup the configuration of your dhcp server.
 +
Sometimes it is easier to copy a <u>sample</u> dhcp.conf file to destination: '''/etc/dhcp/dhcpd.conf''',and then edit the configurations to meet your own specifications.
 +
 +
<u>Useful commands</u>
 +
:*<b><code><span style="color:#3366CC;font-size:1.2em;">rpm -qla dhcp</span></code></b> (obtain a listing of files to search for sample dhcpd.conf file to copy to: '''/etc/dhcp/dhcpd.conf''')
 +
 +
 +
<u>'''Layout of the dhcpd.conf file'''</u>
 +
 +
 +
The dhcpd.conf file consists of at least a couple of major sections:
 +
:*'''Parameters''' (network options, actions to take, etc)
 +
:*'''Declarations''' (actions and options only applied within a particular <u>subnet</u>)
 +
 +
Here is a link to a good explanation of how dhcpd.conf works: [ '''[https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-dhcp-configuring-server.html Configuring a DHCP Server]''' ]
 +
 +
 +
<u>'''Running the DHCP Server'''</u>
 +
 +
 +
After configuring the DHCP server, you need to either start the service (first time) or restart the service in order for your configuration changes to take effect.
 +
 +
<u>Useful commands</u>
 +
 +
:*<b><code><span style="color:#3366CC;font-size:1.2em;">service dhcpd start</span></code></b>  (start dhcpd service for the first time)
 +
:*<b><code><span style="color:#3366CC;font-size:1.2em;">service dhcpd restart</span></code></b>  (restart dhcpd service for changes to take effect)
 +
:*<b><code><span style="color:#3366CC;font-size:1.2em;">chkconfig dhcpd on</span></code></b>  (enable dhcpd service on server boot-up)
 +
:*<b><code><span style="color:#3366CC;font-size:1.2em;">tail -f /var/log/messages</span></code></b>  (utility to confirm dhcp connections as they appear in real-time)
 +
 +
 +
Note: If there are any errors in the dhcpd.conf file, then that service will not start correctly.
 +
 +
<u>Common Errors in dhcpd.conf file</u>
 +
 +
:*Syntax Errors
 +
:*Failure to end statements with semi-colon character (;)
 +
:*Forgetting to include braces ( { } ) in subnet declarations
 +
 +
 +
<u>'''Common Files When Auditing DHCP Connections'''</u>
 +
 +
There are files that are created as a result of a DHCP connection. These files are useful to verify that a connection via DCHP was created, and provides details regarding this connection (eg. confirming dhcpd.conf modifications).
 +
 +
On the DCHP <u>Server</u>:
 +
 +
*'''tail -f /var/log/messages'''  DHCP server log file showing a lease occurring (eg. '''dora''')
 +
*'''/var/lib/dhcpd/dhcpd.leases'''    DHCP server lease file
 +
 +
On the <u>Client Server</u> that connected via DCHP:
 +
 +
*'''/var/lib/dhclient'''  directory where the <u>dhclient</u> stores its record of leases
  
  
Line 20: Line 107:
  
  
 +
<u>Common Errors in dhcpd.conf file:</u>
 +
:*Syntax Errors
 +
 +
:*Failure to end statements with semi-colon character (;)
 +
 +
:*Forgetting to include braces ( { } ) in subnet declarations
  
 
== Preparing for Lab Sign-Off ==
 
== Preparing for Lab Sign-Off ==
Line 36: Line 129:
 
== Lab 8 Debrief ==
 
== Lab 8 Debrief ==
  
 +
<u>'''Preparing for Quizzes'''</u>
  
 +
# What protocol and port does dhcp use?
 +
# What file is used to configure dhcpd?
 +
# Can a dhcp server also be a dhcp client?
 +
# What is the difference between max-lease-time and default-lease-time?
 +
# What unit of measurement does default-lease-time require?
 +
# What dhcp option is used for configuring a default gateway?
 +
# What is the parameter range in the DHCP server configuration file used for?
 +
# What is the purpose of a dhcp relay agent?
 +
# Why might a dhcp relay agent be required?
  
 
[[Category:OPS235]]
 
[[Category:OPS235]]
 
[[Category:OPS235 Labs]]
 
[[Category:OPS235 Labs]]

Latest revision as of 09:56, 8 August 2015

Preparing for Lab 8

Background

Some computer networks (such as computer labs) configure their workstations for static IP addresses for security and to provide other interesting features such as WOL.
Hot-spots offer the ability for users to connect to the Internet via their mobile devices. Hybrid solutions combine DHCP and fixed IP Address.

There are various ways in which computers can be networked together. Some computer networks (such as computer labs) configure their workstations for static IP addresses for security and to provide other interesting features such as WOL (Wake Up on Lan) which allows a signal from a computer system to remotely start all or specified workstations within the lab. Hot-spots (such as cafes or airport lounges) offer the ability for users to connect to the Internet (via DHCP) from their mobile devices (notebooks, netbooks, tablets, or smart phones). Finally, there are hybrid solutions that may offer both fixed IP address (computer workstations) and allow for wireless connections (via DHCP) to a mobile devices (like at your Seneca computer labs). Lab 6 involved setting up fixed IP address (eg. for workstations) whereas Lab 8 will deal with IP addresses assigned (via DHCP) when discovered (for example: mobile devices).


What is DHCP?

The term DHCP stands for Dynamic Host Configuration Protocol. DHCP allows computers (eg. workstations, notebooks, smart-phones) to be automatically configured so that they can communicate over a network. This automatic configuration has gained popularity over the years, especially as the need for detecting and configuring portable computer devices increases. DHCP configuration allows for various setups including: Dynamic, Automatic, and Static allocation.

The term DORA best describes how DHCP Works:

Discovery: The client broadcasts a message (IP lease request) on a sub-network to discover available DHCP servers
Offer: The DHCP server receives the request from the client, reserves an IP ADDRESS for the client and sends a DHCPOFFER
Request: The DHCP server broadcasts a message request for acceptance, but also notifies other DHCP server
Acknowledgement: The client sends a message of acceptance to the server. In turn, the client receives from the server a packet of information containing the lease duration and other configuration information


Setting-up / Running a DHCP Sever (dhcpd)

The dhcpd.config file allows the Linux system administrator to customize the DCHP server. Generally in this file are global settings (options that apply throughout entire network) and subnet declarations (options that apply only to that subnet). Whenever changes are made to this file, the DCHP service needs to be restarted to allow new settings to take effect.

NOTE: Any errors in this file (such as typos or missing semi-colons) can cause the DHCP server not to restart!

Obtaining dhcp Package


In order to setup a dhcp server, you may be required to install the package on your server. The program called dhcpd is a daemon which runs the dchp server in the background waiting to accept requests from potential clients (eg. mobile computers, etc). In our case, we will install and configure dhcpd on our centos3 VM.

Useful commands

  • rpm -q dhcp (checks to see if dhcp package is setup on server. If not installed, can issue command: yum install dhcp)
  • dhclient (usefull command to initiate a new dhcp connection to dhcp server)


Once dhcp package has been installed on your system, you will need to create the dhcpd.conf file to setup the configuration of your dhcp server. Sometimes it is easier to copy a sample dhcp.conf file to destination: /etc/dhcp/dhcpd.conf,and then edit the configurations to meet your own specifications.

Useful commands

  • rpm -qla dhcp (obtain a listing of files to search for sample dhcpd.conf file to copy to: /etc/dhcp/dhcpd.conf)


Layout of the dhcpd.conf file


The dhcpd.conf file consists of at least a couple of major sections:

  • Parameters (network options, actions to take, etc)
  • Declarations (actions and options only applied within a particular subnet)

Here is a link to a good explanation of how dhcpd.conf works: [ Configuring a DHCP Server ]


Running the DHCP Server


After configuring the DHCP server, you need to either start the service (first time) or restart the service in order for your configuration changes to take effect.

Useful commands

  • service dhcpd start (start dhcpd service for the first time)
  • service dhcpd restart (restart dhcpd service for changes to take effect)
  • chkconfig dhcpd on (enable dhcpd service on server boot-up)
  • tail -f /var/log/messages (utility to confirm dhcp connections as they appear in real-time)


Note: If there are any errors in the dhcpd.conf file, then that service will not start correctly.

Common Errors in dhcpd.conf file

  • Syntax Errors
  • Failure to end statements with semi-colon character (;)
  • Forgetting to include braces ( { } ) in subnet declarations


Common Files When Auditing DHCP Connections

There are files that are created as a result of a DHCP connection. These files are useful to verify that a connection via DCHP was created, and provides details regarding this connection (eg. confirming dhcpd.conf modifications).

On the DCHP Server:

  • tail -f /var/log/messages DHCP server log file showing a lease occurring (eg. dora)
  • /var/lib/dhcpd/dhcpd.leases DHCP server lease file

On the Client Server that connected via DCHP:

  • /var/lib/dhclient directory where the dhclient stores its record of leases


Common Mistakes / Warnings

Important.png
Be Aware of the Following Issues
Be aware of these common mistakes that students make that can cause problems for their future labs.


Common Errors in dhcpd.conf file:

  • Syntax Errors
  • Failure to end statements with semi-colon character (;)
  • Forgetting to include braces ( { } ) in subnet declarations

Preparing for Lab Sign-Off

Students should be prepared with all required commands (system information) displayed in a terminal (or multiple terminals) prior to calling the instructor for signoff.


In order to properly complete your lab and move to the next lab, you must have your instructor "sign-off" on your lab

  • Each "signed-off" lab (before due date) is worth 1% of your final grade.
  • Signing-off on labs help to spot errors that can cause problems with future labs.
  • Do you ask the instructor what to check for! Read at the bottom of the lab the requirements, and have all proof available for instructor to view at same time.
  • Failing to be prepared and asking instructor what to check when assignment is mark will result in deduct of marks!
  • For example, open multiple terminals with command results. If properly set-up ahead of sign-off, the process should only take instructor approx 20 seconds to sign-off your lab.
  • If you do not have your lab-logbook, you MUST show your work and your lab log-book to your instructor for sign-off in the next class. This may cause a late penalty if past the required due date.


Lab 8 Debrief

Preparing for Quizzes

  1. What protocol and port does dhcp use?
  2. What file is used to configure dhcpd?
  3. Can a dhcp server also be a dhcp client?
  4. What is the difference between max-lease-time and default-lease-time?
  5. What unit of measurement does default-lease-time require?
  6. What dhcp option is used for configuring a default gateway?
  7. What is the parameter range in the DHCP server configuration file used for?
  8. What is the purpose of a dhcp relay agent?
  9. Why might a dhcp relay agent be required?