0

In my SoC imx6 I have two 4G modems using two different operators. I would like to give a score to each one so I can detect the best interface for my critical application.

I decide to use a small application that can make a ping to a server via a specific port:

$ ./tcpclienttimeout --host google.com --port 80
hotsname:google.com:80 timeout:10s
socket google.com:80 connected. It took 23 milliseconds
23

I would like to target the same server but with two different ports (let's say port 5000 and 5001) to get the latency for each modem.

here is a schematic that describes what I need:

here is a schematic that describes what I need:

I was thinking to use ip route add but we can specify just the servers and interfaces, not the port. Now I think that the solution will be using iptables (wich I don't understand at all)

thank you for your help.

  • iptables doesn't route, the routing stack does. So even if in some use cases you need iptables to complement the routing stack, you will always need ip route & co (ip rule etc.). You have to familiarize with multi-homing and its challenges. One old doc still mostly relevant: https://tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.rpdb.multiple-links.html – A.B Dec 03 '20 at 17:46
  • See also this answer of mine: https://unix.stackexchange.com/questions/581419/routing-port-traffic-over-specific-interface/582464#582464 – A.B Dec 03 '20 at 17:48

0 Answers0