NTP working modes - time

I am new to NTP protocol. I read the RFC1305 and have some questions about NTP.
My questions are related to NTP working modes.
According to RFC1305 there are 8 modes
| 0 | reserved
| 1 | symmetric active
| 2 | symmetric passive
| 3 | client
| 4 | server
| 5 | broadcast
| 6 | NTP control message
| 7 | reserved for private use
My questions:
1- What are the differences between the symmetric passive device and symmetric active one?
2- Two symmetric active device can sync each other and Two passive active device can sync each other too ,but Can a symmetric passive device been synced by a symmetric active one and vice versa?
3- When a Symmetric passive device is connected to symmetric active one which one sends the NTP packet first?
4- What happens in broadcasting mode? Does the client send any NTP packet or only the broadcaster does that?
5- ”in order to sync some clients who have CLASS D IP ‘s , the server fills the 3 time stamp fields(receive time stamp is null) and set the mode to 5 and send the packet to 224.0.1.1 and clients get that packet and they send nothing in this procedure” Is this true?
6- Who sends the NTP control message? Client or broadcaster? What’s it for? What’s the appropriate answer for it?is it always 12 bytes long?
7- “A stratum 1 NTP server (GPS connected) acts like this: answer mode 1 requests with mode 2, mode 3 with mode 4 and mode 6 with 7” Is this true?

can only reply to a few questions:
-4. only the server (broadcaster) is allowed to send any ntp-packet in this mode
clients only listen to the interface, parse the received packet and set their clock accordingly - there is no reply being send.
but clients may send a ntp-request too, the server should then not reply to this one.
-5. right. there is no answer supposed to be send by this clients.

Mode 6 is used by the ntpq program. It can for example query "a list of the peers known to the server as well as a summary of their state" (from the man page).
This has recently be exploited to do DDOS reflection attacks, because it can be triggered with spoofed IP address, and the reply is larger than the query. 1
For this reason mode 6 and 7 queries should be blocked from outside sources.

Related

WLAN_NOTIFICATION_MSM NotificationCode 59

I'm writing a kind of wrapper over wlanapi. When receiving notifications via WlanRegisterNotification I'm getting unexpected media-specific module (MSM) notification with code 59 (which is 0x3B in hex). WLAN_NOTIFICATION_MSM MSDN page does not contain any helpful information. My wlanapi.h does not contain such value as well, in fact this enumeration is zero-based and contain only 18 values - from 0 to 17.
Does anybody knows the meaning of such notification, and why it is not documented at all?
Here is what I have so far.
Looks like this notification is a part of regular connection process. That is, I'm getting it when connecting to a wireless network - regardless of previous connection state. Here is the notification sequence which happens each time when I connect to a network:
wlan_notification_msm_associating
wlan_notification_msm_associated
wlan_notification_msm_authenticating
59 (0x3B)
wlan_notification_msm_signal_quality_change
wlan_notification_msm_associated and wlan_notification_msm_authenticating fires in the same moment of time, and then immediately (in 10-20 milliseconds) fires notification with code 59 (0x3F).
This notification has 16-bytes payload. Data structure does not look familiar to me, posting this in case if it looks familiar to someone (10 events):
80805E08 009B0000 F1F10800 C400D634 <-- Switching between two networks here and below in random order
D0D049FA 009B0000 A6A60800 01542A00
80805E08 009B0000 696902FF 00FF4C6F
80805E08 00C40000 04040E00 000093DF
80805E08 009B0000 04040900 6F009361 <-- Diconnect and connect to the same network
80805E08 009B0000 04000700 00009340 <-- Diconnect and connect to the same network
64640000 00450002 0400114D 00009363 <-- Disconnect and connect to another network
80805E08 009B0000 04040511 005B93E8 <-- Diconnect and connect to the same network
58580000 00450002 04000904 3D4293A1 <-- Connect to another network (i. e. switch)
80805E08 009B0000 04040100 10919316 <-- Connect to another network (i. e. switch)
Useful links
[Wlanapi] WLAN_NOTIFICATION_MSM NotificationCode 59 (Microsoft Q&A)
[Wlanapi] WLAN_NOTIFICATION_MSM NotificationCode 59 (c++ forums)
Will appreciate any help!
Update 1
Notifications sequence is the same when connecting via official sample:
HandleAcmNotification(type = ConnectionStart)
HandleMsmNotification(type = Associating)
HandleMsmNotification(type = Associated)
HandleMsmNotification(type = Authenticating)
HandleMsmNotification(type = Code59)
HandleMsmNotification(type = SignalQualityChange)
HandleMsmNotification(type = Connected)
HandleAcmNotification(type = ConnectionComplete)
Update 2
I've created a minimal test project on GitHub for this purpose - https://github.com/alexbereznikov/wlanapi-notification-code59-test.
Binary x64 release is located here - https://github.com/alexbereznikov/wlanapi-notification-code59-test/releases.
I'm getting the following output after successful connection to a wireless network:
This is by design.
The 0n59 notification code is a private notification code that is processed by the OS when the wireless network may be undergoing a network speed change.
For the end developer, this should be ignored by the end developer as it is not documented and subject to change in the future since it is a private notification handled by underlying OS.
Note:This will only be sent on newer OS now (Windows 10) when disabling and re-enabling the wireless network. This notification is not sent for older OS (example, Windows 7, Windows 8.1)

