You are not logged in.

#1 2007-11-04 07:22:12

jaideep_jdof
Member
From: Delhi, India
Registered: 2006-06-05
Posts: 311

NTP issue

I want to set NTPD so that it update my date and time on my system, I am living in India and have configure ntp.conf as follows:

# NOTES:
#  - you should only have to update the server line below
#  - if you start getting lines like 'restrict' and 'fudge'
#    and you didnt add them, AND you run dhcpcd on your
#    network interfaces, be sure to add '-Y -N' to the
#    dhcpcd_ethX variables in /etc/conf.d/net

# Name of the servers ntpd should sync with
# Please respect the access policy as stated by the responsible person.
#server        ntp.example.tld        iburst

server pool.ntp.org
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
##
# A list of available servers can be found here:
# http://www.pool.ntp.org/
# http://www.pool.ntp.org/#use
# A good way to get servers for your machine is:
# netselect -s 3 pool.ntp.org
##

# you should not need to modify the following paths
driftfile    /var/lib/ntp/ntp.drift

#server ntplocal.example.com prefer 
#server timeserver.example.org 

# Warning: Using default NTP settings will leave your NTP
# server accessible to all hosts on the Internet.

# If you want to deny all machines (including your own)
# from accessing the NTP server, uncomment:
#restrict default ignore


# To deny other machines from changing the
# configuration but allow localhost:
restrict default nomodify nopeer
restrict 127.0.0.1


# To allow machines within your network to synchronize
# their clocks with your server, but ensure they are
# not allowed to configure the server or used as peers
# to synchronize against, uncomment this line.
#
#restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap

And My rc.conf is:

#
# /etc/rc.conf - Main Configuration for Arch Linux
#

#
# -----------------------------------------------------------------------
# LOCALIZATION
# -----------------------------------------------------------------------
#
# LOCALE: available languages can be listed with the 'locale -a' command
# HARDWARECLOCK: set to "UTC" or "localtime"
# TIMEZONE: timezones are found in /usr/share/zoneinfo
# KEYMAP: keymaps are found in /usr/share/kbd/keymaps
# CONSOLEFONT: found in /usr/share/kbd/consolefonts (only needed for non-US)
# CONSOLEMAP: found in /usr/share/kbd/consoletrans
# USECOLOR: use ANSI color sequences in startup messages
#
LOCALE="en_US.utf8"
HARDWARECLOCK="UTC"
TIMEZONE="Asia/Calcutta"
KEYMAP="us"
CONSOLEFONT=
CONSOLEMAP=
USECOLOR="yes"

#
# -----------------------------------------------------------------------
# HARDWARE
# -----------------------------------------------------------------------
#
# Scan hardware and load required modules at bootup
MOD_AUTOLOAD="yes"
# Module Blacklist - modules in this list will never be loaded by udev
MOD_BLACKLIST=()
#
# Modules to load at boot-up (in this order)
#   - prefix a module with a ! to blacklist it
#
MODULES=(8139cp 8139too mii ipw2200 ac97_bus snd-mixer-oss snd-pcm-oss snd-page-alloc snd-pcm snd-timer snd snd-ac97-codec snd-intel8x0 snd-intel8x0m soundcore acpi-cpufreq)
# Scan for LVM volume groups at startup, required if you use LVM
USELVM="no"

#
# -----------------------------------------------------------------------
# NETWORKING
# -----------------------------------------------------------------------
#
HOSTNAME="localhost"
#
# Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available
# interfaces.
#
# Interfaces to start at boot-up (in this order)
# Declare each interface then list in INTERFACES
#   - prefix an entry in INTERFACES with a ! to disable it
#   - no hyphens in your interface names - Bash doesn't like it
#
# Note: to use DHCP, set your interface to be "dhcp" (eth0="dhcp")
#
lo="lo 127.0.0.1"
eth0="eth0 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.0.255"
INTERFACES=(lo eth0)
#
# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
#   - prefix an entry in ROUTES with a ! to disable it
#
gateway="default gw 192.168.1.1"
ROUTES=(gateway)
#
# Enable these network profiles at boot-up.  These are only useful
# if you happen to need multiple network configurations (ie, laptop users)
#   - set to 'menu' to present a menu during boot-up (dialog package required)
#   - prefix an entry with a ! to disable it
#
# Network profiles are found in /etc/network-profiles
#
#NET_PROFILES=(main)

