f01. · web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to...

39
CMIT 391 Linux System Administration - Assignment #3 For this assignment please complete as many LabSim exercises as specified in Course Syllabus for Weeks 5 and 6 as you can. I will be able to review your progress although will not be grading on the amount of LabSim exercises you complete. However, completing the exercises will help you understand the course material better and will be needed to answer the questions which you will be graded on. For the graded portion of your assignment, you will write at least 600 words on your analysis completing specific EITHER assigned LabSim Section 9.0 OR Section 11.0 exercises ONLY. Your assigned Section 9.0 exercises are 9.3, 9.5, 9.6, and 9.7 and your assigned Section 11.0 exercises are 11.1 – 11.5. You will write on not only what you learned completing these specific exercises but also must include answering the following at least two Section Introduction questions from either Section 9.0 or Section 11 exercises. Section 9.3 Question and some info. Which script controls the at daemon? Which files control access to the at command? What is the main difference between using at and cron to schedule a job? Which files control access to the cron command? Where is the system wide crontab file located? How can you edit personal crontab files? At Facts The at daemon (atd) schedules tasks to occur at a specific time. at: Is started using a script in the /etc/rc.d/init.d/ or /etc/init.d/ script directory. Uses configuration files to specify standard user accounts that can and cannot use the at command. o /etc/at.allow specifies users who can use the at command. o /etc/at.deny specifies users who cannot use the at command. Can read commands from a file or standard input. Be aware of the follow general steps to use the at utility: 1. Type at time, then press Enter to access the command prompts. 2. Type one command per line. Press Enter after each command. 3. Press Ctrl+D to exit the command prompt.

Upload: hoangdang

Post on 25-Mar-2018

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

For this assignment please complete as many LabSim exercises as specified in Course Syllabus for Weeks 5 and 6 as you can. I will be able to review your progress although will not be grading on the amount of LabSim exercises you complete. However, completing the exercises will help you understand the course material better and will be needed to answer the questions which you will be graded on. For the graded portion of your assignment, you will write at least 600 words on your analysis completing specific EITHER assigned LabSim Section 9.0 OR Section 11.0 exercises ONLY . Your assigned Section 9.0 exercises are 9.3, 9.5, 9.6, and 9.7 and your assigned Section 11.0 exercises are 11.1 – 11.5. You will write on not only what you learned completing these specific exercises but also must include answering the following at least two Section Introduction questions from either Section 9.0 or Section 11 exercises.

Section 9.3 Question and some info.

Which script controls the at daemon? Which files control access to the at command? What is the main difference between using at and cron to schedule a job? Which files control access to the cron command? Where is the system wide crontab file located? How can you edit personal crontab files?

At Facts

The at daemon (atd) schedules tasks to occur at a specific time. at:

Is started using a script in the /etc/rc.d/init.d/ or /etc/init.d/ script directory. Uses configuration files to specify standard user accounts that can and cannot use the at

command. o /etc/at.allow specifies users who can use the at command.o /etc/at.deny specifies users who cannot use the at command.

Can read commands from a file or standard input.

Be aware of the follow general steps to use the at utility:

1. Type at time, then press Enter to access the command prompts.2. Type one command per line. Press Enter after each command.3. Press Ctrl+D to exit the command prompt.

The table below lists the most common commands for managing tasks with the at command.

Use... To... Examplesat time date Schedule the command to run at a

specific time and date. Options and syntax include:

today tomorrow month # MMDDYY MM/DD/YY

at 12:12AM starts the command the next time the clock reads 12:12 AM.at 12:12AM September 1 starts the command at 12:12 AM on September 1.at 12:00AM 01/01/2010 starts the command at 12:00 AM on January 1, 2010.at 12:00AM 01012010 starts the command at 12:00 AM on January 1, 2010.at 12:00AM 01.01.2010 starts the command at 12:00 AM on January 1, 2010.

Page 2: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

DD.MM.YY

at time_of_day

Use time of day keywords to run the command. Options are:

Midnight (12:00 AM) Noon (12:00 PM) Teatime (4:00 PM)

at midnight starts the command the next time the clock reads 12:00 AM.

at now Run the command immediately.

at now + number time_period

Schedule the command to run at the designated time in the future. Use:

minutes hours days months

at now + 6 days starts the command 1 month after the time the command is issued.at now + 1 months starts the command 1 month after the time the command is issued.

at -f filename time

Schedule tasks in a file to run at the designated time (like a shell script, for example).

at -f /home/user/myscript now + 3 hours starts the jobs listed in the myscript file in three hours from the time the command is issued.

at -latq

List the tasks in the at queue for the current user.

When run as root, atq or at -l lists all the jobs in queue.

When run as a user other than root, at lists only the jobs for the user.

atq shows all jobs in the at queue.

at -d jobnumberatrm jobnumber

Remove jobs from the at queue. Use commas to separate multiple jobs.

at -d 2,3 removes jobs 2 ad 3 from the at queue.atrm 4 removes job 4 from the at queue.

Cron Facts

The cron daemon (crond) schedules tasks to run on a regular basis. cron uses the following configuration files:

File Description

/etc/crontab

The /etc/crontab (cron table) file holds entries that direct commands to execute at a specific time. The /etc/crontab file:

Is for custom task schedules that run system wide. Can only be edited by the root user.

Note: The crond runs tasks scheduled in the /etc/crontab file as the root user.

/etc/cron.timeparameter The cron daemon executes the scripts found in each of the following directories at the specified interval for the whole system:

Page 3: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

/etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly

/var/spool/cron/username Each user has a personal crontab file located at /var/spool/cron/username. The cron daemon only checks the file of the current user.

/etc/cron.allowThe /etc/cron.allow file includes users who can edit their personal crontab file. If /etc/cron.allow file exists, only users listed in therein are allowed to edit /var/spool/cron/username.

/etc/cron.denyThe /etc/cron.deny file excludes users from editing their personal crontab file. If /etc/cron.deny file exists, users listed in therein are not allowed to edit /var/spool/cron/username.

Each entry /etc/crontab or /var/spool/cron/username has a specific format. The table below illustrates the schedule format for a typical entry and provides additional examples. Note that an asterisk (*) is equal to any:

Example Minute Hour Day of Month Month Day of

Week Command Description

00 5 * * 6 /bin/tar 00 5 * * 6 /bin/tar

This schedule runs the tar utility on the 6th day (Saturday) of the week, at the 5th hour (5am--5pm would be 17) and zero minutes. (Note that the days of the week are numbered 0 through 7, 0 and 7 being equal to Sunday.)

15 23 25 * * /usr/bin/find 15 23 25 * * /usr/bin/findThis schedule runs the find command at 11:15 pm on the 25th of every month.

00 24 1 1,6 * /bin/rm 00 24 1 1 and 6 * /bin/rm

This schedule runs the rm command at midnight on the first days of January and July.

Use the following commands to manage cron task scheduling:

Use... To... Examplescrontab Manage the /var/spool/cron/username crontab file:

Be aware of the following options:

-e edits the crontab file in vim for the current user.

-l displays the contents of the crontab file. -r removes the crontab file. -u username specifies a user for the -e, -l,

and -r options.

crontab -e edits the crontab of the current user.crontab -eu username edits the crontab file of the specified user.crontab -l  lists the cron jobs for the current user.crontab -lu username lists the cron jobs for the specified user.crontab -r -u username removes the crontab file of the specified user.

Page 4: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

