Info::proxy/proxies pour ModBus tcp
De wiki_pcwiki2
KEYWORDS: PROXY, PROXIES, MODBUS
Le 15/05/2025: Puisje avoir les configs pour haproxy, redir et socat ? ChatGPT a dit : Voici les configurations complètes pour exposer tes deux adresses Modbus TCP (192.168.1.252:1485 et 192.168.1.253:2485) via : 🔁 HAProxy 🔁 redir 🔁 socat
🥇 HAProxy (robuste, système de production) 📦 Installation : apt install haproxy 🗂️ Fichier de configuration /etc/haproxy/haproxy.cfg Ajoute à la fin (ou adapte) : defaults mode tcp timeout connect 5s timeout client 30s timeout server 30s frontend modbus1 bind *:1485 default_backend modbus1_backend backend modbus1_backend server modbus1 192.168.1.252:1485 check frontend modbus2 bind *:2485 default_backend modbus2_backend
backend modbus2_backend server modbus2 192.168.1.253:2485 check 🚀 Redémarrage : systemctl restart haproxy
🥈 redir (ultra minimaliste) 📦 Installation : apt install redir
🔁 Commandes simples : # Redirige 1485 local vers 192.168.1.252:1485 redir --lport=1485 --caddr=192.168.1.252 --cport=1485 & # Redirige 2485 local vers 192.168.1.253:2485 redir --lport=2485 --caddr=192.168.1.253 --cport=2485 & ⚠️ Pas de support systemd intégré : il faut utiliser des scripts ou tmux pour garder les services en vie.
🥉 socat (puissant, léger) 📦 Installation : apt install socat 🔁 Commandes simples :
# Expose localement le port 1485 pour accéder à 192.168.1.252:1485 socat TCP-LISTEN:1485,reuseaddr,fork TCP:192.168.1.252:1485 & # Expose localement le port 2485 pour accéder à 192.168.1.253:2485 socat TCP-LISTEN:2485,reuseaddr,fork TCP:192.168.1.253:2485 &