nomad icon indicating copy to clipboard operation
nomad copied to clipboard

Cannot bind to public IP address on `lo` interface

Open Trojan295 opened this issue 2 years ago • 1 comments

Nomad version

Output from nomad version

Nomad v1.4.3 (f464aca721d222ae9c1f3df643b3c3aaa20e2da7)

Operating system and Environment details

$ uname -a
Linux **** 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet 83.*.*.*/32 scope global lo
       valid_lft forever preferred_lft forever
    inet6 2a11:*:*:*::*/128 scope global 
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever

Issue

I've got a setup, where my public IP address defined on the lo interface. I would like to use it to bind Nomad services to it. The problem is, that when I use

client {
  enabled = true
  network_interface = "lo"
}

it binds the services to 127.0.0.1, which is not really usable.

If I remove the network_interface setting and use bind_addr = "<public_ip>", then Nomad fails to start with:

0 [ERROR] agent: error starting agent: error="client setup failed: fingerprinting failed: Error while detecting network interface  during fingerprinting: No default interface found"

Is there an option to define, which IP should be used to bind services to?

I think this is a similar issue to https://github.com/hashicorp/nomad/issues/5498.

Trojan295 avatar Dec 08 '22 12:12 Trojan295

Hi @Trojan295! This does look similar to #5498 which was closed by https://github.com/hashicorp/nomad/pull/10404. Have you tried using the go-sockaddr syntax that's now available to pick the specific IP address you want?

(Also, I have to ask: why set a public IP on the loopback interface?)

tgross avatar Jan 03 '23 16:01 tgross

It's been a month or so since we've asked for more info on this, and it otherwise looks like a duplicate, so I'm going to close this one out.

tgross avatar Feb 13 '23 14:02 tgross