crontab -r removes the crontab file of the current user.crontab /home/user/cronjobs creates a crontab file using the cronjobs file for the current user.

vi /etc/crontab Open and edit the /etc/crontab file in Vim. vi /etc/crontab opens the crontab file in Vim.

crontab file

Load a crontab job from a file. Write the file using crontab syntax.

Note: This overwrites the current crontab.

crontab /home/user/cronjobs creates a crontab file using the cronjobs file for the current user.

whichDisplay the full path for a command. For many distributions, crontab entries require the complete path to commands. For example, to use /bin/rm instead of only rm.

which bash displays the full path for the borne again shell.

Be aware of the following details:

Some distributions use separate files in the /etc/cron.d directory in addition to lines in the /etc/crontab file.

The cron daemon (crond) is started using a script in the /etc/rc.d/init.d/ or /etc/init.d/ script directory.

Section 9.5 Questions and some info.

How can you view the current hardware clock time? What does it mean for 'time to drift'? How do you synchronize time on a Linux network? How does stratum help to provide accurate time? What is the difference between stepping and slewing? What happens when the time provider and the time consumer are more than 17 minutes

off from each other?

Time Zone Facts

A time zone is a geographic region of the world that has the same standard time. Be aware of the following details:

The time zone ensures that daylight hours fall between certain hours, regardless of the area of the world.

In many areas, daylight savings time (DST) moves clocks ahead by one hour from the standard time zone time during "summer" when there are more daylight hours. Not all locations observe daylight savings time. For example, areas along the equator typically do not because the number of daylight hours does not vary significantly throughout the year.

The local time is the time used in your physical location, adjusting for the time zone and daylight savings time (if used).

As you change your physical location, the local time can also change based on the time zone used in that area.

Time zone names used in the United States (Eastern, Central, Mountain, Pacific) are not part of the official time zone standards, but are useful in comparing time between different parts of the country. In the United States, the time zone names can also reflect whether or not daylight time is in effect.

Page 5: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

o Eastern Daylight Time (EDT) identifies the Eastern time zone, observing daylight standard time.

o Mountain Standard Time (MST) identifies the Mountain time zone, not observing daylight standard time.

Linux computers have two clocks. The following table describes them.

Clock Description

Hardware clock

The hardware clock is a clock that is maintained by hardware.

The hardware clock runs independently of any program. The clock does not require the CPU or memory to run.

Soft power from the power supply and the CMOS battery ensures that the clock continues to run even when the computer is turned off.

The hardware clock is sometimes called the real time clock (RTC), BIOS clock, CMOS clock, or time of year (TOY) clock.

The current hardware clock time is stored in the /proc/driver/rtc file.

System time

System time is the clock that runs within the operating system.

A system clock increments in seconds starting from 12:00 AM on Jan 1, 1970. By default, when the computer boots, it sets the system time based on the hardware

clock. After the operating system runs, the system time is the only clock used by

applications and services. Changing the system time does not automatically change the hardware clock,

although you can change the system time and change the hardware clock to match. The system clock is the clock that Linux uses for all its functions and applications.

Clocks on a Linux computer can use local time or UTC time. The following table describes these and explains how to calculate a UTC offset.

Time Description

Coordinated Universal Time (UTC)

Coordinated Universal Time (UTC), formerly known as Greenwich Mean Time (GMT), is a method of identifying a common time between devices regardless of their physical location in the world.

UTC is adjusted periodically to match the rotation of the earth by adding leap seconds. Leap seconds are required because the official duration of a second does not exactly match the earth's rotation (but is very close).

UTC matches time to the rotation of the earth using a single fixed point in Greenwich, England. A line drawn from north pole to south pole that passes through Greenwich is called the prime meridian.

Most computers use UTC (not local time) when recording timestamps. This ensures that a single method of keeping time is used, regardless of the physical location of the computer.

Time expressed using UTC is identified by adding UTC or Z to the time. For example, 09:30 UTC is the same as 09:30Z or 0930Z. UTC is also called Zulu time.

UTC offset The UTC offset identifies the amount of time that local time is ahead of or behind

Page 6: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

Coordinated Universal Time (UTC).

Local time in each time zone is identified by the UTC offset. For example:o Time zones used in the United States are UTC-05 (Eastern), UTC-06

(Central), UTC-07 (Mountain), and UTC-08 (Pacific), with time being behind UTC.

o Time zones used in Europe and Asia are ahead of UTC. For example, time in Germany is UTC+01, and time in Japan is UTC+09.

To convert UTC to local time, add time based on the UTC offset (UTC + offset). For example, if UTC is 06:00:

o Local time in New York (UTC-05) would be 01:00 (06:00 + - 5:00 = 1 am).

o Local time in Los Angeles (UTC-08) would be 22:00 the previous day (10 pm).

o Local time in Japan (UTC+09) would be 15:00 (3 pm). To convert local time to UTC, subtract time based on the UTC offset (UTC -

offset). For example:o If the local time in New York (UTC-05) is 14:00, UTC is 19:00 (14:00 - -

5:00 = 14:00 + 5:00).o If the local time in Japan (UTC+09) is 14:00, UTC is 5:00 (14:00 - +

9:00). UTC does not change for daylight savings time; however, the offset used by a

time zone will change. During daylight savings time, add one hour to the UTC offset. For example:

o Standard time in New York is UTC-05; daylight time in New York is UTC-04.

o Standard time in Germany is UTC+01; daylight time in Germany is UTC+02.

Local time

Local time is the current time in a local time zone. It is designated using the number of hours ahead or behind UTC time. For example the local time for the Mountain Time Zone in the United States is UTC -7. The default setting for several hardware clocks in a system BIOS is often local time.

The following table describes the tools and files used to determine and change time zone settings.

Use... To... Examples/usr/share/zoneinfo View the set of time zone configuration

files and directories, with each file identifying a specific time zone.

Files are typically organized in subfolders based on continent (such as Australia) or major country (such as US).

Individual files identify a major city in the time zone (such as Perth) or a specific region (either a division of the country or a country within the continent).

Information in the file identifies the UTC offset and any rules for

ls /usr/share/zoneinfo displays the names for time zones that Linux uses. Additional settings are located in the subdirectories.

Page 7: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

daylight savings time. Depending on the distribution,

time zone files might be located at /usr/lib/zoneinfo.

/etc/localtime

See the current time zone and change the time zone. The /etc/localtime file identifies the current time zone file used on the system. This is a symbolic link to a timezone file in the /usr/share/zoneinfo directory. Replacing this link changes the timezone.

ln -s /usr/share/zoneinfo/time_zone_file /etc/localtime creates a symbolic link to the time zone file that permanently alters the time zone for the current user account.cp -s /usr/share/zoneinfo/time_zone_file /etc/localtime accomplishes the same result as the example above.

/etc/timezoneSee the time zone settings on Debian computers. /etc/timezone identifies the current time zone by region and zone.

/etc/sysconfig/clock

See the current time zone. The file shows the following line:

ZONE=timezone

cat /etc/sysconfig/clockZONE="America/Denver"

date To view and manually set the system time.

date shows the current local time and the time zone.

tzselect

Change the value of the time zone (TZ) environment variable.

When executed, the utility prompts you to select a region, then a country, and so on until it has enough information to determine the time zone.

Only the root user can invoke the tzselect utility.

Note: Use the tzconfig command on Debian Linux distributions in place of tzselect.

To use tzselect:

1. Type tzselect and press Enter.2. Type the number from the list that

