# Self hosted charm issue with ssh tcp

**URL:** <https://community.fly.io/t/self-hosted-charm-issue-with-ssh-tcp/18995>\
**Category:** General\
**Tags:** login-only\
**Created:** [March 29, 2024, 4:53am UTC](https://community.fly.io/t/self-hosted-charm-issue-with-ssh-tcp/18995 "2024-03-29T04:53:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaythedeveloper](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jaythedeveloper/32/48725_2.png) [@jaythedeveloper](https://community.fly.io/u/jaythedeveloper)\
**Post date:** [March 29, 2024, 4:54am UTC](https://community.fly.io/t/self-hosted-charm-issue-with-ssh-tcp/18995/1 "2024-03-29T04:54:00Z")

</div>

I’m trying to run a self hosted [charm](https://github.com/charmbracelet/charm) instance and running into an issue with connecting to the instance over ssh.

I’ve got the following configuration that seems to work for the http side of things but with tcp and ssh i get the following error when trying to use charm cli app.

```auto
kex_exchange_identification: read: Connection reset by peer

```

and

```auto
Error: ssh: handshake failed: read tcp 172.23.135.145:35748->66.241.125.123:35353: read: connection reset by peer

```

I know I can reach the fly machine when i try just a http connection because i see this in my logs

```auto
yd [error] could not proxy TCP data to/from instance: failed to copy (direction=server->client, error=Connection reset by peer (os error 104))

```

My fly.toml

```auto
# fly.toml app configuration file generated for <app-name> on 2024-03-29T16:14:12+13:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = '<app-name>'
primary_region = 'syd'

[build]
  image = 'charmcli/charm:latest'

[env]
  CHARM_SERVER_HOST='<app-name>.fly.dev'
  CHARM_SERVER_PUBLIC_URL='https://<app-name>.fly.dev:35354'

[[mounts]]
  source = 'vol_vault'
  destination = '/data'
  initial_size = '1gb'

[[services]]
  protocol = 'tcp'
  internal_port = 35354
  processes = ['app']

[[services.ports]]
    start_port = 35354
    end_port = 35354
    handlers = ['tls', 'http']

[[services]]
  protocol = 'tcp'
  internal_port = 35353
  processes = ['app']

[[services.ports]]
    start_port = 35353
    end_port = 35353

[[vm]]
  size = 'shared-cpu-1x'
  memory = '256mb'

```

---

<div class="post-metadata">

**Author:** ![rubys](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/rubys/32/16907_2.png) [@rubys](https://community.fly.io/u/rubys)\
**Post date:** [March 29, 2024, 6:00am UTC](https://community.fly.io/t/self-hosted-charm-issue-with-ssh-tcp/18995/2 "2024-03-29T06:00:57Z")

</div>

Just a guess, but are you using a shared IPv4? It is the default:

> **[Public Network Services](https://fly.io/docs/networking/services/#shared-ipv4)**
>
> Documentation and guides from the team at Fly.io.

You likely need a dedicated ipv4 address.

---

<div class="post-metadata">

**Author:** ![jaythedeveloper](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jaythedeveloper/32/48725_2.png) [@jaythedeveloper](https://community.fly.io/u/jaythedeveloper)\
**Post date:** [March 29, 2024, 6:34am UTC](https://community.fly.io/t/self-hosted-charm-issue-with-ssh-tcp/18995/3 "2024-03-29T06:34:03Z")

</div>

@rubys 🤦‍♂️that appears to be the problem yeah. Just changed to dedicated and worked first time.

Is there some different network handling of public shared IPv4 compared to dedicated that makes it work?

---

<div class="post-metadata">

**Author:** ![rubys](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/rubys/32/16907_2.png) [@rubys](https://community.fly.io/u/rubys)\
**Post date:** [March 29, 2024, 11:53am UTC](https://community.fly.io/t/self-hosted-charm-issue-with-ssh-tcp/18995/4 "2024-03-29T11:53:17Z")

</div>

My understanding (and this is outside my area of expertise) is that we have a HTTP proxy server that will route requests to the correct host based on the HTTP `Host` header. This, of course, only works for HTTP requests. With a private IPv4 addressed, the request will route to the nearest machine in the application that owns the IP address.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [April 5, 2024, 11:54am UTC](https://community.fly.io/t/self-hosted-charm-issue-with-ssh-tcp/18995/5 "2024-04-05T11:54:04Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
