After a line change the phones stay on the old one

John Smith Ltd has two lines: the fibre (eth0, 203.0.113.10, priority 10), which carries the traffic, and the backup FWA line (eth2, lease 192.168.8.100 from the FWA router 192.168.8.1, priority…

Situation

John Smith Ltd has two lines: the fibre (eth0, 203.0.113.10, priority 10), which carries the traffic, and the backup FWA line (eth2, lease 192.168.8.100 from the FWA router 192.168.8.1, priority 20), with the automatic failover described in Two internet lines with automatic failover. The office IP phones are on the office LAN (from 192.168.10.61 to 192.168.10.68) and register with the VoIP provider’s PBX, on the internet at 198.51.100.50, UDP port 5060.

This morning the fibre went down for half an hour: the provider’s router stayed on, but no longer led to the internet. The WAN monitor noticed after three failed pings to 9.9.9.9 and withdrew the fibre’s gateway: browsing moved to the FWA and then, when the fibre came back, back to the fibre. The phones did not: during the outage they received no calls, and even now that the fibre is back some stay “registered” but silent.

Why it happens

For every connection that goes through it, the appliance keeps an entry in the connection tracking table: who is talking to whom, on which ports, and with which address translation. The translation (the masquerade of the outgoing line) is chosen only once, when the connection starts, with the line of that moment, and the entry stays until the connection stays silent long enough to expire.

An ordinary web page lasts a few seconds, and the next one starts on the new line already. A phone’s SIP registration does not: the phone sends a “keepalive” packet every few seconds, always from the same port to the same port of the PBX, and the entry never expires. The phone goes on using the translation from when the connection started:

  • during the outage, the phones registered through the fibre send their packets on the FWA, but with the fibre’s address (203.0.113.10) as sender: the FWA router and its provider do not deliver them, and the PBX answers to an address that no longer leads anywhere;
  • when the fibre comes back, the phones that registered through the FWA during the outage (those whose entry had expired, or those you restarted) go on leaving with the FWA’s address (192.168.8.100), now through the fibre, and the fibre’s provider drops them.

The remedy is to delete those entries: the phone’s next packet opens a new connection, with the routes and translations of now, and the phone registers again.

For the technician The table is /proc/net/nf_conntrack. When it withdraws a line, the WAN monitor removes its default route (and its policy routes), and puts it back when the line returns; it does not touch the connections under way. Argos does not flush the table at every change of line: the calls and transfers that are working would drop too. The kernel forgets on its own the connections masqueraded on an interface when the interface is brought down or loses its address, not when the line fails further upstream and eth0 stays up with its address: that is exactly the case where the reachability check withdraws the gateway. The deletion uses conntrack -D (the conntrack-tools package, installed with Argos) with exactly the filter the page has just listed, and it is recorded in the journal with the account: [argos] conntrack: 8 entries deleted (udp, port 5060) by lwhite.

What you need

  • A console account.
  • The port and, if you know it, the address of the PBX: here UDP 5060 to 198.51.100.50. If the PBX uses another port (5061, 5080…), the provider states it in the phones’ configuration.
  • A moment with no important calls under way: deleting an entry drops the call that uses it.

Steps

  1. Open System status → Status and check in the “Gateways and tunnels” panel which gateway is carrying the traffic now. Do this when the right line is up: during the outage, if the phones have stayed on the failed fibre (the “Attention” strip says “WAN uplink eth0 is down: its default route is withdrawn”); after the fibre comes back, if they have stayed on the FWA.
  2. Open Events and diagnostics → Diagnostics and select the “Connection tracking” block (/diagnostics?block=conntrack). On opening, the page shows the whole table.
  3. Press “VoIP (SIP, udp 5060)”. The filter becomes “Protocol” udp, “Port” 5060, and the page lists the matching connections: “8 connections match.”.
  4. Read the table. For each phone you see “Protocol”, “State”, “Source” (192.168.10.61:5060…), “Destination” (198.51.100.50:5060), “Translation” and “Expires (s)”. The “Translation” column says with which address the connection goes out: “as 203.0.113.10:…” is the fibre, “as 192.168.8.100:…” the FWA. A connection with the address of the line that is not carrying the traffic is a phone left behind (in the example, after the fibre came back, 192.168.10.64 and 192.168.10.67 still say “as 192.168.8.100:…”). “Expires (s)” goes back up at every keepalive: that is the sign the entry would never expire on its own.
The VoIP connections in connection trackingThe VoIP connections in connection tracking
The VoIP connections in connection tracking
  1. If there are calls under way on the other phones, stick to the ones left behind: type the address of one (192.168.10.64) in “Address” and press “Show”, then delete and repeat with the other. For all the connections to the PBX type 198.51.100.50 instead. Every time you change a field you have to press “Show” again: until you do, the page says “The filter changed: show the connections again before deleting them.” and the delete button stays disabled. That way you always delete exactly what you have just seen.
  2. Press “Delete these connections”. The question says how many connections go and with which filter: “Delete the 8 connections shown (udp · port 5060)? Their next packet starts a new connection: a call or a transfer under way may drop, and the phones register again.”.
  3. Confirm with “Delete these connections”. “8 connections deleted” appears and the page lists again with the same filter.
The deletion confirmationThe deletion confirmation
The deletion confirmation

There is no need to apply the firewall: the rules do not change, only the connections under way do.

If you deleted the connections during the outage, the phones register through the FWA: when the fibre comes back they will stay there, and will need deleting again.

Warning With all the fields empty the button becomes “Empty the table” and the question says so: “Empty the whole connection tracking table…”. Every connection through the appliance starts over at its next packet: calls, downloads, remote sessions and your own console session may drop. Use it only if you know you want it; for the phones the VoIP filter is enough.

Verification

  1. After a few seconds press “VoIP (SIP, udp 5060)” again. The connections come back, one per phone, as the phones send their next packet; the “Translation” now gives the address of the active line for all of them: “as 203.0.113.10:…” with the fibre.
  2. On the phones’ displays the registration becomes valid again (usually within the keepalive or registration period, from a few seconds to a few minutes). Make a test call in and one out.
  3. If someone asks you what you did, the line is in the journal: in Events and diagnostics → System type conntrack in the filter and press “Filter”.

For the VoIP provider’s support you can also press “Download” before deleting: the file holds all the connections that match the filter, not just the first 500 shown, with the appliance’s name, the time and the filter.

If something goes wrong

  • “No connection matches.” The phones do not use port 5060 (many providers use 5061 for SIP over TLS, or a port of their own). Empty the “Port”, type the PBX’s address in “Address” and press “Show”.

  • The phones do not register after the deletion. If the new connections do not appear, the traffic is not getting out: check in Events and diagnostics → Firewall the dropped events for a phone’s address, and on the Status page that the active gateway is really up. If they appear with “no reply” in the “Flags” column, the PBX does not answer: perhaps it accepts only the public address registered with the provider (many cloud PBXs accept a single address, the fibre’s). In that case the phones work only on the line the provider has authorised them for.

  • “A port needs tcp or udp (or any)”. With “Protocol” icmp you cannot give a port.

  • “Enter an IPv4 address”. The “Address” filter accepts a single IPv4 address, not a network.

  • “The connection tracking table cannot be read on this host.” The kernel does not expose the table: connection tracking is not active on this system. Check on the Status page that the firewall is filtering.

  • “Deleting the connections failed — …”. The message that follows comes from the conntrack command; read it, and repeat after showing the connections again.

  • The problem comes back at every outage. It is the normal behaviour after a failover. Keep the block with the VoIP button at hand, or from the shell:

    argos system diagnostics conntrack --voip
    argos system diagnostics conntrack-delete --voip

    The second command lists, then asks for confirmation like the page.

  • Other services stay on the old line too (an employees’ client VPN, a long-lived remote connection). The same remedy applies: filter on that service’s port or address and delete only those connections.

LET’S TALK INFRASTRUCTURE

Control starts with a conversation.

Tell us about your infrastructure. Let’s start with what you actually need.

Talk to an engineer