------------------------ Exercise #04 for NET2003 due February 7, 2006 ------------------------ -Ian! D. Allen - idallen@idallen.ca Remember - knowing how to find out an answer is more important than memorizing the answer. Learn to fish! RTFM! (Read The Fine Manual) Global weight: 4% of your total mark this term Due date: 23h59 Tuesday February 7, 2006. The deliverables for this exercise are to be submitted online on the Course Linux Server using the "netsubmit" method described in the exercise description, below. No paper; no email; no FTP. Late-submission date: I will accept without penalty exercises that are submitted late but before 10h00 on Thursday, February 9. After that late-submission date, the exercise is worth zero marks. Exercises submitted by the *due date* will be marked online and your marks will be sent to you by email after the late-submission date. Where to work, location of the course notes on the Course Linux Server, exercise preparation: See exercise01.txt for all the above details. NOTE: For full marks, keep your lines shorter than 80 columns in this course! The VIM editor will automatically wrap most lines as you type them if you enter "set wrapmargin=5" in your $HOME/.vimrc file. ---------------- Exercise Details ---------------- Synopsis: Tune Linux for better operation as a server. You will make some changes to your installed and configured Mandriva network server on your caddy hard drive. (You need to have completed the Mandriva installation and configuration documented in mandriva_install.txt and mandriva_config.txt to do this exercise.) Part I - working with /etc/inittab ------ Much of the initial state of the system is determined by the text file /etc/inittab. This file contains useful comments explaining how the system should behave. We will make some edits to this file, after which there are some questions to answer. A) Network servers shouldn't come up running the X11 GUI. (Most servers wouldn't even have it installed!) We need to ensure that the system boots into console mode first. Modify /etc/inittab and change the default run level in front of the "initdefault" keyword from 5 to 3. (It may already be 3.) You can start up the X11 GUI by logging in as an ordinary user (not as root!) and issuing the shell command: startx & B) The login sequence clears away some status messages at boot time when it prints its first login prompt for console tty1. We want to stop this clearing from happening, so that we can read all the status messages from our server as it boots. The program that issues login prompts for tty1 is mentioned on a line in the /etc/inittab file. Modify the correct line in this file to add the program option to suppress the clearing of the screen before prompting for a login name. (Hint: The absolute pathname to the program is used in /etc/inittab. When you RTFM the program to find how to use it and the name of the option, you only want to look up the name of the program, not the whole absolute pathname.) After you make this modification, it will take effect on the next boot of your system. If you want the change to /etc/inittab to take effect immediately, you have to tell the "init" process to re-read the /etc/inittab file. Use the correct argument to the "telinit" command to "wake up" the "init" process and cause it to re-examine the /etc/inittab file. (RTFM for "telinit" and search for "wake".) Note that when you exit your login bash shell, the file .bash_logout is sourced by your shell before it exits. Often this file contains a "clear" command that also clears your screen. Create file exercise04tune.txt, enter your assignment label (with all fields spelled correctly), copy these numbered questions into the file and, below each question, give your answer: 1) Show the updated "initdefault" line from your /etc/inittab file. 2) Show the updated "tty1" line from your /etc/inittab file. 3) What command line tells "init" to re-read the /etc/inittab file? 4) What is the documented meaning of each of the Mandriva (Mandrakelinux) run levels? 5) What would happen if you set the "initdefault" run level to 0? (It is not recommended to do this.) 6) What would happen if you set the "initdefault" run level to 6? (It is not recommended to do this.) 7) What is the full pathname of the script file used during "System initialization", and how many lines does it contain? 8) Describe exactly what will happen to your server if you press CTRL-ALT-DEL. (Describe it, in detail; don't do it!) Give the meanings of all options used by any related commands. 9) The program "/bin/true" executes and does nothing. (Try it!) How could you use this program to make your server ignore CTRL-ALT-DEL? Show the updated line in /etc/inittab that would do this. Do not actually update /etc/inittab - only display what might be done. Part II - NTP "Network Time Protocol" ------ Continue adding the numbered questions and answers to exercise04tune.txt. Your system may not come up with time synchronized correctly. Time synchronization may be done in many ways under Linux. Mandriva usually uses a system daemon named "ntpd" that uses the standard NTP "Network Time Protocol". To answer questions in this section, refer to ALN (Advanced Linux Networking) Chapter 10. 10) True/False - the NTP program will refuse to set the time on a system if the time is more than 1000 seconds wrong. (ALN p.244) 11) What program can you use to manually set the system clock before calling the NTP program? (ALN p.244) 12) What option to the above program causes it to execute, go through all the steps, but not actually set the time? (RTFM) Give an example command line using the time server pool.ntp.org as the target. Include the output of the command line. You may need to review Class Notes file mandriva_config.txt to answer these next questions about packages. You should already have installed the packages mentioned in that file. If not, complete the package installations required by mandriva_config.txt before continuing. 13) If you know the name of a program or file (e.g. ntpd), how do you find out which Mandriva packages contain this program? Give an example command line using the string "ntpd" as the file for which to search. (Use a command that searches for strings in packages even if the packages are not installed on your system currently.) Include the output of the command line. 14) What version of the NTP package is installed? Give the command line that will display the full Mandriva package name and version information. (Use a command that tells you information about installed packages.) Include the output of the command line. 15) How do you display the information description for the installed NTP package? Give a command line that will display this information. In the output, you will read the line "Ntp includes ntpdate (a program for retrieving the date and time from remote machines via a network) and ntpd (a daemon which continuously adjusts system time)." This is a lie - the ntp package does not actually contain the ntpdate program any more! 16) Give a command line that will discover in which Mandriva package the executable ntpdate program actually resides. (System executable programs usually reside in /sbin or /usr/sbin.) Include the output of the command line. 17) Give a command line that will show the full Mandriva package name and version information for the installed package that actually contains ntpdate. Include the output of the command line. 18) By looking in the names of the files installed by the NTP package, give a command pipeline that shows just the pathname of the NTP start-up script that resides under the init.d directory. (Hint: Produce a list of all the names in the installed NTP package and pipe that into a command that searches for the "init.d" string. The resulting absolute pathname is the name of the NTP start-up script.) 19) Does the NTP start up script call the ntpdate program? Give a command line that searches for the string "ntpdate" in this file. Include the output of the command line. 20) What absolute pathname does the ntpdate program use to get its list of time servers? (Reference the output of the previous question.) Show a long listing of this file (including the size and modify time). C) If the file in the previous question is empty, put these names in it on separate lines: time.algonquincollege.com pool.ntp.org Restart your NTP service: /etc/init.d/ntpd restart Is your server date and time now correct? Submission ---------- NOTE: For full marks, keep your lines shorter than 80 columns in this course! The VIM editor will automatically wrap most lines as you type them if you enter "set wrapmargin=5" in your $HOME/.vimrc file. NOTE: Make sure your exercise04tune.txt file contains your assignment label and both the questions and the answers below each. Class Notes reference: netsubmit.txt - Using the netsubmit command Submit the output and the finished and labelled file for marking as Exercise 04 on the Course Linux Server, using the following netsubmit command line: $ netsubmit 04 exercise04tune.txt $ netsubmit -list