> Markdown version of https://tuna.am/en/docs/troubleshooting/ipv6/. Documentation index: [llms.txt](https://tuna.am/en/llms.txt), full text in one file: [llms-full.txt](https://tuna.am/en/llms-full.txt). Any page is available as Markdown: append `.md` to its URL without the trailing slash.

# Tunnel fails to connect because of IPv6

If the host has IPv6, the tuna client may connect to us over it. Usually you won't notice, but on some hosts IPv4 and IPv6 belong to different networks, and the tunnel can't connect over IPv6. We've seen this on VPS hosts.

## Symptoms

IPv6 is most likely the cause if the host has IPv6 and:

* the tunnel keeps reconnecting or times out while connecting to a node;
* latency through the tunnel is noticeably higher.

## Diagnosis

Check which addresses the host uses to reach the internet and which country they are registered in:

```shell
curl -4 https://ifconfig.co/country
curl -6 https://ifconfig.co/country

```

If the second command returns an answer, the host has IPv6. If the countries differ, this is almost certainly your case.

A detailed connection log shows which addresses the client connects to and where the connection breaks:

```shell
tuna http 8080 --log-level=debug

```

For a general network check, use [`tuna diagnose`](https://tuna.am/en/docs/troubleshooting.md#self-diagnose).

## Fix

Set the `TUNA_FORCE_IPV4=1` environment variable. With it, the client connects to the API and nodes over IPv4 only, and falls back to public DNS servers if the system DNS doesn't work. The variable is available in tuna-cli 0.31.0 and later.

```shell
TUNA_FORCE_IPV4=1 tuna http 8080

```

### systemd service

If the tunnel is installed as a [service](https://tuna.am/en/docs/tunnels/guides/service.md), add the variable in a drop-in. The default service name is `tuna`; a custom one is set with `--name`:

```shell
sudo systemctl edit tuna

```

```ini
[Service]
Environment=TUNA_FORCE_IPV4=1

```

```shell
sudo systemctl restart tuna

```

### Docker

Pass the variable with `-e TUNA_FORCE_IPV4=1` in `docker run`, or under `environment` in Docker Compose:

```yaml
services:
  tuna:
    image: yuccastream/tuna:latest
    command: http app:8080
    environment:
      TUNA_API_KEY: tak_***
      TUNA_FORCE_IPV4: "1"

```

Still not working? Contact [support](https://tuna.am/en/docs/support.md) and attach the `tuna diagnose` output and a log with `--log-level=debug`.
