Home

Search this site:
 

Horshack’s
very
own site

 

This is Bavaria, Germany!
You will find links to Perl,
bootdisks for system administration,
a lot of Linux,
Windows administration
and some personal belongings.
Linux: networking

Linux: networking

Table of contents:

 NTPd (time syncronizing a whole network with Linux and NT)

I wanted simply a Linux-Timeserver in my LAN. But the LAN has only a dial-up connection to the internet which costs a lot of money. My WindowsNT-hosts also shall have syncronized time. I took this approach:

1a. Setting time immediately with netdate:

#!/bin/sh
# file: ~root/bin/timesync
#
echo "Syncronizing time with NTP-hosts"
# -l: max sync time is 180 sec
# -v: show groups
# netdate need port 37/udp, firewalling
# get servers from:
# http://www.eecis.udel.edu/~mills/ntp/clock1.htm
/usr/sbin/netdate -l 3600 tcp \
ts2.univie.ac.at \
ts1.univie.ac.at \
ntp.lth.se
hwclock -w

1b. Setting time immediately with ntpdate

# ntpdate ntp1.ptb.de
9 Jan 21:35:52 ntpdate[31311]: step time server 192.53.103.103 offset -3601.519274 sec!/

2. Compiling and installing NTP on Linux

This is the configfile:

root@gatekeeper:/etc > cat /etc/ntp.conf
# /etc/ntp.conf
# do not get time from other ntp-Servers:
# disable ntp
driftfile /etc/ntp.drift
# get time from these servers
server ntp2.ptb.de
server ntp1.belbone.be
server clock.fmt.he.net
server ntp.globe.cz
server ntp.tuxfamily.net

You do not need to create the file /etc/ntp.drift
Start ntpd with /usr/local/bin/ntpd
Port 123/UDP must be free to the local net so that Windows-machines can get time from Linux

 

3. Install ntptime on your WindowsNT-Server

There is one which is the best: ntptime.exe at http://home.att.net/~Tom.Horsley
Simply believe me. It runs as service and creates a good logfile. Only installation has to be made with regedit, but this is nothing you should take care about.

If WindowsNT-Server is syncronized your NT-Workstations can get their time with "net time \\server /set /yes" in a loginscript.

 

 Simply getting the right time two times a day

Life is so simple sometimes. You want to have the right time on your machine. Simply syncronize it with other computers in the net. You need "netdate" for this on your Linuxmachine (find the rpm in http://www.rpmfind.net and look for netdate).

Write this scripts /root/bin/timesync:

#!/bin/sh
# file: ~root/bin/timesync
#
echo "Syncronizing time with NTP-hosts"
# -l: max sync time is 180 sec
# -v: show groups
# netdate needs port 37/udp, firewalling
netdate -l 180 \
ntp0.fau.de \
time.ien.it
# set the hardware clock to this time
hwclock -w
 

Let the script run two times a day by cron:

# crontab -e
00 3,21 * * * (/root/bin/timesync.sh) >/dev/null 2>&1
 

 

 Mirroring an FTP-site with mirror

If you want to mirror a larger FTP-site or want it to mirror on a regular basis do it with a good package like "mirror" (look for a ready .rpm to install it). I don't like to do that with ncftp which is perfect for command-line things because I have some trouble with it when it's getting _reeeeaal_ big (how to handle zero-bytefiles, Defaults when answering questions). Ok, I suggest: ncftp for manual things, mirror for automatic things.

First create a packagefile in your homedirectory: ~/.mirror.txt. Here is mine (officical documentation is here):

# Packagefile for mirror: ~/.mirror.txt
package=defaults
        comment=Carpictures
        # ls -lR does not work on this server
        recurse_hard=true
        # dont's get files only because they have another timestamp
        get_newer=false
        # but get them always when their filesize is different
        get_size_change=true
        # never delete local files
        do_deletes=false
        # try to create a local timestamp like the remote one
        force_times=yes

        mail_to=me@localhost

package=ford_pictures
        site=remote.juhei.de
        remote_user=lippmann
        remote_password=secret

        remote_dir=/cars/pics/ford/
        local_dir=/home/horshack/pics/cars/ford

        mail_subject=Mirror ford_pictures

package=bmw_pictures
        site=bmw.juhei.org
        remote_user=bmwfreex
        remote_password=secret2

        remote_dir=/pub/carpics/bmw/
        local_dir=/home/horshack/pics/cars/bmw

        mail_subject=Mirror bmw_pictures
 
 

Call mirror like this:



Last modified:
09.01.2005 21:40
Impressum
Wozu Witze ausdenken? Das Leben schreibt sie selbst:
Das haben wir jetzt 40 Jahre so gemacht, warum sollten wir das ändern?
Why inventing jokes? Real life does a better job:
We are doing it this way for 40 years, why should we change it?