NTP UDP port forward using socat

This is just test to verify the UDP-TCP tunnel latency

  • Since Pi5 (192.168.10.187) can SSH to Pi3 (192.168.0.188), you can use a reverse SSH tunnel plus socat to carry the NTP UDP packets.
  • On Pi5
##### Create socket from UDP to TCP
socat -T1 TCP4-LISTEN:9123,reuseaddr,fork UDP4:192.168.10.90:123

systemctl status ntp-socat.service

##### Forward TCP via SSH
ssh -N -R 127.0.0.1:9123:127.0.0.1:9123 root@192.168.0.188

systemctl status ntp-reverse-ssh.service

###################
Pi3 127.0.0.1:9123
       ↓ SSH
Pi5 127.0.0.1:9123
  • On Pi3 – Convert local NTP UDP/123 → tunneled TCP/9123:
socat -T1 UDP4-LISTEN:123,reuseaddr,fork TCP4:127.0.0.1:9123
ntpdate -q 127.0.0.1
  • services
systemctl status ntp-reverse-ssh.service
systemctl status ntp-socat.service

Published by

Leave a Reply

Your email address will not be published. Required fields are marked *