u/YinAndYangFang

TCP Connection for Git being refused

I'm trying to get NetBird integrated in my Homelab, but am hitting an issue with deploying GitLab.

I've got a host running the management & proxy cluster of services on one host and a netbird client (exposing subnet 172.11.1.0/24) & GitLab (172.11.1.3) on another host. GitLab expects SSH connections through the host's port 2424, and I've created a TCP Service to forward TCP traffic to git.example.com on port 2424 to 172.11.1.3:2424.

When attempting to `git clone ssh://git@git.scottfries.com:2424/homelab/group/project.git`, I get a kex_exchange_identification error:

Cloning into 'project'...
kex_exchange_identification: read: Connection reset by peer
Connection reset by <my public IP> port 2424
fatal: Could not read from remote repository.

And inside of the netbird-proxy's logs I get:

2026-04-26T19:26:00.198529789Z 2026-04-26T19:26:00.198Z WARN [service_id: d7n4qp32951s73atffp0, target: 172.11.1.3:2424] proxy/internal/tcp/router.go:360: TCP relay (fallback): dial backend 172.11.1.3:2424: connect tcp 172.11.1.3:2424: connection was refused

But if I circumvent NetBird with a `git clone ssh://git@<GitLab host local IP>:2424/homelab/group/project.git` I can reach the endpoint without any issue.

GitLab's compose.yaml

networks:
  gitlab:
    driver: bridge
    ipam:
      config:
        - subnet: 172.12.0.0/24
          gateway: 172.12.0.1
  netbird-services:
    external: true


secrets:
  SMTP_PASSWORD:
    file: ./secrets/SMTP_PASSWORD
  GITHUB_CLIENT_ID:
    file: ./secrets/GITHUB_CLIENT_ID
  GITHUB_CLIENT_SECRET:
    file: ./secrets/GITHUB_CLIENT_SECRET


services:
  gitlab:
    image: docker.io/gitlab/gitlab-ce:18.8.0-ce.0
    container_name: gitlab
    restart: unless-stopped
    shm_size: '256m'
    networks:
      gitlab:
        ipv4_address: 172.12.0.11
      netbird-services:
        ipv4_address: 172.11.1.3
    ports:
      - 80:80
      - 443:443
      - 5000:5000
      - 2424:22
    volumes:
      - ./config/gitlab.rb:/etc/gitlab/gitlab.rb:ro
      - /mnt/homelab_data/gitlab/config:/etc/gitlab
      - /mnt/homelab_data/gitlab/logs:/var/log/gitlab
      - /mnt/homelab_data/gitlab/data:/var/opt/gitlab
    secrets:
      - SMTP_PASSWORD
      - GITHUB_CLIENT_ID
      - GITHUB_CLIENT_SECRET

Has anyone experienced this error before? Does anyone have any suggestions on how to further debug where the connection is failing?

reddit.com
u/YinAndYangFang — 3 days ago