corresponds to the correct continent or ocean, and press Enter.

3. Type the number from the list that corresponds to the correct region, and press Enter.

4. Type the number from the list that corresponds to the correct timezone, and press Enter.

5. Press 1 to confirm the setting.

TZ=time_zoneexport TZ

Change the time zone environment variable. Use the file names in the /usr/share/zoneinfo directory to see the appropriate names for time zones.

Note: Environment variable changes are only permanent if they are added to a shell configuration file similar to ~/.bashrc or ~/bash_profile.

TZ=America/Denverexport TZ

Time Maintenance Facts

Page 8: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

Applications and services, especially those that are used for security purposes, require accurate time. Be aware of the following details:

Services that communicate with other computers require that the clocks on all computers are synchronized within a small degree of variance.

A timestamp is a record attached to an event or an action that identifies the time when the event took place. Timestamps are used to:

o Record when security events, such as logon or system changes, occur. o Identify the correct sequence of events. For example, if a database record is changed

from two different computers, the timestamp associated with the changes are used to identify which change took place first (or last).

Use the following files and utilities to manage the hardware clock and system time:

Use... To... Examples

cat /proc/driver/rtc Display the hardware clock time. cat /proc/driver/rtc displays the hardware clock time.

hwclock

View and set the hardware clock time and synchronize the hardware clock and the system time. Options include:

-a, --adjust adds or subtracts time from the hardware clock to account for systematic drift since the last time the clock was set or adjusted.

-r, --show displays the current hardware clock time. hwclock assumes -r if no options are used.

--set--date sets the hardware clock time and date.

-s, --hctosys sets the system time to the current hardware clock time.

-w, --systohc sets the hardware clock based on the system time.

--localtime sets the hardware clock to local time.

-u, --utc sets the hardware clock to UTC time.

hwclock -w sets the hardware clock time to match the system time.hwclock --set --date="2/24/2020 16:45:05" -utc sets the hwclock time to 4:45:05 PM on February 24, 2020 un UTC time.hwclock -s sets the system time to match the hardware clock.hwclock -u sets the hardware clock time to UTC time.

/etc/sysconfig/clock

Configure the hardware clock to use UTC or local time automatically. the file acts as a configuration file that sets the HWCLOCK setting to control whether the clock uses local or Coordinated Universal Time (UTC):

HWCLOCK -u specifies that the system use UTC.

HWCLOCK --localtime specifies  that the system use local time.

Note: Managing a large group of computers in different time zones is less complex if HWCLOCK is set to use UCT.

Page 9: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

netdateSet the system time to match the time on a time server on the network. The time provider must be running the time service on UPD port 37.

netdate 192.168.1.10 sets the time on the local computer to match the time on the time server at 192.168.1.10.

date

View and manually set the system time.

-d shows the current date and time. date assumes -d if no options are used.

-s sets the date and time. -u, --utc specifies UTC time.

date -s "11/20/2020 15:48:00" sets the time and date to 3:48:00 PM on November 20, 2020.date -su "11/20/2020 15:48:00" sets the UTC time and date to 3:48:00 PM on November 20, 2020date -d shows the local time and date.date -u shows the current UTC time.

NTP Facts

The Network Time Protocol (NTP) is a method of setting and synchronizing system time between computers. NTP uses a hierarchy of clocks and computers for identifying the current Coordinated Universal Time (UTC). NTP:

Synchronizes time in increments. Allows computers to be a time consumer and a time provider simultaneously so computers can

synchronize hierarchically. Runs on IP port 123. Uses strata to define time providers in a hierarchy (levels of time providers):

o Stratum 0 devices are accurate clocks (such as atomic clocks) that provide the official UTC.

o Stratum 1 devices are attached to the time devices (stratum 0). Stratum 1 devices are referred to as time servers because they provide time to other servers and computers through NTP.

o Stratum 2 devices receive their time from stratum 1 devices, and can also provide time to other devices.

Supports up to 256 strata, with lower devices getting time from higher devices and providing time to devices in a lower stratum.

Can be configured to use a pool of time servers at pool.ntp.org. Uses stepping to quickly make large adjustments to close time discrepancies; usually about once

every 60 seconds. Uses slewing to make smaller incremental time adjustments at a rate of about every 15 - 17

minutes. Slewing occurs when time discrepancies are under 128ms. Does not adjust times when time discrepancies are larger than 17 Minutes. This is known as

insane time. Tracks of the NTP daemon (ntpd) activity in the /var/log/ntp log.

Use the following files and utilities to manage time using the NTP:

Use... To... Examples/etc/ntp.conf Configure the time providers on the NTP client. server 0.fedora.pool.ntp.org

synchronizes the time with the Fedora time server pool.

Page 10: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

Each entry in the file begins with server and then the address of the time provider.

The server 127.127.1.0 represents the local host address and sets the system time to the hardware clock if no other time providers are available.

server 192.168.1.10 synchronizes the time with a computer at the specified IP address.server 127.127.1.0 synchronizes the time with the hardware clock on the local computer.

ntpdate

Update the current time on a computer. ntpdate:

Must be run as root. Will not function if ntpd is currently

running.

Note: ntpdate is deprecated; Use ntpd in its place.

ntpdate 0.pool.ntp.org updates the system time using a time provider from the NTP pool.

ntpd

Manage the NTP daemon from the command line. Options include:

-q does a one-time synchronization with a time provider. It is similar to ntpdate.

-g allows the NTP daemon to ignore insane time restrictions for the first synchronization.

-c specifies the name and path of the configuration file. The default is /etc/ntp.conf.

ntpd -qg updates the current time on the computer and ignores insane time restrictions.ntpd -c ~/ntp/ntpconfig.txt changes the configuration file that NTP uses to ~/ntp/ntpconfig.txt.

rcntp startorservice ntpd start

Start the NTP daemon.

Note: rcntp only works on BSD operating systems

service ntpd start starts the NTP daemon.

insserv ntp Configure the NTP daemon to start at boot time (BSD systems only.)

ntpq Query the status of the NTP daemon. Use -c to invoke a command. Commands include:

remote specifies the IP address of the current time provider.

refid Specifies the type of time source the time provider is using.

st shows the stratum of the time provider.

when shows the last synchronization time.

poll shows the synchronization interval. reach lists the last time NTP queried

the time provider.

ntpq -c reach shows the last time NTP queried the time provider.

Page 11: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

delay displays the network lag time between the time provider and the client.

ntptrace Display the next stratum up from the time provider.

Keep the following in mind when working with NTP:

To see what happens as the NTP daemon starts, use one terminal to start the daemon, and use another terminal with the tail command to view the daemon log at /var/log/ntp.

The time used by the computer is adjusted to account for network delay and other inaccuracies detected in the received time. The amount of error that the algorithm identifies is called the drift. The drift is calculated over time and typically saved on the computer to quickly identify accurate time, compensated by the drift amount.

The computer continues to poll the time servers to ensure that the system time remains synchronized.

Section 9.6 Questions and some info.

What is the role and function of a Mail Transfer Agent (MTA)? What are the most common types of MTAs on a Linux system? How do you read mail for local user accounts from the command line? Why would you configure an alias for the MTA running on a local system? What file do you use to configure forwarding of e-mail messages?

MTA Facts

A Mail Transfer Agent (MTA) sends messages between clients on a local system or over the Internet. MTAs:

Receive mail from a Mail User Agent (MUA). An MUA is an email application such as Mozilla Thunderbird or Microsoft Outlook.