Mqtt connection & data publisher misinterpreted in JMeter

I have jmeter , where a single thread contains two mqtt gateway connection sampler & each sampler have three publishers connected to iothub.
Jmeter reference:
When I run the thread in loop 6frames / second for 10 seconds, I could see all 60 frames published successful in JMeter.
But when I check data count at iothub, first gate way point have received only 6 frames ( some data get missed it seems, problem with jmeter I assume ) & second gateway have received 42 frames. Second part led to major confusion, when it have to receive maximum of 30 frames, but received 42.
Diagram reference:
Each gateway (A &B) include the Connection panel with :
Iothub URL
Mqtt v 3.1.1
Username: iothuburl/device ID
Pwd: SAS token ( generated SAS from connection string available at iothubowner page from azure portal).
Each Gateway (A&B) include
three publishers & Each includes 200 JSON objects and size doesn't exceed 55kb.
Publisher QoS: 0
Operation:
For every one second, each gateway publish 3 frames ( total 600 JSON objects).
As I have mentioned 2 gateway, so total 6 frames with 1200 JSON object get published successful in JMeter.
But the data is missing at iothub.
note: while running two gateway in single thread, i could both gateway connection sharing the common connection string ID.
Any clue, where did I miss the major configuration, any help would be greatly appreciated. Thanks.
Change the QoS=1 in publisher panel. Though we have few latency time to wait for acknowledgement, but the simulation works fine without any loss of connection/data.

I am planning to test a LMS application with 100 and 200 concurrent users,what is the minimum bandwidth to run this load test

In the load test the following scenarios are included
users viewing video, listening to audio, viewing pdf, ppt,etc
100 and 200 concurrent users with these scenarios what is the minimum bandwidth(mbps) for these scenarios?
Normally you should have some form of NFR or SLA stating something like:
user with mobile phone connected to 3G network should have response time not more than 2 seconds
So you need to determine the slowest supported network type and simulate users connected to this networks type accessing your application. You can use Duration Assertion to automatically fail the requests which response time exceeds acceptable thresholds.
Here are the most popular throttled data presets which can be useful:
Bandwidth | cps
GPRS | 21888
3G | 2688000
4G | 19200000
WIFI 802.11a/g | 6912000
ADSL | 1024000
100 Mb LAN | 12800000
Gigabit Lan | 128000000

XBee - XBee-API and multiple endpoints

