==================== Lab 6 sample answers ==================== - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Copy all the numbered questions labelled "ANSWER:" below into the lab06answers.txt file and, below each question, give your command line and answer to the question in the file. (To answer most questions in this section, refer to ALN (Advanced Linux Networking) Chapter 10.) 20) 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) ANSWER: TRUE 21) What is the name of the program that you can use to manually set the system clock before calling the NTP program? (ALN p.244) Your Debian system does this using a separate start-up script on each reboot. ANSWER: ntpdate 22) Find the option to the above manual program that causes it to execute, go through all the steps, but not actually set the time (for debugging). (RTFM) Give an example debugging command line for the program, using the time server pool.ntp.org as the target. Include the output of the command line. ANSWER: # ntpdate -d pool.ntp.org (sample output borrowed from one student's answer) # ntpdate -d pool.ntp.org 26 Feb 22:45:54 ntpdate[2596]: ntpdate 4.2.0a@1:4.2.0a+stable-2-r Fri Aug 26 10:30:13 UTC 2005 (1) transmit(217.194.124.211) receive(217.194.124.211) transmit(217.194.124.211) receive(217.194.124.211) transmit(217.194.124.211) receive(217.194.124.211) transmit(217.194.124.211) receive(217.194.124.211) transmit(217.194.124.211) server 217.194.124.211, port 123 stratum 2, precision -14, leap 00, trust 000 refid [217.194.124.211], delay 0.15724, dispersion 0.06766 transmitted 4, in filter 4 reference time: c98e27f9.b2021000 Mon, Feb 26 2007 22:46:01.695 originate timestamp: c98e2849.53839000 Mon, Feb 26 2007 22:47:21.326 transmit timestamp: c98e2807.7825d074 Mon, Feb 26 2007 22:46:15.469 filter delay: 0.16431 0.18951 0.16655 0.15724 0.00000 0.00000 0.00000 0.00000 filter offset: 65.89507 65.86196 65.81776 65.79092 0.000000 0.000000 0.000000 0.000000 delay 0.15724, dispersion 0.06766 offset 65.790921 26 Feb 22:47:21 ntpdate[2596]: step time server 217.194.124.211 offset 65.790921 sec 23) The Debian command "dpkg -L ntp-server" lists all the files in the installed "ntp-server" package. By looking in the names of the files installed by the NTP package, give a command pipeline and its output that shows 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.) ANSWER: # dpkg -L ntp-server | grep "init.d/" /etc/init.d/ntp-server 24) ALN says (p.244) that in some distributions ntpdate is called in the NTP start-up script. Does the Debian/Knoppix/VNS NTP start up script call the ntpdate program? Give a command line that searches for the string "ntpdate" in the ntp-server start-up file. ANSWER: # grep ntpdate /etc/init.d/ntp-server (no output - not present under Debian) 25) Give a command pipeline (and its output) that shows the absolute path of the ntpdate (not ntp-server) package start-up script. (Use a pipeline similar to the one you did above.) ANSWER: # dpkg -L ntpdate | grep "init.d/" /etc/init.d/ntpdate 26) Examine the ntpdate start-up script: What absolute pathname does the ntpdate program use to get its list of time servers at boot time? Show a long listing of this absolute pathname (including the size and modify time). ANSWER: # ls -l /etc/default/ntpdate -rw-r--r-- 1 root root 157 Aug 26 2005 /etc/default/ntpdate 27) Edit the file and add "time.chu.nrc.ca" to the list of NTP servers used by ntpdate (not by ntp-server) at boot time. Keep it as one line, and add the new entry as the first server in the list, ahead of the existing server pool. Give the changed line with the new server added. ANSWER: NTPSERVERS="time.chu.nrc.ca pool.ntp.org" 28) Start your NTP service: 1) do the big change with ntpdate: # /etc/init.d/ntpdate start 2) maintain the time using ntp-server: # /etc/init.d/ntp-server start Is your server date and time now correct? ANSWER: yes 35) Add the tcpdump script contents of dump.txt to the end of your /mnt/hdb1/lab06answers.txt file. ANSWER: (sample output borrowed from one student's answer) Script started on Mon 26 Feb 2007 11:49:20 PM EST yellow:/host# tcpdump -i eth1 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes 23:50:53.586333 IP 1.2.3.1.3874 > 1.2.3.2.www: S 42878209:42878209(0) win 5840 23:50:53.592166 IP 1.2.3.2.www > 1.2.3.1.3874: S 35444485:35444485(0) ack 42878210 win 5792 23:50:53.630713 IP 1.2.3.1.3874 > 1.2.3.2.www: . ack 1 win 2920 23:50:58.564668 arp who-has 1.2.3.2 tell 1.2.3.1 23:50:58.567169 arp reply 1.2.3.2 is-at fe:fd:00:00:42:01 23:51:10.130412 IP 1.2.3.1.3874 > 1.2.3.2.www: P 1:16(15) ack 1 win 2920 23:51:10.134792 IP 1.2.3.2.www > 1.2.3.1.3874: . ack 16 win 2896 23:51:10.565722 IP 1.2.3.1.3874 > 1.2.3.2.www: P 16:17(1) ack 1 win 2920 23:51:10.573810 IP 1.2.3.2.www > 1.2.3.1.3874: . ack 17 win 2896 23:51:10.658569 IP 1.2.3.2.www > 1.2.3.1.3874: P 1:1372(1371) ack 17 win 2896 23:51:10.717353 IP 1.2.3.1.3874 > 1.2.3.2.www: . ack 1372 win 4368 23:51:10.768720 IP 1.2.3.2.www > 1.2.3.1.3874: F 1372:1372(0) ack 17 win 2896 23:51:10.775741 IP 1.2.3.1.3874 > 1.2.3.2.www: F 17:17(0) ack 1373 win 4368 23:51:10.777526 IP 1.2.3.2.www > 1.2.3.1.3874: . ack 18 win 2896 14 packets captured 14 packets received by filter 0 packets dropped by kernel yellow:/host# exit Script done on Mon 26 Feb 2007 11:52:27 PM EST 36) When you type "uml", exactly what file name is found and executed? Give the command that finds which "uml" file will be executed by your shell, and the output of that command. ANSWER: # which uml /usr/local/bin/uml 39) Make sure you can see the backup file saved on the virtual disk: Add the output of the above commands to the lab06answers.txt file. ANSWER: # ls -l /mnt/hdb1/three.tar.bz2 -rw-r--r-- 1 root root 12859 Feb 26 23:58 /mnt/hdb1/three.tar.bz2 # tar tjvf /mnt/hdb1/three.tar.bz2 -rw-r--r-- root/root 15740928 2007-02-26 23:57:11 red -rw-r--r-- root/root 15740928 2007-02-26 23:57:15 green -rw-r--r-- root/root 15740928 2007-02-26 23:57:19 yellow