Eureka client registers with wrong IP address

5,131 views
Skip to first unread message

Gaël Marziou

unread,
Feb 12, 2016, 5:53:45 PM2/12/16
to JHipster dev team
Hi all,

On my Linux machine where Docker is installed, I found that the gateway registers using docker0 IP address (172.x.x.x), as a result when I go in the registry dashboard and I click on the gateway link it does not work.
More important, the Eureka server cannot check that the client is up and this is probably why I get this warning:

EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE NOT. RENEWALS ARE LESSER THAN THRESHOLD AND HENCE THE INSTANCES ARE NOT BEING EXPIRED JUST TO BE SAFE.


This is caused by the Eureka client which does not respect server.address property and uses default detection in org.springframework.cloud.util.InetUtils#getFirstNonLoopbackAddress which finds docker0 address.

I commented on 2 related issues:

https://github.com/spring-cloud/spring-cloud-netflix/issues/815

https://github.com/spring-cloud/spring-cloud-commons/issues/88

Hopefully spring-cloud will fix it as this could be a blocking problem.

--
Gael





Julien Dubois

unread,
Feb 13, 2016, 10:06:53 AM2/13/16
to Gaël Marziou, JHipster dev team

Or maybe we could patch this in our code ?
This is a great bug, it shows we go further than many people with Eureka.

--
You received this message because you are subscribed to the Google Groups "JHipster dev team" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jhipster-dev...@googlegroups.com.
To post to this group, send email to jhipst...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jhipster-dev/bbc0d4bb-0313-48af-aa52-5b1ab78e46af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gaël Marziou

unread,
Feb 13, 2016, 10:38:05 AM2/13/16
to JHipster dev team
I tried what Dave Syer suggested

eureka:
    instance:
        prefer-ip-address: false
        hostname: 220.2.3.2

It works but only if prefer-ip-address is false and I don't really understand what it implies.

Also, I have some similar concern about the port, I'd like to be able to use server.port=0 to get random port.
I think that random ports and discovery at registration could be useful

Julien Dubois

unread,
Feb 13, 2016, 11:14:56 AM2/13/16
to Gaël Marziou, JHipster dev team

Oh, I put prefer-ip to true as this causing issues with VirtualBox: all the "devbox" have the same name, so you need to use the IP (this is in bridge mode, with a new MAC address per box)

--
You received this message because you are subscribed to the Google Groups "JHipster dev team" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jhipster-dev...@googlegroups.com.
To post to this group, send email to jhipst...@googlegroups.com.

Gaël Marziou

unread,
Feb 13, 2016, 11:50:43 AM2/13/16
to JHipster dev team, gael.m...@gmail.com
I knew it did not seem right.
Most of the issues here seems to be related to VMs or Docker networking.

I wonder whether the client's IP address could be determined by server from the origin of the connection at registration time.

Deepu K Sasidharan

unread,
Feb 13, 2016, 1:09:17 PM2/13/16
to Gaël Marziou, JHipster dev team

I saw a linux bug somewhere few days back which was talking about kernel giving wrong ip to vm and docker, could it be related. I couldn't find that source since i saw it on twitter

--
You received this message because you are subscribed to the Google Groups "JHipster dev team" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jhipster-dev...@googlegroups.com.
To post to this group, send email to jhipst...@googlegroups.com.

Gaël Marziou

unread,
Feb 13, 2016, 6:25:16 PM2/13/16
to JHipster dev team, gael.m...@gmail.com
I got it working by setting eureka.instance.ip-address while using prefer-ip-address to true in application.yml.

eureka:
    instance:
        prefer-ip-address: true
        ip-address: ${server.address}

So maybe, this should be our default setup.

Gaël Marziou

unread,
Feb 16, 2016, 6:09:09 PM2/16/16
to JHipster dev team
I found in the doc that some named network interfaces could be ignored

http://projects.spring.io/spring-cloud/spring-cloud.html#ignore-network-interfaces

Maybe we could provide a default list to prevent our users to fall into this common trap, always excluding docker0

spring:
  cloud:
    inetutils:
      ignoredInterfaces:
        - docker0
        - veth.*

Julien Dubois

unread,
Feb 16, 2016, 6:15:12 PM2/16/16
to Gaël Marziou, JHipster dev team
Very interesting.
This is going to be complex to test, but this is where we add a lot of value, compared to what Spring Cloud provides by default.

--
You received this message because you are subscribed to the Google Groups "JHipster dev team" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jhipster-dev...@googlegroups.com.
To post to this group, send email to jhipst...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Julien Dubois

Gaël Marziou

unread,
Feb 20, 2016, 4:39:06 PM2/20/16
to JHipster dev team, gael.m...@gmail.com
It seems something changed in registry or maybe on my machine, anyway I had to configure eureka client this way putting both hostname and ip-address:

eureka:
instance:
prefer-ip-address: true
hostname: ${server.address}
ip-address: ${server.address}



Julien Dubois

unread,
Feb 21, 2016, 3:01:13 AM2/21/16
to Gaël Marziou, JHipster dev team
Thanks Gaël, I will definitely have to do more test with this. My current goal is to be able to have the Registry in a Docker container, so it's easier to deploy & test, as long as we don't have too many networking issues!

--
You received this message because you are subscribed to the Google Groups "JHipster dev team" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jhipster-dev...@googlegroups.com.
To post to this group, send email to jhipst...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages