[GH-ISSUE #6447] port 2096 #4366

Closed
opened 2026-10-31 20:39:10 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @its0ka on GitHub (Sep 10, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6447

is port 2096 default for subs? does every install have it open?
2096 was the only low port on my vps and it got ip blocked in russia.

Describe the solution you'd like

make it random

Alternatives you've considered

No response

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

No response

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @its0ka on GitHub (Sep 10, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6447 ### Is your feature request related to a problem? is port 2096 default for subs? does every install have it open? 2096 was the only low port on my vps and it got ip blocked in russia. ### Describe the solution you'd like make it random ### Alternatives you've considered _No response_ ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? _No response_ ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
bsakaguchi 2026-10-31 20:39:10 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 10, 2026):

Short answer: yes — 2096 is the default subscription port and a fresh panel does listen on it, but nothing in the installer opens it in a firewall, and you can change it yourself today in Settings.

Where 2096 comes from

  • internal/web/service/setting.go:131 — "subPort": "2096",
  • The subscription server is on by default — internal/web/service/setting.go:91 — "subEnable": "true",
  • It binds every interface, because subListen defaults to empty (internal/web/service/setting.go:130) and internal/sub/sub.go builds the address as listenAddr := net.JoinHostPort(listen, strconv.Itoa(port)).

So every fresh panel listens on 0.0.0.0:2096. Whether it is reachable from the internet is your firewall's call: install.sh never touches ufw. The only rule that opens it is ufw allow 2096/tcp #subport in install_firewall() (x-ui.sh:1099), and that function runs only when you pick the firewall option from the x-ui menu (x-ui.sh:1046). On a VPS with no host firewall and no cloud security group, listening does mean open. On the shipped Docker setup it is not published — docker-compose.yml:50 maps only "2053:2053".

Changing it now

  1. Panel → Settings → Subscription → Port (the subPort field, frontend/src/pages/settings/SubscriptionGeneralTab.tsx:105), set your own port and save.
  2. Restart the panel — the Restart Panel button on the Settings page, or on the server:
x-ui restart

The listener is bound only in Server.Start() (internal/sub/sub.go), so saving alone does not rebind it.

Two things worth knowing first:

  • Subscription URLs carry the port — BuildSubURIBase returns fmt.Sprintf("%s://%s:%d", scheme, subDomain, subPort) (internal/web/service/setting.go:1579) — so clients already given a link need the new one.
  • subPort may not collide with the panel's ip:port; internal/web/entity/entity.go:246 rejects (s.SubPort == s.WebPort) && listenAddressesConflict(...).

Two alternatives that remove the exposure entirely:

  • If you never hand out subscription links, turn subEnable off — Server.Start() returns early (internal/sub/sub.go:351, if !subEnable { return nil }) and nothing binds.
  • Or set subListen to 127.0.0.1 and serve subscriptions through a reverse proxy on 443; then 2096 is not exposed at all.

Reference: Subscription and Ports & Firewall.

On the request itself

Randomising it fits what the project already does elsewhere: install.sh picks a random panel port (config_port=$(shuf -i 1024-62000 -n 1), install.sh:1203 and install.sh:1212) and a random web base path (install.sh:1065), and a fresh database gets random subscription paths (seedRandomSubscriptionPaths, internal/database/db.go:1223-1227, three random.NumLower(16) values). The sub port is the one fixed default left. Implementation-wise it is not a one-liner in the installer: x-ui setting has no -subPort flag (the flag set is defined at main.go:606-642, where -port exists but nothing for the sub server), so it would need either a new flag or a seed next to those random paths in db.go.

One thing I could not check from the repository: why your IP was blocked. Nothing in the source tells me what the block keyed on — that a constant 2096 is a stable fingerprint on a default install is my inference, not something the code establishes.

Related but not the same report: #4444 hit the same constant from the other side — setting the panel port to 2096 collided with the subscription server.

Verdict: Feature request

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:5623658319 --> @github-actions[bot] commented on GitHub (Sep 10, 2026): Short answer: yes — `2096` is the default subscription port and a fresh panel does listen on it, but nothing in the installer opens it in a firewall, and you can change it yourself today in Settings. ## Where 2096 comes from - `internal/web/service/setting.go:131` — `"subPort": "2096",` - The subscription server is on by default — `internal/web/service/setting.go:91` — `"subEnable": "true",` - It binds every interface, because `subListen` defaults to empty (`internal/web/service/setting.go:130`) and `internal/sub/sub.go` builds the address as `listenAddr := net.JoinHostPort(listen, strconv.Itoa(port))`. So every fresh panel *listens* on `0.0.0.0:2096`. Whether it is reachable from the internet is your firewall's call: `install.sh` never touches `ufw`. The only rule that opens it is `ufw allow 2096/tcp #subport` in `install_firewall()` (`x-ui.sh:1099`), and that function runs only when you pick the firewall option from the `x-ui` menu (`x-ui.sh:1046`). On a VPS with no host firewall and no cloud security group, listening does mean open. On the shipped Docker setup it is *not* published — `docker-compose.yml:50` maps only `"2053:2053"`. ## Changing it now 1. Panel → **Settings → Subscription → Port** (the `subPort` field, `frontend/src/pages/settings/SubscriptionGeneralTab.tsx:105`), set your own port and save. 2. Restart the panel — the **Restart Panel** button on the Settings page, or on the server: ```bash x-ui restart ``` The listener is bound only in `Server.Start()` (`internal/sub/sub.go`), so saving alone does not rebind it. Two things worth knowing first: - Subscription URLs carry the port — `BuildSubURIBase` returns `fmt.Sprintf("%s://%s:%d", scheme, subDomain, subPort)` (`internal/web/service/setting.go:1579`) — so clients already given a link need the new one. - `subPort` may not collide with the panel's ip:port; `internal/web/entity/entity.go:246` rejects `(s.SubPort == s.WebPort) && listenAddressesConflict(...)`. Two alternatives that remove the exposure entirely: - If you never hand out subscription links, turn `subEnable` off — `Server.Start()` returns early (`internal/sub/sub.go:351`, `if !subEnable { return nil }`) and nothing binds. - Or set `subListen` to `127.0.0.1` and serve subscriptions through a reverse proxy on 443; then 2096 is not exposed at all. Reference: [Subscription](https://docs.sanaei.dev/docs/config/subscription) and [Ports & Firewall](https://docs.sanaei.dev/docs/reference/ports-firewall). ## On the request itself Randomising it fits what the project already does elsewhere: `install.sh` picks a random panel port (`config_port=$(shuf -i 1024-62000 -n 1)`, `install.sh:1203` and `install.sh:1212`) and a random web base path (`install.sh:1065`), and a fresh database gets random subscription *paths* (`seedRandomSubscriptionPaths`, `internal/database/db.go:1223-1227`, three `random.NumLower(16)` values). The sub port is the one fixed default left. Implementation-wise it is not a one-liner in the installer: `x-ui setting` has no `-subPort` flag (the flag set is defined at `main.go:606-642`, where `-port` exists but nothing for the sub server), so it would need either a new flag or a seed next to those random paths in `db.go`. One thing I could not check from the repository: why your IP was blocked. Nothing in the source tells me what the block keyed on — that a constant `2096` is a stable fingerprint on a default install is my inference, not something the code establishes. Related but not the same report: #4444 hit the same constant from the other side — setting the *panel* port to 2096 collided with the subscription server. Verdict: Feature request *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#4366
No description provided.