If all I wanted to do was fix the clock on a VM guest, I would have stopped running ntp on the guest and left it running on the underlying physical host. My requirement was to use the ip address of my VM guest as a time source.
# grep -m1 constant_tsc /proc/cpuinfo flags : fpu vme de pse tsc blah blah blah... constant_tsc # cat /sys/devices/system/clocksource/clocksource0/current_clocksource tsc
# cat /sys/devices/system/clocksource/clocksource0/current_clocksource kvm-clock # dmesg | grep clock ... [ 0.056001] kvm-clock: cpu 11, msr 0:11975701, secondary cpu clock [ 0.388036] Switching to clocksource kvm-clock [ 0.637349] rtc_cmos 00:01: setting system clock to 2012-01-21 19:18:21 UTC
iptables -t nat -A PREROUTING -i eth0 -p udp -m udp --dport 123 -j DNAT --to-destination $HOST iptables -t nat -A POSTROUTING -o eth0 -p udp -m udp --dport 123 -j MASQUERADE
sysctl net.ipv4.conf.eth0.forwarding=1 sysctl net.ipv4.conf.eth1.forwarding=1
You should really limit forwarding to ntp for your source and destination too. Default policies of ACCEPT for iptables are bad if you don’t have an explicit rule to drop everything not handled by a higher rule.
# forwarding for ntp requests to your ntp server iptables -A FORWARD -p udp -d 10.9.8.7/32 --dport 123 -j ACCEPT # forwarding for responses from your ntp server iptables -A FORWARD -p udp -d 192.168.1.0/24 --dport 123 -j ACCEPT