[PLUG] ntpdate
M. Edward (Ed) Borasky
znmeb at cesmail.net
Fri Dec 16 17:35:01 UTC 2005
What distro are you using? Gentoo more or less automatically configures
ntp, and IIRC Debian does as well.
By the way, if you have a full NAT network, it's probably not necessary
to have a time server on your network at all -- just synchronize
everything to a public time server. However, if your network is isolated
from the Internet for security reasons, you'll need to have a server.
Here's the configuration info from Gentoo -- not sure how generally
applicable it is:
http://www.gentoo.org/doc/en/home-router-howto.xml
Time Server
Keeping your system time correct is essential in maintaining a healthy
system. One of the most common ways of accomplishing this is with the
Network Time Protocol (NTP) and the ntp package (which provides
implementations for both server and client).
Many people run ntp clients on their computers. Obviously, the more
clients in the world, the larger the load the ntp servers need to
shoulder. In environments like home networks though, we can help keep
the load down on public servers while still providing the proper time to
all our computers. As an added bonus, our private updates will be a lot
faster for the clients too! All we have to do is run a ntp server on our
router that synchronizes itself with the public internet servers while
providing the time to the rest of the computers in the network. To get
started, simply emerge ntp on the router.
Code Listing 6.3: Setting up the NTP server
# nano /etc/conf.d/ntp-client
Customize if you wish but the defaults should be fine
# rc-update add ntp-client default
# nano /etc/ntp.conf
Add the follwing lines:
restrict default ignore
restrict 192.168.0.0 mask 255.255.255.0 notrust nomodify notrap
These will allow only ntp clients with an IP
address in the 192.168.0.xxx range to use your ntp server
# nano /etc/conf.d/ntpd
Customize if you wish but the defaults should be fine
# rc-update add ntpd default
# /etc/init.d/ntp-client start
# /etc/init.d/ntpd start
*Note: * You should make sure that you allow inbound and outbound
communication on the ntp port (123/udp) when setting up the server. The
client just needs outbound access on port 123 over udp.
Now, on your clients, have them emerge ntp also. However, we will just
run the ntp client so setup is a lot simpler.
Code Listing 6.4: Setting up a NTP client
# nano /etc/conf.d/ntp-client
Change the 'pool.ntp.org' server in the NTPCLIENT_OPTS variable to '192.168.0.1'
# rc-update add ntp-client default
# /etc/init.d/ntp-client start
dan at fiddlers-green.info wrote:
>All,
>
>I've been struggling with an ntpdate and ntpd problem for about two days. I'm
>attempting to use ntpd on my gateway as the "master" time server for my
>network. However, I can't even get ntpdate to work from the command line for
>the various ntp servers I have in my ntp.conf file. Every server seems to work
>fine in debug mode (-d option) but fails with the error " no server suitable
>for synchronization found". Everything I've found on the web indicates this
>message shows up when there is a network connection problem. I've verified with
>tcpdump that messages are getting back and forth, and the "-d" option shows the
>following:
>
>
>[root at osiligarth ~]# ntpdate -d hydrogen.cert.ucr.edu
>16 Dec 00:35:54 ntpdate[19791]: ntpdate 4.2.0a at 1.1190-r Mon Feb 21 17:54:53 GMT
>2005 (1)
>Looking for host hydrogen.cert.ucr.edu and service ntp
>host found : hydrogen.cert.ucr.edu
>transmit(138.23.180.126)
>receive(138.23.180.126)
>transmit(138.23.180.126)
>receive(138.23.180.126)
>transmit(138.23.180.126)
>receive(138.23.180.126)
>transmit(138.23.180.126)
>receive(138.23.180.126)
>transmit(138.23.180.126)
>server 138.23.180.126, port 123
>stratum 2, precision -20, leap 00, trust 000
>refid [138.23.180.126], delay 0.06934, dispersion 0.00040
>transmitted 4, in filter 4
>reference time: c74cf912.f1e15ca6 Fri, Dec 16 2005 0:28:02.944
>originate timestamp: c74cfaf1.2dc7de50 Fri, Dec 16 2005 0:36:01.178
>transmit timestamp: c74cfaeb.5ec2699c Fri, Dec 16 2005 0:35:55.370
>filter delay: 0.07294 0.07092 0.07130 0.06934
> 0.00000 0.00000 0.00000 0.00000
>filter offset: 5.787980 5.787201 5.787066 5.786798
> 0.000000 0.000000 0.000000 0.000000
>delay 0.06934, dispersion 0.00040
>offset 5.786798
>
>16 Dec 00:35:55 ntpdate[19791]: step time server 138.23.180.126 offset 5.786798
>sec
>
>[root at osiligarth ~]# ntpdate -v hydrogen.cert.ucr.edu
>16 Dec 00:39:08 ntpdate[23230]: ntpdate 4.2.0a at 1.1190-r Mon Feb 21 17:54:53 GMT
>2005 (1)
>16 Dec 00:39:12 ntpdate[23230]: no server suitable for synchronization found
>
>I went ahead with starting ntpd yesterday and just letting it run to see if it
>would eventually synchronize, but it failed to sync with any servers even after
>24 hours. I'm hoping if I can get ntpdate to work, I can get ntpd to work
>afterwards.Anyhelp would be appreciated.
>
>thanks,
>Dan H.
>
>----------------------------------------------------------------
>This message was sent using IMP, the Internet Messaging Program.
>
>_______________________________________________
>PLUG mailing list
>PLUG at lists.pdxlinux.org
>http://lists.pdxlinux.org/mailman/listinfo/plug
>
>
>
--
M. Edward (Ed) Borasky
http://linuxcapacityplanning.com
More information about the PLUG
mailing list