Monthly Archives: February 2014

Puppet template of a nested array

module::hosts: – ipaddress: 1.1.1.1 names: one.com – ipaddress: 2.2.2.2 names: – two.zero.com – two.one.com – two.two.com ERB template:

<% @hosts.each do |host| -%>
<%= host['ipaddress'] %> <% host['names'].each do |val| -%><%= val+' ' %><% end %>
<% end -%>
]]>

NTP common issues

# tail -f /var/log/messages Jan 31 10:09:23 centos6test01 kernel: set_rtc_mmss: can’t update from 55 to 9 It means it can’t update time. Test:

hwclock;date
Do sync:
ntpdate -u ntpserver
Sync hwclock to current system time
hwclock --systohc --localtime
To test ntp is properly working: NTP server and client: – ntpq then type pe – or ntpq -p On NTP server, you should see connection to its parent NTP. It means your NTP server usually doesn’t have stratum 0 which is the highest. Example:
# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 time.apple.com  17.168.198.149   2 u   58   64   17  203.133    1.058   0.190
If you create a stand alone NTP server, refer to this article: http://serverfault.com/questions/150207/hosting-an-ntp-server-on-a-standalone-network If the NTP server still doesn’t look good. Try to check:
NTP server:
"/etc/ntp.conf"
 - restrict x.x.x.0 mask 255.255.255.0 nomodify notrap
 - server time.apple.com
"iptables":
 - chain OUTPUT { proto ( udp ) sport ntp ACCEPT; }
 - chain INPUT { proto ( udp ) dport ntp ACCEPT; }
Check if the UDP port is listening:
# netstat -tulpn
Now test NTP connection from the client to the server:
nmap -p 123 -sU -P0 ntpserver
Check the client:
NTP client:
"/etc/ntp.conf"
 - server ntpserver
 - remove "restrict default ignore" or "add restrict ntpserver" because ntp needs to talk to each other
"iptables":
 - chain OUTPUT { proto ( udp ) dport ntp destination ntpserver ACCEPT; }
 - chain INPUT { proto ( udp ) sport ntp source ntpserver ACCEPT; }
If timed out persist, like this “timed out, nothing received ***Request timed out”, check or comment out this line: “restrict default ignore” Now check the client: #ntpq -p and make sure it’s not stratum 16. ]]>