Unbound service failed on boot in CentOS

Hi,

After every restart or boot, Unbound service failed if I set specific ip
for interface.

My system is CentOS Linux release 7.2.1511 (Core) and Unbound 1.4.20 from
base repo.

/var/log/messages lines:
...
May 25 13:26:09 server systemd: Started Unbound Control Key And
Certificate Generator.
May 25 13:26:09 server systemd: Starting Unbound recursive Domain Name
Server...
May 25 13:26:10 server unbound-checkconf: unbound-checkconf: no errors in
/etc/unbound/unbound.conf
May 25 13:26:10 server systemd: Started Unbound recursive Domain Name Server.
May 25 13:26:10 server unbound: May 25 13:26:10 unbound[956:0] warning:
increased limit(open files) from 1024 to 8290
May 25 13:26:10 server unbound: May 25 13:26:10 unbound[956:0] error:
can't bind socket: Cannot assign requested address
May 25 13:26:10 server unbound: May 25 13:26:10 unbound[956:0] debug:
failed address 192.168.1.7 port 53
May 25 13:26:10 server unbound: May 25 13:26:10 unbound[956:0] fatal
error: could not open ports
May 25 13:26:10 server systemd: unbound.service: main process exited,
code=exited, status=1/FAILURE
May 25 13:26:10 server systemd: Unit unbound.service entered failed state.
May 25 13:26:10 server systemd: unbound.service failed.
...
May 25 13:26:12 server kernel: tg3 0000:0e:00.0 enp14s0: Link is up at
1000 Mbps, full duplex
May 25 13:26:12 server kernel: tg3 0000:0e:00.0 enp14s0: Flow control is
on for TX and on for RX
May 25 13:26:12 server kernel: IPv6: ADDRCONF(NETDEV_CHANGE): enp14s0:
link becomes ready
May 25 13:26:12 server network: Bringing up interface enp14s0: [ OK ]
...

unbound.conf
...
interface: 127.0.0.1
interface: 192.168.1.7
...

/etc/systemd/system/multi-user.target.wants/unbound.service

[Unit]
Description=Unbound recursive Domain Name Server
After=syslog.target network.target
After=unbound-keygen.service
Wants=unbound-keygen.service
Wants=unbound-anchor.timer
Before=nss-lookup.target
Wants=nss-lookup.target

[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/unbound
ExecStartPre=/usr/sbin/unbound-checkconf
ExecStartPre=-/usr/sbin/unbound-anchor -a /var/lib/unbound/root.key -c
/etc/unbound/icannbundle.pem
ExecStart=/usr/sbin/unbound -d $UNBOUND_OPTIONS

[Install]
WantedBy=multi-user.target

If I set interface to 0.0.0.0 service start fine. Any ideas? "After
network.target" in systemd unit file is not sufficient?

Regards,

Maybe something else already bound to port 53 (NSD, Bind, etc.) on
interface 192.168.1.7 (assuming you have that interface address)?

Hi Sonic,

No, because interface with address 192.168.1.7 bring up couple seconds
after Unbound service start. In the moment of starting Unbound service
interface with this address is not up yet.

Regards,