zhboner/realm

ipv6 Address in use (os error 98)

Closed this issue · 6 comments

[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

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.

How to set IPV6_ONLY to true ?

[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"


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

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

ss -lt --ipv4 'sport = :80 or sport = :443'

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.