Using Andrew Rapp's XBee-API, how can I sample I/O data via a coordinator from more than two endpoints?
I have 17 Series 1 XBees. I have programmed one to be a coordinator (API mode = 2) and the rest to be endpoints. Using XBee-API I am sending a Force I/O Sample ("IS") remote AT command, unicast to each endpoint. This works perfectly well when there are up to two endpoints, but as soon as a third is added, one of the three always becomes non-responsive (times out with XBeeTimeoutException). It's not always the same physical unit that stops responding, but it is always the third one (for example, if I send Force I/O Sample to Device1, Device2, and Device3, Device3 will time out, and if I change the order to Device3, Device1, Device2, Device2 will time out.
If I set up more than three XBees, about 1 out of 3 will time out - but not every third one.
I've verified that the XBees themselves are fine. I've searched the Internet and Stack Overflow in particular to no avail. I've tried using a simple ZNetRemoteAtRequest. I've tried opening and closing the XBee coordinator serial connection once for all three devices, once per device, and once per program run. I've tried varying the distance between the coordinator and endpoints (never more than five feet apart). I've tried different coordinator configuration parameters (from the Digi documentation). I've tried changing out the XBee for the coordinator.
This is the code I'm using to send the Force I/O Sample request to each endpoint and read the response:
xbee = new XBee(); // Coordinator
xbee.open("/dev/ttyUSB0, 115200)); // Happens before any of the endpoints are contacted
... // Loop through known endpoint addresses
XBeeRequest request = new ZBForceSampleRequest(new XBeeAddress64(endpointAddress));
ZNetRemoteAtResponse response = null;
response = (ZNetRemoteAtResponse) xbee.sendSynchronous(request, remoteXBeeTimeout);
if (response.isOk()) {
// Process response payload
}
... // End loop and finally close coordinator connection
What might help polling I/O samples from more than two endpoints?
EDIT: I found that Andrew Rapp's XBee-API library fakes multithreaded behavior, which causes the synchronization issues described in this question. I wrote a replacement library that is actually multithreaded and correctly maps responses from multiple XBee endpoints: https://github.com/steveperkins/xbee-api-for-java-1-4. When I wrote it Java 1.4 was necessary for use on the BeagleBone, Plug, and Zotac single-board PCs but it's an easy conversion to 1.7+.
Are you using hardware flow control on your serial port? Is it possible that you're sending requests out when the local XBee has deasserted CTS (e.g., asking you to stop sending)? I assume you're running at 115200 bps, so the XBee serial port can keep up with the network data rate.
Can you turn on debugging information, or connect some port monitoring hardware/software to display the data going over the serial port to the local XBee?

Script to Monitor IPMI SEL in real time

I want to monitor IPMI System Event Log(SEL) in real time. What I want that is that whenever a event is generated in SEL , automatically a mail alert should be generated .
One way for me to achieve this is that I can write a script and schedule it in cron. The script will run 3 or 4 times a day so whenever a new event is generated , a mail alert will be send to me.
I want the monitoring to be active. Like whenever a event is generated , a mail should be sent to me instead of checking at regular intervals.
The SEL Log format is as follows:
server-001% sudo ipmitool sel list
b4 | 05/27/2009 | 13:38:32 | Fan #0x37 | Upper Critical going high
c8 | 05/27/2009 | 13:38:35 | Fan #0x37 | Upper Critical going high
dc | 08/15/2009 | 07:07:50 | Fan #0x37 | Upper Critical going high
So , for the above case whenever a new event is generated , automatically a mail alert should be send to me with the event.
How can I achieve this with a bash script . Any pointers will be highly appreciated.
I believe some vendors have special extensions in their firmware for exactly what you are describing (i.e. you just configure an e-mail address in the service processor), but I can't speak to each vendor's support. You'll have to look for your motherboard's documentation for that.
In terms of a standard mechanism, you are probably looking for IPMI PET (platform event trap) support. With PET, when certain SEL events are generated, it will generate a SNMP trap. The SNMP trap, once received by an SNMP daemon can do whatever you want, such as send an e-mail out.
A user of FreeIPMI wrote up his experiences in a doc and posted his scripts, which you can find here:
http://www.gnu.org/software/freeipmi/download.html
(Disclaimer: I maintain FreeIPMI so I know FreeIPMI better, unsure of support in other IPMI software.)
As an FYI, several IPMI SEL logging daemons (FreeIPMI's ipmiseld and ipmitool's ipmievtd are two I know) poll the SEL based on a configurable number of seconds and log the SEL information to syslog. A mail alert could also be configured in syslog to send out an e-mail when an event occurs. These daemons are still polling based instead of real-time, but the daemons will probably handle many IPMI corner cases that your cron script may not be aware of.
Monitoring of IPMI SEL events can be achieved using ipmievd tool . It is a part of ipmitool package.
# rpm -qf /usr/sbin/ipmievd
ipmitool-1.8.11-12.el6.x86_64
To send SEL events to syslog , execute the following command.
ipmievd sel daemon
Now , to simulate generation of SEL events , we will execute the following command.
ipmitool event 2
This will generate the following event
` Voltage Threshold - Lower Critical - Going Low`
To get the list of SEL events that can be generated are , try
# ipmitool event
usage: event <num>
Send generic test events
1 : Temperature - Upper Critical - Going High
2 : Voltage Threshold - Lower Critical - Going Low
3 : Memory - Correctable ECC
The event will be notified to /var/log/messages. Following message was generated in log file.
Oct 21 15:12:32 mgthost ipmievd: Voltage sensor - Lower Critical going low
Just in case it helps anyone else...
I created a shell script to record data in this format, and I parse it with php and use google's chart api to make a nice line graph.
2016-05-25 13:33:15, 20 degrees C, 23 degrees C
2016-05-25 13:53:06, 21.50 degrees C, 24 degrees C
2016-05-25 14:34:39, 19 degrees C, 22.50 degrees C
#!/bin/sh
DATE=`date '+%Y-%m-%d %H:%M:%S'`
temp0=$(ipmitool sdr type Temperature | grep "CPU0 Diode" | cut -f5 -d"|")
temp1=$(ipmitool sdr type Temperature | grep "CPU1 Diode" | cut -f5 -d"|")
echo "$DATE,$temp0,$temp1" >> /events/temps.dat
The problem I'm having now is getting the cron job to access the data properly, even though it's set in the root crontab.

Resources