Mozartaa opened a new issue #8523: URL: https://github.com/apache/dubbo/issues/8523
- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues/3930) of this repository and believe that this is not a duplicate. - [ ] I have checked the [FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate. Hi,when we export a service, if we do not configure the host of the service, dubbo will automatically obtain the local machine IP. As shown in the code below:【ServiceConfig#findConfigedHosts】 ```java hostToBind = InetAddress.getLocalHost().getHostAddress(); ``` When my computer has multiple network adapters, dubbo reads a virtual network adapter. The virtual network adapter was used for registration, but the virtual network adapter cannot provide services to the outside world, causing the consumer to fail to call the service provider successfully. Therefore, I think that when obtaining the machine IP, some judgments should be made to obtain an IP address that can provide services. ### Environment * Dubbo version: 2.7.3 * Operating System version: Windows10 * Java version: 1.8 ### Steps to reproduce this issue 1. config the dubbo ```xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://dubbo.apache.org/schema/dubbo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"> <dubbo:application name="hello-world-app"/> <dubbo:registry address="zookeeper://XXXX:2181"/> <dubbo:protocol name="dubbo" port="20880"/> <dubbo:service interface="com.huawei.api.HelloService" ref="helloService"/> <bean id="helloService" class="com.huawei.impl.HelloServiceImpl"/> </beans> ``` 2. start the provider service ```java public static void main(String[] args) throws Exception { ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("provider.xml"); applicationContext.start(); System.in.read(); } ``` 3.query the zookeeper. The provider service used a virtual IP when registering.   4. consumer call provider failed.  Pls. provide [GitHub address](https://github.com/Mozartaa) to reproduce this issue. ### Expected Result Expect the provider can provide service normally. ### Actual Result The provider service used a virtual IP when registering. If there is an exception, please attach the exception trace: ``` ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
