[clue] [tech] Asterisk in a virtual machine, timer, timing, & real time clock questions
Jim Ockers
ockers at ockers.net
Mon Jul 25 16:59:09 MDT 2011
Hi CLUEbies,
I want to run our office PBX/phone application server in a virtual
machine. The hardware machine running the PBX right now is big, noisy,
ugly and a power hog, and we hate it even though it works fine. I
cloned the PBX (which is based on CentOS 4.3) into a virtual machine and
fired it up.
Unfortunately I forgot to stabilize the system clock, and by the end of
the day the phones were unusuable because the VM system clock/time was
wandering around and even ntpd in the VM refused to work, insisting that
it did not know what time it was.
Does anyone in CLUE-land have experience with asterisk PBX running in a
virtual machine? What are the do's and don'ts for this? Do I really
need a hardware clock or a Zaptel board? I've read some papers like
http://www.usenix.org/publications/login/2007-02/pdfs/chak.pdf which
states "In Asterisk, conferencing requires a reliable clock to mix
audio. Such a timing source is usually featured in the Digium hardware
PCI cards, or one can
choose to use the ztdummy driver. In Linux 2.6, ztdummy defaults to
using the kernel's real-time clock ..."
We have no Digium/Zaptel hardware in the server running the
virtualization software (VMWare, in this case). Even if I did, I
wouldn't want to give the VM access to it, because having
hardware-specific dependencies in a virtual machine kind of defeats one
of the purposes of virtualization.
I've stabilized the system time in the VM by adding "clock=pit" to the
kernel's boot command line and running ntpd in the VM. The VM system
time appears to not diverge from the host time in my unscientific
observations (running "date" once in a while). The ztdummy module is
loaded. Ntpd gets happy (stratum 3) within a couple of minutes after
the VM boots up and stays that way indefinitely, note "stratum=3" below:
[root at pbx ~]# ntpq -c rv
assID=0 status=06a4 leap_none, sync_ntp, 10 events, event_peer/strat_chg,
version="ntpd 4.2.0a at 1.1190-r Mon Feb 21 17:54:52 GMT 2005 (1)"?,
processor="i686", system="Linux/2.6.9-34.ELsmp", leap=00, stratum=3,
precision=-19, rootdelay=124.990, rootdispersion=78.539, peer=2814,
refid=64.6.144.6,
reftime=d1d870bf.b879a283 Mon, Jul 25 2011 16:46:23.720, poll=10,
clock=0xd1d87161.073cb3e5, state=4, offset=0.569, frequency=-16.721,
noise=4.704, jitter=2.104, stability=12.984
[root at pbx ~]# ntpq -np
remote refid st t when poll reach delay offset
jitter
==============================================================================
50.28.8.223 .STEP. 16 u - 1024 0 0.000 0.000
4000.00
50.28.8.224 .STEP. 16 u - 1024 0 0.000 0.000
4000.00
*64.6.144.6 128.252.19.1 2 u 317 1024 377 98.730 0.569
2.104
That offset is nice and small, a half second, which is close enough I think.
Since it's a business phone system, they don't want another disruption
while the phones go off into the weeds for an afternoon to the point
where we can no longer make & receive phone calls, and then have to
revert back to the hardware PBX server anyway.
Is this [virtualizing Asterisk] even possible without /dev/zap or a
hardware real time clock or timer hardware? What do I need to do to
ensure that this will work properly this time? Any suggestions?
Thanks,
Jim
--
Jim Ockers, P.Eng. (ockers at ockers.net)
Contact info: http://www.ockers.net/msi.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue/attachments/20110725/2be17838/attachment.html
More information about the clue
mailing list