13,420
edits
Changes
no edit summary
'''NOTE:''' Lab 7 requires that you understand these concepts and have a good general understanding how to use these troubleshooting utilities (like '''netstat''' and '''iptables''').
=== Part 1: Using /etc/host File for Local Hostname Resolution ===
{| width="40%" align="right" cellpadding="10"
|- valign="top"
|{{Admon/note | Hosts files vs. the Domain Name System | On large public networks like the Internet or even large private networks we use a network service called [http://en.wikipedia.org/wiki/Domain_Name_System Domain Name System (DNS)] to resolve the human friendly hostnames like '''centos.org''' to the numeric addresses used by the IP protocol. On smaller networks we can use the <code>/etc/hosts</code> on each system to resolve names to addresses.}}
|}
After setting up a private network, it can be hard to try to remember IP addresses. In this section, we will setup your network to associate easy-to-remember server names with IP ADDRESSES. '''Perform the following steps:''' # Complete this investigation on '''all of your VMs''' and the '''c7host''' machine.# Use the <b><code><span style="color:#3366CC;font-size:1.2em;">hostname</span></code></b> and <b><code><span style="color:#3366CC;font-size:1.2em;">ifconfig</span></code></b> commands on your c7host machine and all of your 3 VM's to gather the information needed to configure the '''/etc/hosts''' file on all of your Linux systems.# Edit the '''/etc/hosts''' file on <u>each</u> of the '''virtual machines and host machine'''. Add the following contents to the <u>bottom</u> of the '''/etc/hosts''' file:<br><br>#::192.168.235.1 c7host#::192.168.235.11 centos1#::192.168.235.12 centos2#::192.168.235.13 centos3<br><br>#Confirm that each host can ping all three of the other hosts by name. ===Part 12: Using a Shell script (using Arrays) to Collect VM Network Information===
{|width="40%" align="right" cellpadding="10"
|- valign="top"
#Perform this section in your '''c7host''' machine.
#Open a shell terminal and login as '''root'''.
#Change to the '''/root/bin ''' directory.#Using a text editor, create a Bash shell script called '''network-info.bash ''' and enter the following content below:<br><br>x<br><br>#Give this shell script execute permission for the owner.#Run the shell script.#View the contents of the output file to confirm that the shell script worked correctly.
<code style=== Part 2"color:#3366CC;font-family:courier;font-size:.9em;margin-left:20px;font-weight: Using bold;"><br>#!/bin/etcbash<br><br># Author: *** INSERT YOUR NAME ***<br># Date: *** CURRENT DATE ***<br>#<br># Purpose: Creates system info report<br>#<br># USAGE: ./host File for Local Hostname Resolution ===myreport.bash<br><br>{| widthif [ $USER !="40%root" align=] # only runs if logged in as root<br>then<br> echo "right" cellpadding="10You must be logged in as root.">&2<br>|- valign="top" exit 1<br>|{{Admon/note | Hosts files vs. the Domain Name System | On large public networks like the Internet or even large private networks we use a network service called [http://en.wikipedia.org/wiki/Domain_Name_System Domain Name System (DNS)] to resolve the human friendly hostnames like '''centos.org''' to the numeric addresses used by the IP protocol. On smaller networks we can use the fi<codebr>/etc/hosts</code> on each system to resolve names to addresses.}}|}<br>