sozu-proxy / sozu

Sōzu HTTP reverse proxy, configurable at runtime, fast and safe, built in Rust. It is awesome!
https://www.sozu.io/
GNU Affero General Public License v3.0
2.92k stars 188 forks source link

Ipv6 help #1107

Closed AlbanMinassian closed 1 month ago

AlbanMinassian commented 1 month ago

Hello / Bonjour

I managed to get sozu working on an ipv4 machine. Cool. I need help configuring on an ipv6 machine, and this is the first time I've handled ipv6 (Not cool)

I have a machine

I have a nginx application that works fine on port 5999

my sozu file is as follows

command_socket = "/sozu/sock
log_level = "info
log_target = "stdout"
command_buffer_size = 16384
worker_count = 2
handle_process_affinity = false
max_connections = 500
max_buffers = 500
buffer_size = 16384
activate_listeners = true

[[listeners]]
protocol = "http"
address = "[::1]:80"
sticky_name = "SOZUBALANCEID"

[clusters]

[clusters.nginx]
protocol = "http"
load_balancing = "ROUND_ROBIN"
frontends = [
  { position = "POST", address = "[::1]:80", hostname = "[2a01:4f8:1c1e:9dcf::1]", path = "/" },
]
backends = [
    { address = "10.0.0.2:5999", backend_id = "backend_id_1_of_key_cluster_nginx_http" }
]

and the command /sozu/bin/sozu shutdown -c /sozu/config.toml && /sozu/bin/sozu start -c /sozu/config.toml returns

could not create channel to Sōzu. Are you sure the proxy is up?: Connection error: Some(Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })
2024-06-02T10:22:08.274989Z 1717323728274989093 3644 INFO  MAIN Starting up
2024-06-02T10:22:08.275010Z 1717323728275010113 3644 INFO  MAIN Updating process limits
2024-06-02T10:22:08.275051Z 1717323728275051981 3644 INFO  MAIN A socket is already present. Deleting...
2024-06-02T10:22:08.275142Z 1717323728275142380 3644 INFO  MAIN Creating command hub
2024-06-02T10:22:08.275172Z 1717323728275172987 3644 INFO  MAIN Launching workers
writing 0 in the temp file
2024-06-02T10:22:08.276419Z 1717323728276419649 3644 INFO  MAIN launching worker 0
2024-06-02T10:22:08.276729Z 1717323728276729339 3644 INFO  MAIN launching worker 0 with pid 3645
2024-06-02T10:22:08.276798Z 1717323728276798257 3644 INFO  MAIN sending listeners to new worker: Listeners { http: [], tls: [], tcp: [] }
2024-06-02T10:22:08.276842Z 1717323728276842050 3644 INFO  MAIN sent listeners from main: Ok(())
writing 0 in the temp file
2024-06-02T10:22:08.278096Z 1717323728278096957 3644 INFO  MAIN launching worker 1
2024-06-02T10:22:08.278437Z 1717323728278437383 3644 INFO  MAIN launching worker 1 with pid 3646
2024-06-02T10:22:08.278495Z 1717323728278495833 3644 INFO  MAIN sending listeners to new worker: Listeners { http: [], tls: [], tcp: [] }
2024-06-02T10:22:08.278528Z 1717323728278528595 3644 INFO  MAIN sent listeners from main: Ok(())
2024-06-02T10:22:08.278566Z 1717323728278566485 3644 INFO  MAIN Load static configuration
2024-06-02T10:22:08.278588Z 1717323728278588145 3644 INFO  MAIN reloading static configuration
2024-06-02T10:22:08.278599Z 1717323728278599537 3644 INFO  MAIN Reloading static configuration at path /sozu/config.toml
2024-06-02T10:22:08.279396Z 1717323728279396538 3645 INFO  WRK-00   worker 0 starting...
2024-06-02T10:22:08.279580Z 1717323728279580072 3645 INFO  WRK-00   will try to receive listeners
2024-06-02T10:22:08.279612Z 1717323728279612473 3644 ERROR MAIN Got a response for an unknown task: INITIAL-STATUS-0-0
2024-06-02T10:22:08.279690Z 1717323728279690187 3645 INFO  WRK-00   received listeners: Listeners { http: [], tls: [], tcp: [] }
2024-06-02T10:22:08.279791Z 1717323728279791677 3645 INFO  WRK-00   starting event loop
2024-06-02T10:22:08.283409Z 1717323728283409966 3646 INFO  WRK-01   worker 1 starting...
2024-06-02T10:22:08.283645Z 1717323728283645586 3646 INFO  WRK-01   will try to receive listeners
2024-06-02T10:22:08.283676Z 1717323728283676996 3644 ERROR MAIN Got a response for an unknown task: INITIAL-STATUS-1-0
2024-06-02T10:22:08.283678Z 1717323728283678648 3646 INFO  WRK-01   received listeners: Listeners { http: [], tls: [], tcp: [] }
2024-06-02T10:22:08.283802Z 1717323728283802781 3646 INFO  WRK-01   starting event loop
2024-06-02T10:22:08.284208Z 1717323728284208239 3644 INFO  MAIN Successfully loaded the config: 10 ok, 0 errors

curl -g -6 'http://[2a01:4f8:1c1e:9dcf::1]:80' return curl: (7) Failed to connect to 2a01:4f8:1c1e:9dcf::1 port 80 after 0 ms: Couldn't connect to server

I can't find an example in the source code with ipv6.

How can I configure sozu with ipv6 only?

Thanks for your help

FlorentinDUBOIS commented 1 month ago

Hello @AlbanMinassian, From what I see without testing you could use Sōzu with this minor modifications:

command_socket = "/sozu/sock
log_level = "info
log_target = "stdout"
command_buffer_size = 16384
worker_count = 2
handle_process_affinity = false
max_connections = 500
max_buffers = 500
buffer_size = 16384
activate_listeners = true

[[listeners]]
protocol = "http"
address = "[::1]:80"
sticky_name = "SOZUBALANCEID"

[clusters]

[clusters.nginx]
protocol = "http"
load_balancing = "ROUND_ROBIN"
frontends = [
  { position = "TREE", address = "[::1]:80", hostname = "domain_name_that_resolve_the_ipv6", path = "/" },
]

backends = [
    { address = "10.0.0.2:5999", backend_id = "backend_id_1_of_key_cluster_nginx_http" }
]
Wonshtrum commented 1 month ago

I am unable to reproduce the problem, can you confirm that Sozu is listening on the right port? So if you ssh on the machine and run curl -g -6 'http://[::1]:80' do yo get an automatic 404 answer from Sozu?

AlbanMinassian commented 1 month ago

thanks, I'll give it a try