zhboner / realm

A network relay tool
MIT License
1.61k stars 291 forks source link

ipv6 Address in use (os error 98) #124

Closed f4nff closed 6 months ago

f4nff commented 8 months ago
[log]
level = "off"
output = "/var/log/realm.log"

[network]
no_tcp = false
use_udp = false

[[endpoints]]
listen = "[::]:443"
remote = "[2605:e440:5::1:215]:1443"

[[endpoints]]
listen = "[::]:80"
remote = "[2605:e440:5::1:215]:2082"
thread 'tokio-runtime-worker' panicked at '[tcp]failed to bind [::]:443: Address in use (os error 98)', /project/realm_core/src/tcp/mod.rs:36:55
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'tokio-runtime-worker' panicked at '[tcp]failed to bind [::]:80: Address in use (os error 98)', /project/realm_core/src/tcp/mod.rs:36:55
zephyrchien commented 8 months ago

Hi @f4nff, do you mind providing more information to help reproduce this error?

Was ipv4:port in use(occupied by another app)?

Realm always sets IPV6_ONLY to false, consequently binding ipv6:port would also bind ipv4:port . That may explain how this error happened.

f4nff commented 8 months ago

How to set IPV6_ONLY to true ?

f4nff commented 8 months ago
[log]
level = "off"
output = "/var/log/realm.log"

[network]
no_tcp = false
use_udp = false

[[endpoints]]
listen = "0.0.0.0:80"
remote = "[2605:e440:5::1:21]:2082"

[[endpoints]]
listen = "0.0.0.0:443"
remote = "[2605:e440:5::1:21]:1443"

[[endpoints]]
listen = "[::]:80"
remote = "[2605:e440:5::1:21]:2082"

[[endpoints]]
listen = "[::]:443"
remote = "[2605:e440:5::1:21]:1443"
f4nff commented 8 months ago
root@lax-9929 ~/realm # ./realm -c 1.toml
fd: soft=1020000, hard=1020000
log: level=off, output=/var/log/realm.log
dns: mode=ipv4_and_ipv6, protocol=tcp+udp, min-ttl=0, max-ttl=86400, cache-size=32, servers=system
inited: 0.0.0.0:80 -> [[2605:e440:5::1:21]:2082]; options: send-proxy=false, send-proxy-version=2, accept-proxy=false, accept-proxy-timeout=5s; connect-timeout=5s, associate-timeout=30s; balance=off
inited: 0.0.0.0:443 -> [[2605:e440:5::1:21]:1443]; options: send-proxy=false, send-proxy-version=2, accept-proxy=false, accept-proxy-timeout=5s; connect-timeout=5s, associate-timeout=30s; balance=off
inited: [::]:80 -> [[2605:e440:5::1:21]:2082]; options: send-proxy=false, send-proxy-version=2, accept-proxy=false, accept-proxy-timeout=5s; connect-timeout=5s, associate-timeout=30s; balance=off
inited: [::]:443 -> [[2605:e440:5::1:21]:1443]; options: send-proxy=false, send-proxy-version=2, accept-proxy=false, accept-proxy-timeout=5s; connect-timeout=5s, associate-timeout=30s; balance=off
thread 'tokio-runtime-worker' panicked at '[tcp]failed to bind [::]:80: Address in use (os error 98)', /project/realm_core/src/tcp/mod.rs:36:55
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'tokio-runtime-worker' panicked at '[tcp]failed to bind [::]:443: Address in use (os error 98)', /project/realm_core/src/tcp/mod.rs:36:55
zephyrchien commented 8 months ago

Try this command to make sure there have been other apps occupying the ports.

ss -lt --ipv4 'sport = :80 or sport = :443'
zephyrchien commented 8 months ago

In the latest(v2.5.4) version, a new option ipv6-only is introduced.

Please try adding ipv6_only = true under the network section in the previously mentioned config. Or adding --ipv6 to the startup command.