Ntp
year 8 month Thursday
17:34
CentOS 7 Configuring the local time zone
#用tzselect配置时区和time Zone
[Email protected] asia]# /usr/bin/tzselect
Please identify a, so, time zone rules can be set correctly.
Please select a continent or ocean.
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
Pacific Ocean
One) None-i want to specify the time zone using the Posix TZ format.
#选择时区
#? One
Please enter the desired value of the TZ environment variable.
For example, GST-10 is a zone named GST, which is a hours ahead (east) of UTC.
#键入CST +0 China time zone
#UTC为国际时区
Cst+0
Awk:cmd. Line:5: Warning:escape sequence ' \. ' treated as plain '. '
?
The following information has been given:
?
???? tz= ' cst+0 '
?
Therefore tz= ' cst+0 ' would be used.
Local time is now:???? Thu 18:13:06 CST 2016.
Universal time is now:???? Thu 18:13:06 UTC 2016.
is the above information OK?
1) Yes
2) No
#? 1
?
You can make the permanent to yourself by appending the line
???? tz= ' cst+0 '; export TZ
To the file '. Profiles ' in your home directory; Then logs out and logs in again.
?
Here is the TZ value again, this time
can use The/usr/bin/tzselect command in shell scripts:
Cst+0
[Email protected] asia]# /usr/bin/tzselect
Please identify a, so, time zone rules can be set correctly.
Please select a continent or ocean.
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
Pacific Ocean
One) None-i want to specify the time zone using the Posix TZ format.
#? 5
Please select a country.
1) Afghanistan???????? ) Israel???????? Palestine)
2) Armenia???????? Japan???????? Philippines)
3) Azerbaijan???????? Jordan???????? Notoginseng) Qatar
4) Bahrain???????? ) Kazakhstan???? Russia)
5) Bangladesh???????? Korea (north)???? ) Saudi Arabia
6) Bhutan???????? ) Korea (south)???? Singapore)
7) Brunei???????? ) Kuwait???????? ) Sri Lanka
8) Cambodia???????? ) Kyrgyzstan???? ) Syria
9) China???????? ) Laos???????? Taiwan)
) Cyprus???????? Lebanon???????? Tajikistan)
) East Timor???????? ) Macau???????? Thailand)
) Georgia???????? ) Malaysia???????? (Turkmenistan)
) Hong Kong???????? ) Mongolia???????? ) Arab Emirates
) India???????? Myanmar (Burma)???? Uzbekistan)
Indonesia???????? ) Nepal???????? ) Vietnam
)???????? ) Oman???????? Yemen)
) Iraq???????? Pakistan)
#? 9
Please select one of the following time zone regions.
1) Beijing time
2) Xinjiang time
#? 1
?
The following information has been given:
?
???? China
???? Beijing time
?
Therefore tz= ' Asia/shanghai ' would be used.
Local time is now:???? Fri 02:13:32 CST 2016.
Universal time is now:???? Thu 18:13:32 UTC 2016.
is the above information OK?
1) Yes
2) No
#? 1
?
You can make the permanent to yourself by appending the line
???? tz= ' Asia/shanghai '; Export TZ
To the file '. Profiles ' in your home directory; Then logs out and logs in again.
?
Here is the TZ value again, this time
can use The/usr/bin/tzselect command in shell scripts:
Asia/shanghai
[[email protected] asia]# date
Thu 18:13:40 CST 2016
[Email protected] asia]# clock
Thu 06:13:44 PM CST-0.396667 seconds
[Email protected] asia]#
#加入全局环境变量
Vi/etc/profile
Export tz= ' cst+0 '
?
#硬件和系统时间同步 (optional)
Date-s 14:20:50
Hwclock? --show or
Clock? --show
Set Hardware time
Hwclock--set--date= "06/18/14 14:55" (Month/day/year: minutes: seconds) or # clock--set--date= "06/18/14 14:55" (Month/day/year: minutes: seconds)
The hardware clock is synchronized with the system clock:
# Hwclock--hctosys or # clock--hctosys? HC represents the hardware time, SYS represents the system time, i.e. the system clock is synchronized with the hardware clock
system clock and Hardware clock synchronization:
# Hwclock--SYSTOHC or # clock--SYSTOHC? Synchronize the hardware clock with the system clock
Modify the configuration file to modify the time zone
?
?
?
CentOS 6 build LAN NTP server
######## #服务器: #########
One, time server-side configuration
Modifying a configuration file vi/etc/ntp.conf
??
1. Client Selection
1) Allow any client
Restrict default nomodify
2) Allow specific clients
Restrict 192.168.18.0 mask 255.255.255.0 nomodify
Server 192.168.0.84
* Two Select one
??
2. Specify a time server
1) Specify a specific time server and comment out the default server server
Server time-b.nist.gov
2) Open local time server, when the above external network time-b.nist.gov failure, the intranet acts as a time server.
Server 127.127.1.0 # Local clock
Fudge 127.127.1.0 Stratum 10
3. Restart Time service
Service NTPD Restart
4. Set firewall port according to actual requirement
UDP 123
######## #客户端 #########
One, the Linux client
1, the Linux client modifies the configuration file, comment out other time servers, specify the intranet time server, restart OK.
Vim/etc/ntp.conf
Server x.x.x.x
2, the Client check
Ntpq-p querying the parent time server
Ntpstat Query Status
Ntpdate
CentOS7 configuration time and CentOS6 building LAN NTP