Cent OS NTP Client not Syncing - centos

I have an NTP server (Cent OS IP 192.168.102.129) which is configured to sync time from Singapore NTP, the client is from Europe (also a Cent OS 192.168.102.140), I want the client to sync its time from the NTP server, but it doesnt not sync.
I have changed the NTP server's timezone to Singapore, thus not sure if it is the right way, googled and got the NTP server to sync from Singapore NTP server pool, this part works, I can't get the client to sync from the Cent OS NTP Server.
Could some one guide me how to get the client to sync it's time from Singapore while being in Europe.
I tried the settings I used for the NTP server, on the client, with server address of the NTP server, I get this error: no server suitable for synchronization found all the time when I try the ntpq -p command.
Both Cent OS are VM machines
Thank You

Related

How to expose a Flask local development(default) server to the public on windows server

I have a flask app running on a remote WINDOWS server (this server has a fixed ip address) which is not on my local network. The flask app is used to return some json data. The app works fine when I try to access the data while being logged into the remote server through request module in Python. However, when I try to run the same script on my personal laptop (which is not on the same network as the remote windows server), I get an error. However, when I try to ping the remote server from windows command prompt, I get the answer back. Can somebody tell in which direction should I go? I have no experience with web / api development.
response = requests.get("http://127.0.0.1:5000/product/1)
But instead of the local ip address, if I substitute the remote ip address, I don't get anything back.
Ok, so the problem lied with the remote firewall, it was blocking incoming connections. The moment I switched off the firewall, everything started working.

Can My Program Detect if the connected Client Socket is via LAN (Local) or WAN (Remote)?

Can My Program Detect if the connected Client Socket on Port, say '4000', is over LAN (Local) or WAN (Remote) ?
Can InternetGetConnectedStateEx command help ?
I need it to understand if my customer is using LAN edition of my Application over WAN.
I use Delphi Seattle on Windows OS.
Regards
Allan
ALL clients connected to your server are on the same LAN as your server, otherwise they couldn't reach your server at all. But, in the case of a client connecting from the outside world through a NAT/router, the end client will be connected to the NAT/router, and then the NAT/router will be connected to your server. So, if you want to know if a client is connected to your server via the WAN, your server will need to know/discover the NAT/router's LAN IP address ahead of time, and then it can check whether a connected client's IP address matches the NAT/router's IP address or not.

ntp should be installed to a web server normally?

And when there are multiple servers (app servers and db servers), ntp should be installed both servers? and then how to sync the time each servers?
When I insert something with NOW() sql, the time is from db server?
I assume a simple web service using Rail on this app servers.
Yes, you should always install ntp if you can on all and any servers especially production boxes. It will save you hours of pain and troubles later.
This is a quick guide to ntp setup on Linux which should give you some ideas as to how to set up, what the config options do etc.
If you only have two servers in your deployment then I'd suggest you find some 'trusted' low stratum ntp servers that you can use, and apply the same config to both servers.
Make sure you have a minimum of three upstream servers to connect to, ideally five for a robust time domain.
Once you ntp setup and running and your servers are keeping time whenever you ask for the time, it should be the correct time within a small margin of UTC. So in Ruby if you do Time.now.strftime("%Y-%m-%d %H:%M:%S") it will return the hosts time as set/clocked by ntp.

How to sync time between windows and linux computers?

We have several linux and windows boxes and some of their clocks will drift. Is there a quick way to set up one of these systems as a time server and have the others point to them? This will need to work on a stand alone network. The OSs are specifically XP and RHEL5 for this exercise.
You can set up a NTP Server on one of the Linux machines and have the others point to it.
How to setup a NTP-Server with Redhat
Connect to the NTP-Server in Redhat:
ntpdate -du ntpservername
Connect to the NTP-Server in Windows XP:
Right click on the clock in the system tray
Choose adjust time
On the internet time tab insert your server hostname

What's Difference Between Ubuntu Server (32bit) and Desktop (32bit) In Socket Programming

I am working on a server/client based project. I almost finished my server side code.
I develop the server app in EclipseCDT on Ubuntu Desktop, and everything just works fine.
But when deploy my app to a Ubuntu Server (I tried Server 10.04/10.10), the server app can start normally (waiting for connection), but the same client just cannot connect to the server.
I use Socket for receiving and sending data to/from the client.
Peter
P.S.: if I install sudo apt-get install ubuntu-desktop on my server machine, then everything works fine again.
===========================================================================
New Findings from the source code:
LabelStartBlocking:
int newScoketId = ::accept(socketId, 0, 0); // socketId == 3 ::accept is define in socket.h
// waiting for connection
LabelResume: // if new connection coming
// Do something with newSocketId
The behavior difference between Ubuntu Desktop and Server is:
On Ubuntu Desktop version, when the server starts, it is blocked at LabelStartBlocking with the socket routine ::accept; and then if a new connection arrives, the server will resume at LabelResume and create a new socket connection using the return value newSocketId;
However, on Ubuntu Server version, when the server starts, it is also blocked at LabelStartBlocking with the socket routine ::accept, but if a new connection arrives, the server won't resume at LabelResume, and the new socket connection CANNOT be created.
Can you guys help me out?
Peter
Thanks for your attention.
I finally figured it out.
If there are more than one IP addresses for the same hostname (/etc/hosts), the old code will fail.
Example /etc/hosts file:
127.0.0.1 localhost YourHostName
10.50.10.251 YourHostName
I traced the calling stack, and I found that, the IP address (10.50.10.251) passed to the program is translated into hostname, and then later the hostname is translated back to IP address (for binding), but a DIFFERENT one, that's why my server program cannot accept any client connection.
Hope it helps if any others have the similar issue.
Peter