Send/receive messages to/from other MTAs using Simple Mail Transfer Protocol (SMTP). Receive messages from MUAs using Simple Mail Transfer Protocol (SMTP) by default Send messages to MUAs using Post Office Protocol 3 (POP3) or Internet Message Access

Protocol (IMAP) when sending and receiving messages. IMAP has a few advantages over POP3. IMAP:

o Can download the entire message or only the message header.o Allows messages to be kept in the message store.o Allows creation of custom folders.

Are used to relay messages from several daemons, including cron and at, when jobs finish running.

The following are several of the most common MTA types on a Linux system:

Type DetailsSendmail Is an older MTA, but is still widely used. It is somewhat more complex to configure than other

MTA's. Sendmail:

Is the default MTA used on many distributions.

Page 12: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

Is non-modular (a single program.) Uses an init script is located at /etc/rc.d/init.d/sendmail.

Postfix

Is the default MTA on many SUSE distributions. Postfix

Is modular (i.e., made up of multiple programs). Has simplified configuration mechanisms.

qmail

Is an additional MTA that is not installed by default on any distribution. Qmail:

Is modular. Implements several security features. Has simplified configuration mechanisms. Implements additional protocols:

o Quick Mail Queuing Protocol (QMQP) allows the sharing of email queues among different MTAs.

o Quick Mail Transport Protocol (QMTP) is a transmission protocol similar to SMTP, but considered to be faster.

Exim

Is the default MTA only on a very few distributions. Exim:

Is non-modular. Has simplified configuration mechanisms.

Use the following to manage messages:

Utility/File Description Examplesmail Sendmail uses the mail command to send and receive

messages from the mail server:

To manage messages for the local user from the mail spool, type mail.

o Type the number of the message to read a message at the '?' prompt.

o Type d and the message number to delete the message at the '?' prompt.

o Type q to exit the mail prompt at the '?' prompt.

To send mail to a user on the local network:

1. Type mail [email protected]. Type a subject and press enter.3. Type the message, then press return to

start a new line.4. Press Ctrl+d to send the message.

Use mailq or sendmail -bp to display the mail queue.

Use sendmail -q to deliver all queued mail. Use sendmail -bd to start the sendmail

mail jdoe sends a mail over the network to the user jdoe.mail [email protected] sends an email to the specified email address.  ? 4 displays message four.? d4 deletes message four.? q exits the mail prompt.mailq displays the mail queue for the current user.

Page 13: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

daemon.

/etc/aliases.db

/etc/aliases.db is a binary database that stores the aliasing information for sendmail. Be aware of the following details:

The /etc/aliases file contains the list of sendmail email aliases in text format.

Use the newaliases command to create or update /etc/aliases.db from the /etc/aliases file. newaliases is identical to sendmail -bi.

root:     jdoe sends all mail to root to jdoe's inbox.

~/.forward

/home/user/.forward forwards messages from the local user to a user specified in the file.

Use this for temporary forwarding. Type the name of the user or address on a

single line.

Note: Forwarded email messages do not get saved in the original account.

jdoe forwards the mail to the user jdoe over the local [email protected] forwards the mail to the specified account.

/var/spool/mailEach user account on the system has a mail file in the /var/spool/mail directory. When new mail arrives, Linux tacks it onto the end of the recipient's mail file.

/var/spool/mail/gshant holds email for the gshant user account.

Section 9.7 Questions and some info.

What are the components that make up a database? What is the difference between a table record and an attribute? What SQL command would you use to view the data in a database? How can you ensure that you do not delete the wrong data from the database? When would you combine the SELECT and SORT BY commands?

SQL Facts

Structured Query Language (SQL) is used in most database applications. It provides commands for working with databases and tables, for populating tables with data, and for querying and organizing the data. This lesson uses a MySQL database for demonstration purposes.

The following table lists commands used to access and control a MySQL server:

Use... To... Examples

mysql_install_db Install the system tables and other database items for MySQL.

mysqlshow See a list of databases in MySQL.

Page 14: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

mysqladmin

Manage a MySQL database. Options include:

password creates a password. -u specifies a user. -h specifies the host for the

MySQL server.

mysqladmin -u user -h localhost password '123456' creates the user account on the local host with a password of 123456. Note: if the -h option is omitted, the local host is implied.

mysql

Access the MySQL command line. Options include:

-u specifies a user -p specifies a password. If used

alone, -p prompts for the password in the next line.

mysql -u root -p accesses MySQL after prompting for a password.mysql -u root -p123456 Accesses MySQL using the password for root. This command is considered insecure.mysql -u root -p 123456 accesses MySQL after prompting for a password, and attempts to connect to a database named 123456.

service mysqld start rcmysql start Start the mysqld daemon for MySQL. service mysqld start starts the MySQL

daemon on a System V system.

The following list defines several basic database objects:

A database is a group of related data organized using tables and accessed using a database application.

A table is a set of data organized into records (rows), and attributes (columns). A record is an item or entity in a table with its attributes listed across a row. For example, a record

may have a name of 'aspen tree', a height of '3 meters', and a type of 'deciduous'. Records are sometimes called tuples.

Attributes in a table are organized into columns. For example a name attribute might have 'aspen tree' in the first record, 'oak tree' in the second record, and 'white fir' in the third record.

Integers are whole numbers between -2,147,483,648 and 2,147,483,647. A primary key is an attribute of a record that uniquely identifies it from all other records in the

table. For example, a telephone number or a unique ID number can be used as a primary key. Primary keys are used to specify records when querying data from multiple tables.

When adding information to a database, certain attributes have specific data types. For example, a field that holds a price in US dollars uses numbers with two decimal points for dollars and cents, and a name uses characters. SQL has several data types available when adding information to tables. The following list describes several common SQL data types.

Character data types allow basic alpha-numeric characters. These use an exact length. Varchar data types allow alpha-numeric characters of any length up to a maximum specified

length. Decimal data types hold numbers that can have decimal values up to 38 decimal places. The

exact number of decimal places is specified. Float is a numeric data type that allows floating decimals. This stores approximate values. Time holds hours, minutes, seconds, and fractions of seconds. Date holds calendar dates. Enum holds a set of specified values such as 'small', 'medium', and 'large'.

Administrators use several commands to create, modify, and extract data from databases. The following table lists several of the most commonly-used commands.

Page 15: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

Use... To... ExamplesCREATE DATABASE Create a new database. CREATE DATABASE clothing; creates a database named

clothing.

USE Specify the database to work in. USE clothing; accesses the clothing database.

SHOW TABLES

Displays a list of tables in a database.

SHOW TABLES clothing; lists the tables in the clothing database.

CREATE TABLE

Add a table to the database and create the attributes for records to be added to the table.

