D
D
dlinyj2020-05-12 22:27:58
linux
dlinyj, 2020-05-12 22:27:58

How to automatically test speed on multiple wan interfaces without losing ssh connection?

The system has several wan interfaces (up to a dozen). Some of them may not be connected. There is a lifted reverse ssh which is automatically lifted on break.

At the moment I'm testing speed like this (python+bash)

for iface in network_list:
  cmd = "sudo ifconfig " + iface + " down"
  os.system(cmd)
for iface in network_list:
  cmd = "sudo ifconfig " + iface + " 192.168.8.100 up"
  os.system(cmd)
  cmd = "sudo route add default gw 192.168.8.1"
  os.system(cmd)
  os.system("sudo bash -c 'echo nameserver 192.168.8.1 > /etc/resolv.conf'")
  SpeedTest()
  SaveResult()
  cmd = "sudo ifconfig " + iface + " 192.168.8.100 down"
  os.system(cmd)


One of the obvious problems is that every time my ssh connection is disconnected (ssh doesn't matter, maybe vpn). I ask for advice on how to do it more elegantly, without disabling interfaces and without losing ssh connections, to test speeds.

PS In order not to be surprised by the uniformity of addresses, modems are tested.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Barbolin, 2020-05-13
@dlinyj

1. Use mosh instead of ssh.
2. Register statics and a route in your direction on one of the interfaces. Connect accordingly to this interface.

D
Diman89, 2020-05-13
@Diman89

Maybe I'm wrong: the required connection is rigidly assigned to the current interface (marked), the rest is sent through the channel under test, while you do not have to disable the interface in use

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question