2

This is my consul.service file.

[Unit]
Description="HashiCorp Consul - A service mesh solution"
Documentation=https://www.consul.io/
Requires=network-online.target
After=network-online.target

[Service] Type=simple User=consul Group=consul LimitNOFILE=1024 ExecStart=/usr/bin/consul agent -config-dir=/etc/consul.d/ ExecReload=/bin/kill --signal HUP $MAINPID KillMode=process Restart=on-failure RestartSec=5 KillSignal=SIGINT

[Install] WantedBy=multi-user.target

I did sudo chown -R consul:consul /etc/consul.d/ because I created a consul user as well.

and this is my /etc/config.d directory:

$ tree /etc/consul.d/
/etc/consul.d/
├── bootstrap
│   └── config.json
├── client
└── server
    └── config.json

this is the server config. cat /etc/consul.d/server/config.json

{
    "bootstrap": false,
    "server": true,
    "datacenter": "lon",
    "advertise_addr": "192.168.0.16",
    "client_addr": "0.0.0.0",
    "bind_addr": "{{GetInterfaceIP \"eth0\"}}",
    "data_dir": "/var/consul/",
    "log_level": "INFO",
    "enable_syslog": true,
    "retry_join": ["192.168.0.16"]
}

cat /etc/consul.d/bootstrap/config.json

{
    "bootstrap": true,
    "server": true,
    "datacenter": "lon",
    "advertise_addr": "192.168.0.16",
    "client_addr": "0.0.0.0",
    "bind_addr": "{{GetInterfaceIP \"eth0\"}}",
    "data_dir": "/var/consul/",
    "log_level": "INFO",
    "enable_syslog": true,
    "retry_join": ["192.168.0.16"]
}

And I have validated the consul config for server and bootstrap configurations.

consul validate  /etc/consul.d/server/config.json 
Configuration is valid!

but I keep getting error saying:

 consul[21711]: ==> Multiple private IPv4 addresses found. Please configure one with 'bind' and/or 'advertise'.

I tried this command too

~/go/bin$ ./sockaddr eval GetPrivateIP
192.168.0.16

what am I missing ?

0 Answers0