Go Back   Linux CentOS, Control Panel, Hot girl, TOP 10 GOOGLE, Server - System - Manager - CentOS, Operation System, SEO, VBB, HACKING and SECURITY - Rao vặt, tuyển dụng, Thiet ke website > Dành cho webmaster > Server Manager

Hack gunz.2it.in mới update ngày 2/3/2010 (test by Admin)
Hack map trong Dota - WarCraft 3 (da test ngay 27/01/2010)
Hack gg để chơi map dota cho war 1.23 va 1.24 - vẫn xài tốt
Hướng dẫn Hack gold member tại quán net để mang về nhà
hack map dota cho war3 ver 1.24c va 1.24d, co the chuyen tien
crack windows 7 all version (using activators)
hack cf 1052, hack cf 1053, hack cf 1054 ngay 15/02/2010

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 26-09-2008
Lovelinux's Avatar
Super Moderator
 
Join Date: Jun 2008
Posts: 251
Thanks: 24
Thanked 50 Times in 28 Posts
Default NTP (Network Time Protocol) Server on CentOS 5

Step 1
Code:
#yum install ntp
or download ntp rpmpkg
Step 2
Code:
# crontab -e
*/15 * * * * ntpdate 210.72.145.44
Step 3
Code:
# vi /etc/ntp.conf
(add or replace the text as follows)
server 210.72.145.44 prefer
(set the default source is from "TIME OF THE NET SERVER IN CHINA")
server 218.21.130.42
(an other source server)
restrict 0.0.0.0 mask 0.0.0.0 nomodify
(allow all client)
Step 4
Code:
# chkconfig ntpd on
# vi /etc/sysconfig/ntpd
 SYNC_HWCLOCK=yes
(write the sync time to CMOS)
Final
Code:
# pgrep ntpd
(checking the ntpd process ID)
# netstat -ntlup
(checking the sync status)
# ntpq -p
(checking the port’s status)
configure the firewall rule, make sure the UDP:123 is accept.
#service ntpd start
 (start the ntp server)
Client may get the ntpserver time after 5~10 min.
 **************************************************
Elvis Woo NTP (Network Time Protocol) Server on CentOS 5
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 26-09-2008
Lovelinux's Avatar
Super Moderator
 
Join Date: Jun 2008
Posts: 251
Thanks: 24
Thanked 50 Times in 28 Posts
Default Đồng Hồ Trên Linux - Network Time Protocol ( NTP )

Chỉnh đồng hồ

Câu lệnh date được dùng để truy cập và thiết lập đồng hồ hệ thống

[root@centos ~]# date
Mon Jun 23 16:47:43 ICT 2008

Chúng ta có thể thiết lập định dạng thời gian cho câu lệnh date với tùy chọn "+"

[root@centos ~]# date '+%D %T'
06/23/08 16:48:19
[root@centos ~]# date '+%H:%M:%S %d/%m/%y'
16:49:16 23/06/08

Ngoài ra, ta cũng có thể hiển thị các ngày khác với ngày hiện thời

[root@centos ~]# date -d 'yesterday'
Sun Jun 22 16:49:41 ICT 2008
[root@centos ~]# date -d '3 months ago'
Sun Mar 23 16:50:02 ICT 2008

date cũng có thể được dùng để hiển thị ngày cuủ một file cụ thể:

[root@centos ~]# date -r /etc/ntp.conf
Sat Nov 10 19:34:05 ICT 2007

hwclock là câu lệnh dùng để kiểm soat đông hồ phần cứng do BIOS quản lư. Khi dùng date để thay đổi giờ th́ đồng hồ phần cứng sẽ không bị ảnh hưởng, do đó tại lần khởi động máy kế tiếp, hệ thống sẽ lấy thông tin thời gian từ đồng hồ phần cứng. Để dùng câu lệnh hwclock, ta phải dùng account root.

foo:~ # hwclock
Fri 27 Jun 2003 14:01:24 SAST -0.462635 seconds

Đồng hồ phần cứng có thể được thiết lập theo thời gian của vùng bạn ở hay theo UTC. Khi hệ thống khởi động, đồng hồ hệ thống sẽ lấy giá trị từ đông hồ phần cứng bằng một trong hai câu lệnh sau:

hwclock --hctosys --utc # BIOS clock is UTC
hwclock --hctosys --localtime # BIOS clock is local time

Thiết lập giờ hiện tại và giờ hệ thống (BIOS)

hwclock –-hctosys // set đồng hồ hệ thống (BIOS) cho đồng hồ hiện tại
hwclock --systohc // ngược với hctosys

Tùy theo phiên bản Linux, ta cần thay đổi một trong những file sau để thiết lập thời gian, t́m ra timezone của hệ thống.

/etc/sysconfig/clock # Redhat, newer SuSE – HWCLOCK value
/etc/rc.config # SuSE – GMT value
/etc/defaults/rcS # Debian – UTC value

/etc/localtime là một symbolic link hoặc là một bản sao của /usr/share/zoneinfo. Điều này được thiết lập lúc cài đặt hệ thống.

Câu lệnh zic dùng để thiết lập nội dung file /etc/localtime. Ví dụ

% zic -l "Africa/Johannesburg"

Network Time Protocol (NTP)

The Network Time Protocol (NTP) is a protocol used to help synchronize your Linux system's clock with an accurate time source. There are that allow the general public to synchronize with them.

* Stratum 1: NTP sites using an atomic clock for timing.
* Stratum 2: NTP sites with slightly less accurate time sources.

NTP cho phép đồng bộ đồng hồ của hệ thống với UTC (Universal Coordinate Time) thông qua một máy chủ thời gian. Cách dùng NTP đơn giản nhất là truy vấn thời gian của máy chủ bằng câu lệnh ntpdate. Câu lệnh này sẽ lấy thời gian từ máy chủ và cập nhật đồng hồ hệ thống.

Kiểm tra, cài đặt NTP:

Kiểm tra xem ntp có chạy không:

$ ps -ef | grep ntp
root 3275 3112 0 16:07 pts/2 00:00:00 vi /etc/ntp.conf
ntp 3557 1 0 17:27 ? 00:00:00 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
root 3563 3402 0 17:27 pts/3 00:00:00 grep ntp

Kiểm tra xem trên Server đă cài ntp chưa:

[root@centos ~]# rpm -qa | grep ntp
chkfontpath-1.10.1-1.1
ntp-4.2.2p1-7.el5

Nếu chưa có th́ cài nó lên.

# yum -y install ntp

Sau đó cấu h́nh cho ntpd start khi hệ thống khởi động:

$ chkconfig ntpd on

Làm việc với ntpd bằng các lệnh:

$ service ntpd stop
$ service ntpd start
$ service ntpd restart
$ service ntpd status

File cấu h́nh mặc định:

$ /etc/ntp.conf
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys

Kiểm tra ntp làm việc

[root@centos ~]# ntpq -p

remote refid st t when poll reach delay offset jitter
=================================================
ips61.reverse.n 132.239.1.6 2 u 28 64 3 10.472 148790. 8.879
LOCAL(0) .LOCL. 10 l 26 64 3 0.000 0.000 0.001

Cập nhật thời gian tại một server khác:

ntpdate –q <địa chỉ time_server>
Welcome to my blog: ??ng H? Trên Linux - Network Time Protocol ( NTP )
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +8. The time now is 08:03 AM.


© Diễn đàn HackingArt (HA) được xây dựng và phát triển bởi các thành viên.
+ Diễn đàn HackingArt là nơi trao đổi của các webmaster chuyên nghiệp.