Setting time in jails

Hi guys,

I am running FreeBSD 8.1 with two jails, but for some reason the clocks are out of sync, by a day in one case. While looking at options I found advice that I must use OpenNTPd for jails.

I have installed OpenNTPd as follows on all clients:

/etc/rc.conf
Code:
openntpd_enable="YES"

/usr/local/etc/ntpd.conf
Code:
server  nist1-ny.ustiming.org

/etc/ipfw.rules
Code:
$IPF 40 allow udp from any to any 123 in

I first stopped ntpd but when I start OpenNTPd on either of the jails I get this:

# /usr/local/etc/rc.d/openntpd start
Code:
Starting openntpd.
reset adjtime failed: Operation not permitted
nb. There is no error posted when I start it on the host.

The status shows normal on all clients:
# /usr/local/etc/rc.d/openntpd status
Code:
openntpd is running as pid xxxxx xxxxx xxxxx.

When I stop it I get this on all the clients:
# /usr/local/etc/rc.d/openntpd stop
Code:
Stopping openntpd.
kill: xxxxx: No such process
kill: xxxxx: No such process
nb. These pids are shown in top as ntpd prior to stopping it.

I get this from ntpdate on all clients:
# ntpdate -d
Code:
13 Apr 19:50:57 ntpdate[90757]: ntpdate 4.2.4p5-a (1)
13 Apr 19:50:57 ntpdate[90757]: no servers can be used, exiting
nb. the dates shown are still out of sync.

I have confirmed the port is opened to the host and clients:
# sockstat -4 -p 123
Code:
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
_ntp     ntpd       xxxxx 4  udp4   xxx.xxx.xxx.xx1:17158 64.90.182.55:123
_ntp     ntpd       xxxxx 4  udp4   xxx.xxx.xxx.xx2:54007 64.90.182.55:123
_ntp     ntpd       xxxxx 4  udp4   xxx.xxx.xxx.xx3:10168 64.90.182.55:123


This is the only thing new in /var/log/messages:
Code:
dispatch_imsg in main: pipe closed
It appears in all clients logs.

Am I missing something? Ideally I want to use the host as a local time server and update the jails directly. but for now I just need them all syncing to the same source.
 
Set the clock correctly on the host. Make sure the timezones are correctly configured in the jails. Jails get their time from the host, you can't set it.
 
SirDice said:
Set the clock correctly on the host. Make sure the timezones are correctly configured in the jails. Jails get their time from the host, you can't set it.

Well that was a little too easy!

Thank you!

For anyone else this page will help
 
Back
Top