Showing posts with label Server. Show all posts
Showing posts with label Server. Show all posts

Change NTP and Timezone CentOS/RHEL 7.x


Pre-installation, checking your current OS Version :
 
[root@host02 ~]# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)

INSTALL NTP AND NTPDATE
[root@host02 ~]# yum install ntpdate ntp -y

Sync your time to NTP Server (global)
Because we are in Indonesia we use this one :
[root@host02 ~]# ntpdate -u 0.id.pool.ntp.org
10 Mar 22:20:12 ntpdate[8437]: step time server 202.146.247.134 offset 140.931464 sec

just a second, your current time is being synchronize with the NTP Server
Re-check your pool NTP server for your location.
Check after synchronizing :

[root@host02 ~]# date
Thu Mar 10 22:20:16 EST 2016

[root@host02 ~]# timedatectl
      Local time: Fri 2016-03-11 10:44:01 WIB
  Universal time: Fri 2016-03-11 03:44:01 UTC
        RTC time: Fri 2016-03-11 03:44:01
       Time zone: Asia/Jakarta (WIB, +0700)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

CONFIG YOUR MACHINE TO NTP SERVER
[root@host02 ~]# vi /etc/ntp.conf 

Add some NTP Server, such as below :

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 0.id.pool.ntp.org
server 1.id.pool.ntp.org
server 2.id.pool.ntp.org
server 3.id.pool.ntp.org

START AND ENABLE SERVICE
[root@host02 ~]# systemctl start ntpd
[root@host02 ~]# systemctl enable ntpd
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.

CHECK STATUS SERVICE
[root@host02 ~]# systemctl status ntpd
● ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2016-03-10 22:21:00 EST; 12s ago
 Main PID: 8446 (ntpd)
   CGroup: /system.slice/ntpd.service
           └─8446 /usr/sbin/ntpd -u ntp:ntp -g


FIND YOUR LOCATION :
[root@host02 ~]# timedatectl list-timezones

SET YOUR TIMEZONE :
[root@host02 ~]# timedatectl set-timezone Asia/Jakarta

ENSURE YOUR LOCALTIME :
[root@host02 ~]# ls -l /etc/localtime
lrwxrwxrwx. 1 root root 34 Mar 11 10:24 /etc/localtime -> ../usr/share/zoneinfo/Asia/Jakarta





simple dhcp server

distro: CentOS 5.5 x86_64
# yum install dhcp
konfigurasi dhcp server range 192.168.1.110 - 192.168.1.115
yang berarti hanya untuk 5 client, 1 IP pada tiap client

# vi /etc/dhcpd.conf

ddns-update-style ad-hoc;
ddns-update-style interim;
subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers                  192.168.1.1;
        option subnet-mask              255.255.255.0;

        option domain-name              "jabetto.lan";
        option domain-name-servers       192.168.1.160;

        option time-offset              -18000;     # Eastern Standard Time

    range 192.168.1.110 192.168.1.115;
}

# service dhcpd start
# chkconfig dhcpd on

untuk testing
pada client jalankan
# dhclient eth0

Log File Server

log file server dengan  topologi jaringan star
memiliki 1 buah server dengan 3 buah client (buat contoh gag usah banyak2 :))

IP Server 192.168.0.1 hostname server01

IP Client1 192.168.0.2
IP Client2 192.168.0.3
IP Client3 192.168.0.4


settingan pada server01
edit file /etc/sysconfig/syslog pada baris SYSLOGD_OPTIONS="-m 0" ubah menjadi SYSLOGD_OPTIONS="-m 0 -r"

settingan pada client1, client2, dan client3
edit file /etc/syslog.conf  ubah pada baris

*.info;mail.none;authpriv.none;cron.none < tab > @server01
authpriv.*                                                  < tab > @server01
mail.*                                                          < tab >   @server01
cron.*                                                           < tab >    @server01
uucp,news.crit                                         < tab >  @server01
local7.*                                                                 

kemudian pada file /etc/hosts
tambahkan
192.168.0.1 < tab > server01
" note: < tab > tabulasi "
kemudian save
dan restart syslog
/etc/init.d/syslog restart