WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to configure ntp client/server in Tiny Core Linux?  (Read 10769 times)

Offline Adam

  • Full Member
  • ***
  • Posts: 121
How to configure ntp client/server in Tiny Core Linux?
« on: August 19, 2013, 07:52:56 AM »
Hi, I’ve been searching for ntp client/server configuration in Tiny Core Linux but don’t get any luck.
Hence, I would appreciate if you could share any tutorial if there is any. Thanks.

The purpose of this lab is to make sure all hosts having the same date & time.

Here is my first attempt to configure it, but it’s still not working.

NETWORK TOPOLOGY


NTP Client
Core1 eth1: 10.0.0.1
Core3 eth1: 172.16.0.1

NTP Server (Core2)
Core2 eth1: 10.0.0.2
Core2 eth2: 172.16.0.2

VIRTUALBOX CONFIGURATION
VirtualBox configured as “Host-Only”. Hence, there is no internet connection.

NTP Server
1. Before start NTP server
Quote
tc@Core2:~$ pgrep 123
tc@Core2:~$

tc@Core2:~$ netstat -an | grep 123
netstat: /proc/net/tcp6: No such file or directory
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
tc@Core2:~$

tc@Core2:~$ sudo nmap localhost -sU -p 123

Starting Nmap 6.01 ( http://nmap.org ) at 2013-08-19 14:44 UTC
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000040s latency).
rDNS record for 127.0.0.1: box
PORT    STATE  SERVICE
123/udp closed ntp

Nmap done: 1 IP address (1 host up) scanned in 0.05 seconds
tc@Core2:~$

2. Start NTP server
Quote
tc@Core2:~$ /usr/local/etc/init.d/ntpd start
Starting NTP (Network Time Protocol) daemon ntpd
must be run as root, not uid 1001
tc@Core2:~$
tc@Core2:~$ sudo /usr/local/etc/init.d/ntpd start
Starting NTP (Network Time Protocol) daemon ntpd
tc@Core2:~$

3. Verify
Quote
tc@Core2:~$ netstat -an | grep 123
netstat: /proc/net/tcp6: No such file or directory
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
udp        0      0 172.16.0.2:123          0.0.0.0:*
udp        0      0 10.0.0.2:123            0.0.0.0:*
udp        0      0 192.168.10.12:123       0.0.0.0:*
udp        0      0 127.0.0.1:123           0.0.0.0:*
udp        0      0 0.0.0.0:123             0.0.0.0:*

tc@Core2:~$

tc@Core2:~$ sudo nmap localhost -sU -p 123

Starting Nmap 6.01 ( http://nmap.org ) at 2013-08-19 14:49 UTC
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000067s latency).
rDNS record for 127.0.0.1: box
PORT    STATE SERVICE
123/udp open  ntp

Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds
tc@Core2:~$

4. NTP Client
Quote
tc@Core1:~$ ntpclient -h 192.168.10.12
41503 38173.976  rejected packet: LI==3
41503 38774.077  rejected packet: LI==3
« Last Edit: September 06, 2013, 06:29:10 AM by Adam »

Offline Adam

  • Full Member
  • ***
  • Posts: 121
Re: How to configure ntp client/server in Tiny Core Linux?
« Reply #1 on: September 04, 2013, 11:38:16 AM »
Still no luck, please help
http://firewallengineer.wordpress.com/2013/09/04/linux-ntp-client-server-configuration/

NTP CLIENT
Quote
tc@Core3:~$ sudo ntpdate -vv 172.16.0.2
4 Sep 14:42:59 ntpdate[1152]: ntpdate 4.2.6p2@1.2194-o Wed Dec 8 22:46:46 UTC 2010 (1)
4 Sep 14:43:07 ntpdate[1152]: no server suitable for synchronization found
tc@Core3:~$

NTP SERVER
Quote
    tc@Core2:~$ tcpdump -i 3 -n not arp
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on eth2, link-type EN10MB (Ethernet), capture size 68 bytes
    14:38:26.628822 IP 172.16.0.1.123 > 172.16.0.2.123: NTPv4, Client, length 48
    14:38:26.628938 IP 172.16.0.2.123 > 172.16.0.1.123: NTPv4, Server, length 48
    14:38:28.628493 IP 172.16.0.1.123 > 172.16.0.2.123: NTPv4, Client, length 48
    14:38:28.628600 IP 172.16.0.2.123 > 172.16.0.1.123: NTPv4, Server, length 48
    14:38:30.627406 IP 172.16.0.1.123 > 172.16.0.2.123: NTPv4, Client, length 48
    14:38:30.627551 IP 172.16.0.2.123 > 172.16.0.1.123: NTPv4, Server, length 48
    14:38:32.626576 IP 172.16.0.1.123 > 172.16.0.2.123: NTPv4, Client, length 48
    14:38:32.626716 IP 172.16.0.2.123 > 172.16.0.1.123: NTPv4, Server, length 48
    ^C
    8 packets captured
    8 packets received by filter
    0 packets dropped by kernel
    tc@Core2:~$

Quote
    tc@Core2:/usr/local/etc$ ntpq -pn
    remote refid st t when poll reach delay offset jitter
    ==============================================================================
    10.0.0.2 .INIT. 16 u - 64 0 0.000 0.000 0.000
    172.16.0.2 .INIT. 16 u - 64 0 0.000 0.000 0.000
    127.127.28.0 .GPS. 0 l - 16 0 0.000 0.000 0.000
    127.127.28.1 .GPS1. 0 l - 16 0 0.000 0.000 0.000
    tc@Core2:/usr/local/etc$

NTP SERVER CONFIGURATION

Quote
    tc@Core2:/usr/local/etc$ cat ntp.conf
    driftfile /var/db/ntp.drift

    server 10.0.0.2
    server 172.16.0.2

    # GPS
    server 127.127.28.0 minpoll 4 maxpoll 4
    fudge 127.127.28.0 time1 0.420 refid GPS

    # GPS w/PPS output
    server 127.127.28.1 minpoll 4 maxpoll 4 prefer
    fudge 127.127.28.1 refid GPS1
    tc@Core2:/usr/local/etc$