openwrt / openwrt/packages

mwan3 - Existing connection on an interface does not switch to other interface after disconnected event.

Open
#24,973 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Makefile
Stars
4.6k
Forks
4k
Avg merge
3d 12h
Merged PRs (30d)
134

Description

Hello
We're using a Teltonika RUTX12 router with two independent 4G modems. It runs OpenWRT and we have configured mwan3 to provide load balancing and have also enabled mwan3-tracker to monitor the connections and disconnect them if the latency is outside certain thresholds.
This router is connected to a computer running an application that uses TCP to send messages to a server on the cloud.
The mwan3 system works well and seems to operate as intended, as in it will disconnect and reconnect the interfaces as expected.
However the issue we are experiencing is that once we start the application on our computer and it establishes a TCP connection with the cloud server through one of the interfaces it will continue to use that interface even after the interface has been disconnected. That is, the traffic will remain in the now offline interface and will not switch to the other interface which is online.
We monitor the traffic through each interface using tcpdump
We have enabled flushing conntrack on the disconnected event in the config file for each interface
list flush_conntrack 'disconnected'
, but this does not resolve the issue (we did not really expect it to as its a TCP connection)

In order for the disconnection to happen we have modified the hotplug.d/ifaces/15-mwan3 script to include the following at the end of the disconnected section of the case "$ACTION" statement

iptables -I FORWARD -o $DEVICE -j REJECT 
sleep 2 
iptables -D FORWARD -o $DEVICE -j REJECT 

This works as intended, as soon as the interface is disconnected the TCP traffic on the interface stops and a new connection is established on the online interface.

However, this does not seem the right way to do this, what would be the proper way to get this behaviour (and I don't moving the hack to the mwan3.usr script).
Is there a way to get this behaviour without this hack? Are we missing something in our configuration?

Any tips greatly appreciated!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with hotplug.d/ifaces/15-mwan3, the disconnected event handling, and the mwan3 configuration containing flush_conntrack. Reproduce the two-interface failure while monitoring each interface with tcpdump, then compare it with the temporary iptables FORWARD REJECT workaround. Done means an existing TCP flow stops using the disconnected interface and reconnects through the online interface without that hack.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, shell
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.