cloudflare / cloudflared

Cloudflare Tunnel client (formerly Argo Tunnel)
https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide
Apache License 2.0
8.78k stars 776 forks source link

💡 Please consider "dual / both / mixed" option for edge-ip-version #1141

Open philipstewart opened 8 months ago

philipstewart commented 8 months ago

Describe the feature you'd like

Please consider introducing an additional option to edge-ip-version to prefer connecting to the edge with both IPv4 and IPv6 connections, ideally one of each to each distinct data centre, falling back to all 4 or 6 in the event of a loss/absence of connectivity on the other. Doing so would provide increased resilience in the event of a loss of connectivity affecting only one version.

Describe alternatives you've considered

Run two instances, one with edge-ip-version set to 4 and the other to 6. Happy to do so, but it would seem useful to manage it in one instance, if possible.

Additional context Earlier today one of my tunnels 'collapsed' completely when the route to Cloudflare suddenly lost IPv6 connectivity (logs below), after-which the tunnel reconnected over IPv4.

Jan 05 07:09:32 cloudflared[6359]: 2024-01-05T07:09:32Z WRN Failed to serve quic connection error="failed to accept QUIC stream: timeout: no recent network activity" connIndex=0 event=0 ip=2606:4700:a0::10
Jan 05 07:09:32 cloudflared[6359]: 2024-01-05T07:09:32Z WRN Serve tunnel error error="failed to accept QUIC stream: timeout: no recent network activity" connIndex=0 event=0 ip=2606:4700:a0::10
Jan 05 07:09:32 cloudflared[6359]: 2024-01-05T07:09:32Z WRN Connection terminated error="failed to accept QUIC stream: timeout: no recent network activity" connIndex=0
Jan 05 07:09:33 cloudflared[6359]: 2024-01-05T07:09:33Z ERR writing release: timeout: no recent network activity
Jan 05 07:09:33 cloudflared[6359]: 2024-01-05T07:09:33Z WRN Failed to serve quic connection error="failed to accept QUIC stream: timeout: no recent network activity" connIndex=3 event=0 ip=2606:4700:a8::3
Jan 05 07:09:33 cloudflared[6359]: 2024-01-05T07:09:33Z WRN Serve tunnel error error="failed to accept QUIC stream: timeout: no recent network activity" connIndex=3 event=0 ip=2606:4700:a8::3
Jan 05 07:09:33 cloudflared[6359]: 2024-01-05T07:09:33Z WRN Connection terminated error="failed to accept QUIC stream: timeout: no recent network activity" connIndex=3
Jan 05 07:09:34 cloudflared[6359]: 2024-01-05T07:09:34Z WRN Failed to serve quic connection error="timeout: no recent network activity" connIndex=2 event=0 ip=2606:4700:a0::3
Jan 05 07:09:34 cloudflared[6359]: 2024-01-05T07:09:34Z WRN Serve tunnel error error="timeout: no recent network activity" connIndex=2 event=0 ip=2606:4700:a0::3
Jan 05 07:09:34 cloudflared[6359]: 2024-01-05T07:09:34Z WRN Connection terminated error="timeout: no recent network activity" connIndex=2
Jan 05 07:09:35 cloudflared[6359]: 2024-01-05T07:09:35Z ERR Failed to serve quic connection error="timeout: no recent network activity" connIndex=1 event=0 ip=2606:4700:a8::5
Jan 05 07:09:35 cloudflared[6359]: 2024-01-05T07:09:35Z ERR Serve tunnel error error="timeout: no recent network activity" connIndex=1 event=0 ip=2606:4700:a8::5
Jan 05 07:09:35 cloudflared[6359]: 2024-01-05T07:09:35Z ERR Connection terminated error="timeout: no recent network activity" connIndex=1
Jan 05 07:09:45 cloudflared[6359]: 2024-01-05T07:09:45Z WRN Failed to create new quic connection error="failed to dial to edge with quic: timeout: no recent network activity" connIndex=0 event=0 ip=2606:4700:a0::10
Jan 05 07:09:45 cloudflared[6359]: 2024-01-05T07:09:45Z WRN Failed to create new quic connection error="failed to dial to edge with quic: timeout: no recent network activity" connIndex=3 event=0 ip=2606:4700:a8::3
Jan 05 07:09:46 cloudflared[6359]: 2024-01-05T07:09:46Z WRN Connection terminated error="failed to dial to edge with quic: timeout: no recent network activity" connIndex=3
Jan 05 07:09:48 cloudflared[6359]: 2024-01-05T07:09:48Z WRN Connection terminated error="failed to dial to edge with quic: timeout: no recent network activity" connIndex=0
rturk commented 4 months ago

Dual or anything like would be quite a welcome feature, specially considering that cloudflared already spans a few parallel connections, including to diferent cloudflared datacenters.

As fallback: currently I start two cloudflared instances one with edge-ip-version set to 4 and the other to 6

rturk commented 3 months ago

Also why IPv6 is not the default connection as oposed to IPv4