#
# -----------------------------------------------------------------------
# DAEMONS
# -----------------------------------------------------------------------
#
# Daemons to start at boot-up (in this order)
#   - prefix a daemon with a ! to disable it
#   - prefix a daemon with a @ to start it up in the background
#
DAEMONS=(syslog-ng network !netfs crond dbus hal ntpd alsa cpufreq slim)


# End of file

BUt ntp is not updating my date and time.

Offline

#2 2007-11-04 10:47:34

a1ex
Member
From: Germany
Registered: 2007-02-16
Posts: 92

Re: NTP issue

ntpd corrects the time in very small steps you wont even notice. Try to run ntpd -s which will correct the time immediately if away more than 180 seconds or something like that.

Offline

#3 2007-11-05 06:45:33

jaideep_jdof
Member
From: Delhi, India
Registered: 2006-06-05
Posts: 311

Re: NTP issue

ntpd -s

does nothing.

Offline

#4 2007-11-05 06:49:35

luca
Member
From: Rome
Registered: 2005-10-30
Posts: 280

Re: NTP issue

You can also use ntpdate instead of ntpd.
The configuration file is /etc/conf.d/ntp-client.conf
Add ntpdate daemon in your rc.conf file

Offline

#5 2007-11-05 07:20:31

jaideep_jdof
Member
From: Delhi, India
Registered: 2006-06-05
Posts: 311

Re: NTP issue

I added ntpdate in rc.conf and removed ntpd, but still time is not updating but date is set fine, this is my /etc/conf.d/ntp-client.conf:

# change this to a server closer to your location
NTP_CLIENT_SERVER="asia.pool.ntp.org"

# client options
NTP_CLIENT_OPTION="-b -u"

# timeout for the ntp-client
NTPCLIENT_TIMEOUT=10

Offline

#6 2007-11-05 14:37:50

luca
Member
From: Rome
Registered: 2005-10-30
Posts: 280

Re: NTP issue

What is the output of this command (as root):

ntpdate asia.pool.ntp.org

Maybe you can try to change the server

Last edited by luca (2007-11-05 14:38:21)

Offline

#7 2007-11-05 15:04:35

jaideep_jdof
Member
From: Delhi, India
Registered: 2006-06-05
Posts: 311

Re: NTP issue

This is the output:

 5 Nov 15:04:14 ntpdate[6787]: adjust time server 58.73.137.250 offset 0.026348 sec

Offline

#8 2007-11-05 15:05:51

jaideep_jdof
Member
From: Delhi, India
Registered: 2006-06-05
Posts: 311

Re: NTP issue

Date is correct but time is 5hr 40 min approx behind.

Offline

#9 2007-11-05 15:31:58

luca
Member
From: Rome
Registered: 2005-10-30
Posts: 280

Re: NTP issue

Try to change

HARDWARECLOCK="UTC"

to

HARDWARECLOCK="localtime"

and run the command again.

Last edited by luca (2007-11-05 15:32:59)

Offline

#10 2007-11-05 15:41:31

jaideep_jdof
Member
From: Delhi, India
Registered: 2006-06-05
Posts: 311

Re: NTP issue

this is the output after the change:

 5 Nov 15:39:27 ntpdate[7506]: adjust time server 211.51.221.196 offset 0.182891 sec

Offline

#11 2007-11-05 15:52:57

luca
Member
From: Rome
Registered: 2005-10-30
Posts: 280

Re: NTP issue

Make a system upgrade, there is a new updated package named tzdata
Sorry, I forgot to say that after the change in rc.conf (from UTC to localtime)
you must reboot the pc

Last edited by luca (2007-11-05 15:54:11)

Offline

#12 2007-11-05 16:04:27

jaideep_jdof
Member
From: Delhi, India
Registered: 2006-06-05
Posts: 311

Re: NTP issue

Yahoo the time is now correct, thanks, so should i change the localtime in rc.conf to UTC

Offline

#13 2007-11-05 16:11:34

luca
Member
From: Rome
Registered: 2005-10-30
Posts: 280

Re: NTP issue

If the time is correct "localtime" is the right option

Offline

Board footer

Powered by FluxBB