CREATE TABLE shirts (invoice CHARACTER(7), type VARCHAR(40), color VARCHAR(20), price DECIMAL(5,2), size ENUM('XS','S','M','L','XL','XXL','XXXL'), location(VARCHAR(50), gender ENUM('male','female','either')); creates a table called shirts; adds attributes for invoice, type, color, price, size, location, and gender; and defines the data types for each attribute.

INSERT INTO

Add records to the table. A value must be specified for each attribute in the table. To leave an attribute blank, place two commas together.

INSERT INTO shirts VALUES 0008103,'t-shirt','green',7.95,'S','warehouse1 13-C-3','etiher'; adds a record for small green t-shirts.INSERT INTO shirts VALUES 0008094,'dress shirt','white',14.49,'L','warehouse1 5-J-1','male'; adds a record for men's large white dress shirts.

DESCRIBE See a description of a database object. DESCRIBE shirts; displays information about the shirts table.

SELECT

Retrieve information from a table. Clauses include:

WHERE filters using data from a specified field.

SORT BY sorts displayed data based on an attribute name.

GROUP BY determines how information in a list is grouped.

SELECT (location,price) FROM shirt WHERE color='green' AND type='t-shirt' AND size='M' SORT BY price; shows the location and price of all medium green t-shirts from the shirt table. The results are sorted by price.

UPDATE Change the values in a record.

UPDATE shirts SET price=11.95 WHERE type='dress shirt' AND size='L' AND gender='male'; changes the price on large men's dress shirts.

DELETE FROM

Remove records from a table.

DELETE FROM shirts WHERE color='pink' AND type='polo' AND gender='male'; deletes records for men's pink polo shirts.

ALTER TABLE

Add, change or remove attributes from tables.

ALTER TABLE shirts ADD COLUMN sleeve ENUM('short','long'); creates a new attribute for sleeve length.ALTER TABLE shirts ALTER COLUMN type style; changes the name of the type attribute to style.ALTER TABLE shirts DROP COLUMN location; deletes the location attribute.

DROP TABLE Delete an existing table. DROP TABLE shirts; deletes the shirts table.

Page 16: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

Keep the following in mind when working with SQL statements:

Statements must end with semicolons. If a semicolon is omitted, the command terminal assumes that the command will be finished on the next line.

In commands, character values need single quotes, but if number values have single quotes, they are treated like character strings. This makes a difference in sorting and doing actions such as getting the sum of a column. If an attribute only holds numbers, use a data type designed to hold numbers.

Section 11.1 Questions and some info.

What is the function of the IP protocol? What is the difference between a connectionless and a connection-oriented protocol? What is the main role of the ICMP protocol? What is the difference between a private and public IP address? How does the subnet mask identify the network address and network node? What are the differences between IP version 4 and IP version 6 addresses? Which file lists all network services and their ports on the Linux system?

Common IP Protocols

A protocol is a set of standards for communication between network hosts. Protocols often provide services, such as e-mail or file transfer. Most protocols are not intended to be used alone, but instead rely on and interact with other dependent or complimentary protocols. A group of protocols that is intended to be used together is called a protocol suite.

The Internet Protocol (IP) protocol suite (commonly referred to as TCP/IP) is the most widely used protocol suite today. The following table lists several protocols in the IP protocol suite.

Protocol Description

Internet Protocol (IP)

Internet Protocol (IP) is the main protocol used on the Internet. It is a connectionless protocol that makes routing path decisions. It also handles logical addressing issues through the use of IP addresses.

Transmission Control Protocol (TCP)

TCP provides services that ensure accurate and timely delivery of network communications between two hosts. TCP is a connection-oriented protocol. TCP provides the following services to ensure message delivery:

Sequencing of data packets Flow control Error checking

User Datagram Protocol (UDP)

UDP is a connectionless protocol. UDP is a host-to-host protocol like TCP. However, it does not include mechanisms for ensuring timely and accurate delivery. Because it has less overhead, it offers fast communications, but at the expense of possible errors or data loss.

Internet Control Message Protocol (ICMP)

ICMP works closely with IP in providing error and control information, by allowing hosts to exchange packet status information, which helps move the packets through the internetwork. Two common management utilities, ping and traceroute, use ICMP messages to check network connectivity. ICMP also works with IP to send notices when destinations are unreachable, when devices' buffers overflow, the route and hops packets take through the network, and whether devices can communicate across the network.

Page 17: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

Internet Group Membership Protocol (IGMP)

IGMP is a protocol for defining host groups. All group members can receive broadcast messages intended for the group (called multicasts). Multicast groups can be composed of devices within the same network or across networks (connected with a router).

HyperText Transfer Protocol (HTTP)

HTTP is used by Web browsers and Web servers to exchange files (such as Web pages) through the World Wide Web and intranets. HTTP can be described as an information requesting and responding protocol. It is typically used to request and send Web documents, but is also used as the protocol for communication between agents using different IP protocols.

HTTP over SSL (HTTPS)

HTTPS is a secure form of HTTP that uses SSL to encrypt data before it is transmitted.

Secure Sockets Layer (SSL)

SSL secures messages being transmitted on the Internet. It uses RSA for authentication and encryption. Web browsers use SSL (Secure Sockets Layer) to ensure safe Web transactions. URLs that begin with https:// trigger your Web browser to use SSL.

Transport Layer Security (TLS)

TLS ensures that messages being transmitted on the Internet are private and tamper proof. TLS is implemented through two protocols:

TLS Record--Can provide connection security with encryption (with DES for example).

TLS Handshake--Provides mutual authentication and choice of encryption method.

TLS and SSL are similar but not interoperable.

File Transfer Protocol (FTP)

FTP provides a generic method of transferring files. It can include file security through usernames and passwords, and it allows file transfer between dissimilar computer systems. FTP can transfer both binary and text files, including HTML, to another host. FTP URLs are preceded by ftp:// followed by the DNS name of the FTP server. To log in to an FTP server, use: ftp://username@servername.

Trivial File Transfer Protocol (TFTP)

TFTP is similar to FTP. It lets you transfer files between a host and an FTP server. However, it provides no user authentication and no error detection. TFTP is often used when transferring files such as video, audio, or images. Because it does not perform error detection, TFTP is faster than FTP, but might be subject to file errors.

Secure File Transfer Protocol (SFTP)

SFTP is a file transfer protocol that uses Secure Shell (SSH) to secure data transfers. SSH ensures that SFTP transmissions use encrypted commands and data which prevent data from being transmitted over the network in clear text.

Secure Copy (SCP)SCP is associated with Unix/Linux networks and used to transfer files between systems. Like SFTP, SCP relies on SSH to ensure that data and passwords are not transmitted over the network in clear text.

Simple Mail Transfer Protocol (SMTP)

SMTP is used to route electronic mail through the internetwork. SMTP is used:

Between mail servers for sending and relaying mail. By all e-mail clients to send mail. By some e-mail client programs, such as Microsoft Outlook, for receiving mail

from an Exchange server.

Internet Message Access Protocol (IMAP)

IMAP is an e-mail retrieval protocol designed to enable users to access their e-mail from various locations without the need to transfer messages or files back and forth between computers. Messages remain on the remote mail server and are not automatically downloaded to a client system. Note: An e-mail client that uses IMAP for receiving mail uses SMTP for sending mail.

Post Office POP3 is part of the TCP/IP protocol suite and used to retrieve e-mail from a remote

Page 18: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

Protocol 3 (POP3)server to a local client over a TCP/IP connection. With POP3, e-mail messages are downloaded to the client. Note: An e-mail client that uses POP3 for receiving mail uses SMTP for sending mail.

Dynamic Host Configuration Protocol (DHCP)

DHCP is a method for automatically assigning addresses and other configuration parameters to network hosts. Using a DHCP server, hosts receive configuration information at startup, reducing the amount of manual configuration required on each host.

Domain Name System (DNS)

DNS is a system that is distributed throughout the internetwork to provide address/name resolution. For example, the name www.mydomain.com would be identified with a specific IP address.

Network Time Protocol (NTP)

NTP is used to communicate time synchronization information between systems on a network.

Network News Transport Protocol (NNTP)

NNTP is the most widely-used protocol that manages notes posted on Usenet Newsgroups.

Lightweight Directory Access Protocol (LDAP)

LDAP is used to allow searching and updating of a directory service. The LDAP directory service follows a client/server model. One or more LDAP servers contain the directory data, the LDAP client connects to an LDAP Server to make a directory service request.

Simple Network Management Protocol (SNMP)

SNMP is a protocol designed for managing complex networks. SNMP lets network hosts exchange configuration and status information. This information can be gathered by management software and used to monitor and manage the network.

Remote Terminal Emulation (Telnet)

Telnet allows an attached computer to act as a dumb terminal, with data processing taking place on the TCP/IP host computer. It is still widely used to provide connectivity between dissimilar systems. Telnet can also be used to test a service by the use of HTTP commands.

Secure Shell (SSH)SSH allows for secure interactive control of remote systems. SSH is a secure and acceptable alternative to Telnet. SSH uses public key cryptography for both connection and authentication.

IP Address Facts

Be aware of the following IPv4 address details:

An IPv4 address is a 32-bit binary number represented as four octets (four 8-bit numbers). Each octet is separated by a period. IPv4 addresses can be represented in one of two ways:

o Decimal (for example 131.107.2.200). In decimal notation, each octet must be between 0 and 255.

o Binary (for example 10000011.01101011.00000010.11001000). In binary notation, each octet is an 8-character number.

To convert from binary to decimal and vice versa, memorize the decimal equivalent to the following binary numbers:

10000000 01000000 00100000 00010000 00001000 00000100 00000010 00000001128 64 32 16 8 4 2 1

To convert from binary, take each bit position with a 1 value and add the decimal values for that bit together. For example, the decimal equivalent of 10010101 is: 128 + 16 + 4 + 1 = 149

The subnet mask is a 32-bit number that is associated with each IPv4 address that identifies the network portion of the address.

Page 19: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

o In binary form, the subnet mask is always a series of 1's followed by a series of 0's (1's and 0's are never mixed in sequence in the mask). A simple mask might be 255.255.255.0.

o In Classless Inter-Domain Routing (CIDR) form, the subnet mask appears as a slash (/) followed by the number of bits in the mask that are set to 1. A simple mask might be /24.

IPv4 addresses have a default class. The address class identifies the range of IPv4 addresses and a default subnet mask used for the range. The following table shows the default address class for each IPv4 address range.

Class Address Range First Octet Range Default Subnet Mask

CIDR Notation

A 1.0.0.0 to 126.255.255.2551-126

(00000001--01111110 binary)

255.0.0.0 /8

B 128.0.0.0 to 191.255.255.255

128-191(10000000--10111111

binary)255.255.0.0 /16

C 192.0.0.0 to 223.255.255.255

192-223(11000000--11011111

binary)255.255.255.0 /24

D 224.0.0.0 to 239.255.255.255

224-239(11100000--11101111

binary)n/a n/a

E 240.0.0.0 to 255.255.255.255

240-255(11110000--11111111

binary)n/a n/a

A Network Address Translation (NAT) router translates multiple private addresses into the single registered IP address.

o The Internet is classified as a public network. All devices on the public network must have a registered IP address; this address is assigned by the ISP.

o The internal network is classified as a private network. All devices on the private network use private IP addresses internally, but share the public IP address when accessing the Internet.

o A NAT router associates a port number with each private IP address. Communications with the private hosts from the Internet are sent to the public IP address and the associated port number. Port assignments are made automatically by the NAT router.

o The private network can use addresses in the following ranges that have been reserved for private use (i.e. they will not be used by hosts on the Internet):

10.0.0.0 to 10.255.255.255 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255

Subnetting is the process of dividing a large network into smaller networks. When you subnet a network, each network segment (called a subnet) has a different network address (also called a subnet address).

o Subnetting uses custom rather than the default subnet masks. For example, instead of using 255.255.255.0 with a Class C address, you might use 255.255.255.192 instead.

o Using custom subnet masks is often called classless addressing because the subnet mask cannot be inferred simply from the class of a given IP address. The address class is ignored and the mask is always supplied to identify the network and host portions of the address.

o Using classless addresses is made possible by CIDR. Each host must have a unique IPv4 address.

Page 20: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

Each host on the same network must have an IPv4 address with a common network portion of the address.

The network address is the first address in the address range and cannot be assigned to a host. The broadcast address is the last address in the address range and is used to send messages to

all hosts on the network.

The current IP addressing standard, version 4, will eventually run out of unique addresses, so a new system is being developed. It is named IP version 6 or IPv6. The IPv6 address is a 128-bit binary number. A sample IPv6 IP address looks like: 35BC:FA77:4898:DAFC:200C:FBBC:A007:8973. The following list describes the features of an IPv6 address:

The address is made up of 32 hexadecimal numbers, organized into 8 quartets. The quartets are separated by colons. Each quartet is represented as a hexadecimal number between 0 and FFFF. Each quartet

represents 16-bits of data (FFFF = 1111 1111 1111 1111). Leading zeros can be omitted in each section. For example, the quartet 0284 could also be

represented by 284. Addresses with consecutive zeros can be expressed more concisely by substituting a double-

colon for the group of zeros. For example: o FEC0:0:0:0:78CD:1283:F398:23AB o FEC0::78CD:1283:F398:23AB (concise form)

If an address has more than one consecutive location where one or more quartets are all zeros, only one location can be abbreviated. For example, FEC2:0:0:0:78CA:0:0:23AB could be abbreviated as:

o FEC2::78CA:0:0:23AB or o FEC2:0:0:0:78CA::23AB

But not FEC2::78CA::23AB

The 128-bit address contains two parts:

Component Description

Prefix

The first 64-bits is known as the prefix.

o The 64-bit prefix can be divided into various parts, with each part having a specific meaning. Parts in the prefix can identify the geographic region, the ISP, the network, and the subnet.

o The prefix length identifies the number of bits in the relevant portion of the prefix. To indicate the prefix length, add a slash (/) followed by the prefix length number. Full quartets with trailing 0's in the prefix address can be omitted (for example 2001:0DB8:4898:DAFC::/64).

o Because addresses are allocated based on physical location, the prefix generally identifies the location of the host. The 64-bit prefix is often referred to as the global routing prefix.

Interface ID The last 64-bits is the interface ID. This is the unique address assigned to an interface.

o Addresses are assigned to interfaces (network connections), not to the host. Technically, the interface ID is not a host address.

o In most cases, individual interface IDs are not assigned by ISPs, but are rather generated automatically or managed by site administrators.

Page 21: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

o Interface IDs must be unique within a subnet, but can be the same if the interface is on different subnets.

o On Ethernet networks, the interface ID can be automatically derived from the MAC address. Using the automatic host ID simplifies administration.

Common Ports

Network ports are logical connections, provided by the TCP or UDP protocols. The IP protocol stack uses port numbers to determine what protocol incoming traffic should be directed to. Some characteristics of ports are listed below:

Ports allow a single host with a single IP address to run network services. Each port number identifies a distinct service.

Each host can have over 65,000 ports per IP address. Port use is regulated by the Internet Corporation for Assigning Names and Numbers (ICANN).

 ICANN specifies three categories for ports.

Well known ports range from 0 to 1023 and are assigned to common protocols and services. Registered ports range from 1024 to 49151 and are assigned by ICANN to a specific service. Dynamic (also called private or high) ports range from 49,152 to 65,535 and can be used by any

service on an ad hoc basis. Ports are assigned when a session is established, and released when the session ends.

The following table lists the well known ports that correspond to common Internet services.

Port(s) Service20 TCP21 TCP File Transfer Protocol (FTP)

22 TCP and UDP Secure Shell (SSH)23 TCP Telnet25 TCP Simple Mail Transfer Protocol (SMTP)

53 TCP and UDP Domain Name Server (DNS)67 UDP68 UDP Dynamic Host Configuration Protocol (DHCP)

69 UDP Trivial File Transfer Protocol (TFTP)80 TCP HyperText Transfer Protocol (HTTP)110 TCP Post Office Protocol (POP3)119 TCP Network News Transport Protocol (NNTP)123 UDP Network Time Protocol (NTP)137 UDP138 UDP139 TCP

NetBIOS

143 TCP and UDP Internet Message Access Protocol (IMAP4)161 TCP and UDP162 TCP and UDP Simple Network Management Protocol (SNMP)

389 TCP and UDP Lightweight Directory Access Protocol

Page 22: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

443 TCP and UDP HTTP with Secure Sockets Layer (SSL)

Be aware of the following:

/etc/services lists all network services on the Linux system, including the port assigned to the service. Most applications reference /etc/services for which service is using a specific TCP/UDP port.

To protect a server, ensure that only the necessary ports are opened. For example, if the server is only being used for e-mail, then shut down ports that correspond to FTP, DNS, and HTTP (among others).

Section 11.2 Question and some info.

What is the advantage of using dynamic addressing over static addressing? Where is the interface configuration file located on the system? What is the purpose of the lo network interface? How can you view the current status of the network interfaces from the shell prompt? What utilities can disable and enable the network interfaces? What is the advantage of using dynamic addressing over static addressing? Where is the interface configuration file located on the system? What is the purpose of the lo network interface? How can you view the current status of the network interfaces from the shell prompt? What utilities can disable and enable the network interfaces?

Addressing Method Facts

The following table lists several options for assigning IP addresses.

Method Uses

Static (manual) assignment

Using static addressing, IP configuration information must be manually configured on each host. Use static addressing:

On networks with a very small number of hosts. On networks that do not change often or that will not grow. To permanently assign IP addresses to hosts that must have always have

the same address (such as printers, servers, or routers). For hosts that cannot accept an IP address from DHCP. To reduce DHCP-related traffic.

Note: Static addressing is very susceptible to configuration errors and duplicate IP address configuration errors (two hosts that have been assigned the same IP address). Static addressing also disables both APIPA and DHCP capabilities on the host.

Dynamic Host Configuration Protocol (DHCP) assignment

A DHCP server is a special server configured to pass out IP address and other IP configuration information to network clients.

When a client boots, it contacts the DHCP server for IP configuration information.

The DHCP server is configured with a range of IP addresses it can assign to hosts (Microsoft calls these ranges scopes).

The DHCP server can also be configured to pass out other IP configuration such as the default gateway and DNS server addresses.

Page 23: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

The DHCP server ensures that each client has a unique IP address. The DHCP server can be configured to not assign specific addresses in

the range, or to assign a specific address to a specific host. The DHCP server assigns the IP address and other information to the

client. The assignment is called a lease, and includes a lease time that identifies how long the client can use the IP address.

Periodically and when the client reboots, it contacts the DHCP server to renew the lease on the IP address.

The DHCP lease process uses frame-level broadcasts. For this reason, DHCP requests typically do not pass through routers to other subnets. To enable DHCP across subnets:

o Enable BootP (DHCP broadcast) requests through the router.o Configure a computer for BootP forwarding to request IP

information on behalf of other clients. You can configure a DHCP server to deliver the same address to a

specific host each time it requests an address. Microsoft calls this configuration a reservation.

DHCP is a TCP/IP protocol. Any client configured to use DHCP can get an IP address from any server configured for DHCP, regardless of operating system.

Use DHCP for small, medium, or large networks. DHCP requires a DHCP server and minimal configuration.

Network Configuration Facts

Linux uses the following files for network configuration:

File or Directory Description/etc/init.d/network/etc/rc.d/init.d/network This script file loads and unloads networking services.

/etc/sysconfig/network-scripts

This is the network configuration file directory, which contains individual device configuration files named ifcfg-device_name (e.g., ifcfg-eth0). Edit the files in this directory to modify the following settings:

Boot protocol (static, DHCP, or BootP) Autoconfiguration information IP Address, mask, and default router (for static configurations)

/var/lib/dhcpcd/dhcpclientn/var/lib/dhcpcd/dhclient.leases

Depending on the distribution's daemon, one of these files exists to manage DHCP address information.

The table below shows common commands for configuring network settings.

Use... To... Example

service network Start, restart, or stop networking services.

service network start starts the network service.service network restart restarts the network service.

ifconfig interface parameters Create a static IP configuration for the ifconfig eth0 192.168.1.1

Page 24: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

specified interface. Common ifconfig parameters include:

address sets the IP address netmask addr sets the

subnet mask up activates the interface down deactivates the

interface broadcast sets the broadcast

address.

netmask addr 255.255.255.0 configures a static IP address and subnet mask for eth0.ifconfig eth0 up starts the eth0 device.

ifup Start a network interface. ifup eth1 starts the eth1 network device.

ifdown Stop a network interface. ifdown eth1 stops the eth1 network device.

ifconfigifconfig interface

View network interface information. Use the -a option to display the status of all interfaces.

ifconfig -a displays the status of all interfaces, even those that are down.

Section 11.3 Questions and some info.

What is the role of a router? What file contains the complete routing table on the system? How would you make the default gateway persistent? Which command sets the default route on the system?

Routing Facts

A router is a device that sends packets from one network to another network. Routers receive packets, read their headers to find addressing information, and send them on to their correct destination on the network or Internet. Routers can forward packets through an internetwork by maintaining routing information in a database called a routing table. Every Linux system maintains a route table in RAM that it uses to determine where to send data on a network. The routing table typically contains the following information:

The address of a known network The interface or next hop router used to reach the destination network A cost value (also called a metric) that identifies the desirability of the route to the destination

network (using distance, delay, or cost) A timeout value that identifies when the route expires

The default router (also known as gateway router and default gateway router) is a device that performs the act of routing, and enables a host to communicate with other hosts on other networks through the process of routing. The default router IP address:

Must be configured on each host to allow inter-network communication. Without the default router, hosts will only be able to communicate with devices within the same subnet.

Must be on the same subnet as the host computer. Routers have multiple network interface cards attached to multiple networks. When configuring the default router, choose the address on the local subnet.

Page 25: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

Is stored in the /etc/sysconfig/network/routes file. Changes to the /etc/sysconfig/network/routes file will not take effect until the network interface is restarted.

The table below shows common commands for configuring routing:

Use... To... Example

route add

Add a static route in the routing table.

default gw creates a route for the default router.

-net specifies a network address.

-host specifies a single host on the network.

reject installs a blocking route.

route add default gw 192.168.1.1 adds the default router 192.168.1.1.route add -net 15.0.0.0 netmask 255.0.0.0 dev eth0 adds a route to the 15.0.0.0/8 network.route add -host 15.0.0.1 gw 10.0.20.1 adds a static route to the 15.0.0.1 host.route add -net 10.0.0.0 netmask 255.0.0.0 reject installs a rejecting route for the 10.0.0.0/8 network.

route del Delete a static route in the routing table.

route del -net 172.18.0.0 netmask 255.255.0.0 deletes a route to the 17.18.0.0/16 network

route View the routing table and the default gateway address.

Section 11.4 Question and some info.

When configuring the DNS, what is the purpose for having multiple nameservers? Which file provides the system with domain names mapped to IP addresses? What function does the /etc/nsswitch.conf file provide? What are the advantages of using a DNS server for name resolution?

DNS Configuration Facts

Domain Name Service (DNS) resolves IP addresses to domain names that people can remember. The following table lists the files that administrators use to configure DNS settings on Linux.

Use... To... Examples/etc/hosts Provide the system with domain names

for IP addresses. The line contains the IP address, fully qualified domain name and aliases for the domain name. This file:

Provides name resolution when DNS is not running (for example during system startup before DNS has started)

127.0.0.1 fs4.mydomain.com localhost specifies that the IP address 127.0.01 is assigned to fs4.mycomain.com and that the term localhost can be used as an alias to specify the computer.

Page 26: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

Operates with the Network Information Service (NIS) to identify hosts.

Provides information for small networks without a DNS server.

Note: Domain names include alphanumeric characters, periods (.), and dashes (-), and must begin and end with alphanumeric characters.

/etc/resolv.conf

Provide the system with the name of the network DNS server. Up to three servers can be listed, and the servers are accessed in the order specified. The file also has settings that append fully qualified domain names to computer names

nameserver 192.168.1.3 specifies 192.168.1.3 as the IP address of the DNS server.search mydomain.com appends the domain name to computer names that do not have a domain name. For example, linux1 becomes linux1.mydomain.com.

/etc/nsswitch.confSpecify whether the computer's host file or the DNS server takes precedence if there is a DNS resolution conflict between the two.

hosts: files dns specifies that the hosts file takes precedence over information obtained from a DNS server.

/etc/HOSTNAME/etc/sysconfig/network Define the host and domain names. HOSTNAME=fs1 identifies the

hostname as fs1.

host Find the IP address for a domain name. host www.testout.com displays the IP address for www.testout.com.

hostname Display or set the name of the local host for the current session.

hostname ls4 sets the hostname for the current session to ls4.

Section 11.5 Questions and some info.

Why is it important to completely identify the source of a problem before starting to fix it? What are good sources to research when creating a hypothesis and determining a

resolution? After you fix the problem what actions should you still complete? How can you verify the connectivity of hosts within a network? Which utility can display the round trip time of an ICMP echo request? Which utilities send name resolution requests? Which utility will provide the most

information about the hostname or IP address?

Troubleshooting Methodology Facts

Good troubleshooting is a process that combines knowledge, experience, and intuition. The following process has proven effective in a variety of situations:

1. Identify the symptoms and potential causes. Ask the user to describe the problem, check for error messages, and recreate the problem. Identify the affected area and determine how large the problem is. For example, fixes for one client workstation would likely be very different than fixes for an entire network segment.

2. Establish what has changed. Most often, problems are caused by new hardware or software or changes to the configuration. If necessary, ask questions to discover what might have changed that could have caused the problem.

Page 27: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

3. Create a hypothesis. Review the list of potential causes and select the most probable cause. Look for common errors or solutions that can be tried quickly.

4. Create an action plan and account for side effects of the proposed plan. The plan might include purchases for hardware or equipment that need approval before proceeding. In addition, the plan might involve taking some services offline for a period of time. Identifying the effects ahead of time helps put measures into place to eliminate or reduce any potential negative consequences.

5. Implement the fix to the problem, and make sure that the solution has fully fixed the problem and has not caused any other problems. If necessary, implement additional steps to correct the problem if the first solution did not work. 

6. Ensure user satisfaction. This may include educating the user, such as explaining what the problem was, the solution, and how to avoid this problem in the future.

7. Document the solution and process. In the future, check the documentation to see what has changed or to help remember the solution to common problems.

Remember, however, that troubleshooting is a process of both deduction and induction. Experience will show when deviating from this process can save both time and effort.

Network Troubleshooting Considerations and Tools

When troubleshooting network communications, consider the following:

Problem Considerations

Physical issues

The best way to verify if a connection is valid is to check the link light on both the workstation and the hub. If the link light is unlit, try the following:

Swap the cables. This will help determine whether the cable is the problem. Try using a different switch or hub port for the connection. Make sure that the card is properly seated. Use loopback plugs to test network cards and cable testing devices to test network

cables.

Interference

Interference is caused by electromagnetic fields or radio frequency interference.

For wired cables, make sure wires are not routed next to motors or fluorescent lights that can cause interference.

For wireless devices, make sure there are not other devices in the area transmitting on the same frequency and channel (such as microwaves or cordless phones).

Check to make sure that the cable is not kinked or worn. Cables should be routed through walls or ceilings, not strung across the floor. If a cable must run across the floor, encase the cable to prevent wear and secure the cable in place to prevent tripping accidents. Worn cables might introduce some interference, or simply prevent signals from being sent properly.

Network issues

If the device and connection to the device appear to be working, check the following:

Check firewalls on both end devices to see if communications are being blocked by a host-based firewall.

Check the service on the target device to make sure that it is running and is properly configured.

The following table compares some of the tools for troubleshooting network communication problems:

Page 28: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

Use... To...

ping

Verify connectivity between hosts within the network.

Ping the special loopback address of 127.0.0.1. This tests the TCP/IP configuration of the local host. If successful, TCP/IP is correctly configured.

Ping a destination with IP address. If there is no response, try to ping any other host.o If your computer cannot communicate with any other computer, check the

network cable, the network interface card, or the IP address configuration on your computer.

o If your computer can communicate with computers on the local network, but can't communicate with remote computers (such as the Internet), verify the default gateway configuration on your computer.

o If all computers on the local network cannot communicate with any remote computer, troubleshoot the router's connection to the remote network.

Ping by a DNS name. If a ping by IP address works, but a ping by DNS name fails, then there is probably a DNS problem.

Use the -c option to specify how many ICMP echo requests to send to the destination.

netstat

Display a list of network connections (i.e., sockets), the routing table, and information about the network interface. A socket is an endpoint of a bidirectional communication flow across a computer network. Use the following options for additional information:

-a lists both listening and non-listening ports. -i displays a table of all network interfaces. -l lists listening sockets. -s displays statistics for each protocol. -r displays the route table and default gateway.

traceroutetracepath

Test connectivity between devices, show the path between the two devices. traceroute:

Can help track down which router (known as a hop) in the route is not working correctly.

Displays the Round Trip Time (RTT) for each hop. The RTT is the time difference between when the probe was sent from traceroute and the time the response arrived for each packet.

tracepath is similar to traceroute, but does not require super user privileges.

nslookup

Send a name resolution request. To use nslookup:

1. Enter nslookup at the shell prompt.2. Enter the hostname or IP address, such as 192.168.1.1.3. The DNS server should respond with the requested mapping.4. Enter exit when finished

dig Send a name resolution request and receive extensive information about the hostname or IP address. Consider the following options:

a resolves a record information ptr resolves a ptr record cname resolves cname record information p queries a specific port on the host in resolves Internet record information

Page 29: f01. · Web view2013/09/27 · 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 Subnetting is the process of dividing a large network into smaller networks. When you subnet

CMIT 391 Linux System Administration - Assignment #3

mx resolves mx record information soa resolves start of authority information