1

I have many local IP addresses on my host (Windows):

$ ipconfig | find "IPv4"

  • IPv4 address. . . . .: 192.168.55.1
  • IPv4 address. . . . .: 10.11.12.38
  • IPv4 address. . . . .: 172.16.10.5
  • IPv4 address. . . . .: 192.168.87.29

When I start SpringCloud application, it's health on Spring Cloud server (Eureka?) dashborad is unknown. Moreover, on server dashboard it shows my registered service with "192.168.55.1" (this is a first IP from my list, but it is a Virtual Adapter IP address). I suppose, that there is no route from SpringCloud server (Eureka?) to this IP, thats why my service's health is unknown (it cannot ping back service).

I want to restrict my SpringCloud service application to bind only to certain IP addresses (or even masks), f.e. only 10.X.X.X network. How can I do it?

1 Answer 1

1

One way is to simply set your eureka.instance.hostname to the IP address that you want to bind to. This is probably the easiest. Another (with Brixton snapshots) is to configure a pattern for the name of the network adapter you want to bind to.

6
  • Well, I'd like to specify some kind of net mask, f.e. 10.255.255.255/32 or something like this, not exact IP address
    – lospejos
    Feb 3, 2016 at 12:08
  • I guess the network interface name might work then? The mask is an interesting idea for a new feature in InetUtils. If this is for local development I expect "localhost" will work just fine as well.
    – Dave Syer
    Feb 3, 2016 at 12:18
  • As far as I undertstod from here (projects.spring.io/spring-cloud/spring-cloud.html, topic "Ignore Network Interfaces"), this allows me to filter network interface names, not IPs.
    – lospejos
    Feb 3, 2016 at 12:19
  • I want to get some flexibility (filter IPs, masks, their priorities), to be able to deploy application WITHOUT CHANGING THIS SETTINGS on local host (f.e. 192.168.11.5) and on the server (f.e. 192.168.11.1). I see it like some kind of preference like this: my.server.preferredHosts=10.0.255.0/32,192.168.1.0/32,192.168.11.0/32 where order does matter
    – lospejos
    Feb 3, 2016 at 12:21
  • I don't really understand how that would work, but please open an issue in spring-cloud-commons and we can discuss it there if you like.
    – Dave Syer
    Feb 3, 2016 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.