UnixGuys

Got a little geek in you?
Subscribe

Configuring CentOS to use NTP

September 11, 2008 By: HKP30 Category: CentOS

There are a number of reasons you might want a server to use NTP not the least of which is a desire to synchronize the clocks on multiple systems so that times/dates in logs line up.  I finally got around to configuring NTP on our H-Sphere server.  The process is pretty simple on CentOS.

First Install the NTP Package on your server as root.

[root@cp ~]# yum install ntp

Loading “fastestmirror” plugin
Loading mirror speeds from cached hostfile
* base: mirror.steadfast.net
* updates: mirrors.liquidweb.com
* addons: pubmirrors.reflected.net
* extras: pubmirrors.reflected.net
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package ntp.i386 0:4.2.2p1-8.el5.centos.1 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

=================================================================
Package                 Arch       Version          Repository        Size
=================================================================
Installing:
ntp                     i386       4.2.2p1-8.el5.centos.1  base              1.3 M

Transaction Summary
=================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 1.3 M
Is this ok [y/N]: y
Downloading Packages:
(1/1): ntp-4.2.2p1-8.el5. 100% |=========================| 1.3 MB    00:19
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: ntp                          ######################### [1/1]

Installed: ntp.i386 0:4.2.2p1-8.el5.centos.1
Complete!

Next set it to start automatically on a reboot

[root@cp ~]# chkconfig ntpd on

Tell it which NTP server it should update it’s time from

[root@cp ~]# ntpdate pool.ntp.org
4 Aug 12:32:43 ntpdate[9540]: step time server 64.202.112.75 offset 1256.453048 sec

Verify that the Time & Date are correct

[root@cp ~]# date
Mon Aug  4 12:33:04 EDT 2008

Finally start the service

[root@cp ~]# service ntpd start
Starting ntpd:                                             [  OK  ]

Easy as could be.  If you set all of your servers to update their time from the same pool server your time will be accurate within two seconds or better.  If you update one server to the pool, and tell all the rest to update from your own NTP server time can be even more accurate.  I don’t need that level of accuracy and tend to just use the pool.

CentOS 5.2 & Configuring MTU

July 21, 2008 By: HKP30 Category: CentOS, Networking

ifcfg-eth0 configuration example

We have one server in our office that performs very few functions.  In fact its lone reason for being on the network is to allow one of our customers to GET and POST data into the lease management system the company I work for runs.  The customer requested some kind of web server to manage the GET and POST procedures.  We established a site to site VPN, secured access to and from the LAMP server between four hosts on their network (two development, one production, and one disaster recovery) and our LAMP server.  (It’s named LAMP.  It also happens to be a L.A.M.P. server)

All seemed to be working well.  Until at some point the customer noticed that certain types of traffic just didn’t work to/from the server.  As it turns out because of the IPSEC VPN, and encapsulation we needed to adjust the MTU on both ends of the link.

If you are ever using a CentOS 5.2 server, and you want to adjust the MTU to something other than the default with that change surviving reboots of the server you need to do the following.

vi /etc/sysconfig/network-scripts/ifcfg-(interface)

add a line that reads.

MTU = (some number less than 1500 here)

save and exit the file.  Now if you would like to make that change take effect right away.  You can either…   /etc/init.d/network restart  OR….  ifconfig (interface) mtu (some number < 1500)

Clear as Mud eh?

ifconfig post restart