<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.2,  dubbo-admin最新develop分支a21b125</li>
<li>Operating System version: Ubuntu18.04</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>在dubbo-admin里建应用级规则路由。填写应用名时只能写provider的应用名(如demo-provider)</li>
<li>查看zk，生的配置路径为：/dubbo/config/demo-provider/condition-router的Data中。</li>
<li>跟踪consumer请求时的dubbo代码，发现在创建AppRouter时查找路径为消费者(如demo-consumer)的路径/dubbo/config/demo-consumer/condition-router。造成配置不生效。</li>
<li>如果切换到dubbo2.7.3，consumer请求时生成AppRouter时读取ZK路径变为/dubbo/config/dubbo/demo-consumer.condition-router。所以无论2.7.2, 2.7.3 都和admin中配置的路径不一样。</li>
</ol>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.5</li>
<li>Operating System version: CentOS 7.7 (K8S v1.16.6)</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>Use multicast Registry, address: <code class="notranslate">multicast://224.5.6.7:1234</code></li>
<li>Start up application</li>
</ol>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">Application start up succeed.</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">Application start up failed, stack trace</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="java.lang.IllegalStateException: Network is unreachable (sendto failed)
	at org.apache.dubbo.registry.multicast.MulticastRegistry.multicast(MulticastRegistry.java:238)
	at org.apache.dubbo.registry.multicast.MulticastRegistry.doRegister(MulticastRegistry.java:257)
	at org.apache.dubbo.registry.support.FailbackRegistry.register(FailbackRegistry.java:240)
	at org.apache.dubbo.registry.multicast.MulticastRegistry.register(MulticastRegistry.java:377)
	at org.apache.dubbo.registry.ListenerRegistryWrapper.register(ListenerRegistryWrapper.java:57)
	at org.apache.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:412)
	at org.apache.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:396)
	at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:70)
	at org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:73)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:151)
	at org.apache.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java)
	at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:324)
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:266)
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:151)"><pre class="notranslate"><code class="notranslate">java.lang.IllegalStateException: Network is unreachable (sendto failed)
	at org.apache.dubbo.registry.multicast.MulticastRegistry.multicast(MulticastRegistry.java:238)
	at org.apache.dubbo.registry.multicast.MulticastRegistry.doRegister(MulticastRegistry.java:257)
	at org.apache.dubbo.registry.support.FailbackRegistry.register(FailbackRegistry.java:240)
	at org.apache.dubbo.registry.multicast.MulticastRegistry.register(MulticastRegistry.java:377)
	at org.apache.dubbo.registry.ListenerRegistryWrapper.register(ListenerRegistryWrapper.java:57)
	at org.apache.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:412)
	at org.apache.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:396)
	at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:70)
	at org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:73)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:151)
	at org.apache.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java)
	at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:324)
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:266)
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:151)
</code></pre></div>
<p dir="auto">Here's network interfaces</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt; ifconfig
eth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 192.168.40.116  netmask 255.255.240.0  broadcast 192.168.47.255
        inet6 fe80::216:3eff:fe16:3eec  prefixlen 64  scopeid 0x20&lt;link&gt;
        ether 00:16:3e:16:3e:ec  txqueuelen 1000  (Ethernet)
        RX packets 958592  bytes 1408986475 (1.3 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 56904  bytes 4593937 (4.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73&lt;UP,LOOPBACK,RUNNING&gt;  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10&lt;host&gt;
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1698  bytes 7096626 (6.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1698  bytes 7096626 (6.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0"><pre class="notranslate"><span class="pl-k">&gt;</span> ifconfig
eth0: flags=<span class="pl-k">4163&lt;</span>UP,BROADCAST,RUNNING,MULTICAST<span class="pl-k">&gt;</span>  mtu 1500
        inet 192.168.40.116  netmask 255.255.240.0  broadcast 192.168.47.255
        inet6 fe80::216:3eff:fe16:3eec  prefixlen 64  scopeid 0x<span class="pl-k">20&lt;</span>link<span class="pl-k">&gt;</span>
        ether 00:16:3e:16:3e:ec  txqueuelen 1000  (Ethernet)
        RX packets 958592  bytes 1408986475 (1.3 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 56904  bytes 4593937 (4.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=<span class="pl-k">73&lt;</span>UP,LOOPBACK,RUNNING<span class="pl-k">&gt;</span>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x<span class="pl-k">10&lt;</span>host<span class="pl-k">&gt;</span>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1698  bytes 7096626 (6.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1698  bytes 7096626 (6.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0</pre></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt; ifconfig -a
dummy0: flags=130&lt;BROADCAST,NOARP&gt;  mtu 1500
        ether 7e:7f:fe:1a:8f:23  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 192.168.40.116  netmask 255.255.240.0  broadcast 192.168.47.255
        inet6 fe80::216:3eff:fe16:3eec  prefixlen 64  scopeid 0x20&lt;link&gt;
        ether 00:16:3e:16:3e:ec  txqueuelen 1000  (Ethernet)
        RX packets 958636  bytes 1408991887 (1.3 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 56941  bytes 4600900 (4.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

kube-ipvs0: flags=130&lt;BROADCAST,NOARP&gt;  mtu 1500
        inet 172.21.0.1  netmask 255.255.255.255  broadcast 172.21.0.1
        ether 7e:61:57:a0:de:b3  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73&lt;UP,LOOPBACK,RUNNING&gt;  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10&lt;host&gt;
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1813  bytes 7104868 (6.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1813  bytes 7104868 (6.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0"><pre class="notranslate"><span class="pl-k">&gt;</span> ifconfig -a
dummy0: flags=<span class="pl-k">130&lt;</span>BROADCAST,NOARP<span class="pl-k">&gt;</span>  mtu 1500
        ether 7e:7f:fe:1a:8f:23  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=<span class="pl-k">4163&lt;</span>UP,BROADCAST,RUNNING,MULTICAST<span class="pl-k">&gt;</span>  mtu 1500
        inet 192.168.40.116  netmask 255.255.240.0  broadcast 192.168.47.255
        inet6 fe80::216:3eff:fe16:3eec  prefixlen 64  scopeid 0x<span class="pl-k">20&lt;</span>link<span class="pl-k">&gt;</span>
        ether 00:16:3e:16:3e:ec  txqueuelen 1000  (Ethernet)
        RX packets 958636  bytes 1408991887 (1.3 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 56941  bytes 4600900 (4.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

kube-ipvs0: flags=<span class="pl-k">130&lt;</span>BROADCAST,NOARP<span class="pl-k">&gt;</span>  mtu 1500
        inet 172.21.0.1  netmask 255.255.255.255  broadcast 172.21.0.1
        ether 7e:61:57:a0:de:b3  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=<span class="pl-k">73&lt;</span>UP,LOOPBACK,RUNNING<span class="pl-k">&gt;</span>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x<span class="pl-k">10&lt;</span>host<span class="pl-k">&gt;</span>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1813  bytes 7104868 (6.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1813  bytes 7104868 (6.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0</pre></div>
<p dir="auto">The reason is that interface <code class="notranslate">kube-ipvs0</code> is not <code class="notranslate">UP</code>, but was set to <code class="notranslate">MulticastSocket</code> in <code class="notranslate">org.apache.dubbo.common.utils.NetUtils#setInterface</code> method.</p>
<p dir="auto">Should use validNetworkInterfaces</p>
<div class="highlight highlight-source-diff notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@@ -471,10 +471,8 @@ public class NetUtils {
 
     public static void setInterface(MulticastSocket multicastSocket, boolean preferIpv6) throws IOException {
         boolean interfaceSet = false;
-        Enumeration interfaces = NetworkInterface.getNetworkInterfaces();
-        while (interfaces.hasMoreElements()) {
-            NetworkInterface i = (NetworkInterface) interfaces.nextElement();
-            Enumeration addresses = i.getInetAddresses();
+        for (NetworkInterface networkInterface : getValidNetworkInterfaces()) {
+            Enumeration addresses = networkInterface.getInetAddresses();
             while (addresses.hasMoreElements()) {
                 InetAddress address = (InetAddress) addresses.nextElement();
                 if (preferIpv6 &amp;&amp; address instanceof Inet6Address) {"><pre class="notranslate"><span class="pl-mdr">@@ -471,10 +471,8 @@</span> public class NetUtils {
 
     public static void setInterface(MulticastSocket multicastSocket, boolean preferIpv6) throws IOException {
         boolean interfaceSet = false;
<span class="pl-md"><span class="pl-md">-</span>        Enumeration interfaces = NetworkInterface.getNetworkInterfaces();</span>
<span class="pl-md"><span class="pl-md">-</span>        while (interfaces.hasMoreElements()) {</span>
<span class="pl-md"><span class="pl-md">-</span>            NetworkInterface i = (NetworkInterface) interfaces.nextElement();</span>
<span class="pl-md"><span class="pl-md">-</span>            Enumeration addresses = i.getInetAddresses();</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>        for (NetworkInterface networkInterface : getValidNetworkInterfaces()) {</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>            Enumeration addresses = networkInterface.getInetAddresses();</span>
             while (addresses.hasMoreElements()) {
                 InetAddress address = (InetAddress) addresses.nextElement();
                 if (preferIpv6 &amp;&amp; address instanceof Inet6Address) {</pre></div>
<p dir="auto">or just check <code class="notranslate">UP</code> flag</p>
<div class="highlight highlight-source-diff notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@@ -474,6 +474,9 @@ public class NetUtils {
         Enumeration interfaces = NetworkInterface.getNetworkInterfaces();
         while (interfaces.hasMoreElements()) {
             NetworkInterface i = (NetworkInterface) interfaces.nextElement();
+            if (!i.isUp()) {
+                continue;
+            }
             Enumeration addresses = i.getInetAddresses();
             while (addresses.hasMoreElements()) {
                 InetAddress address = (InetAddress) addresses.nextElement();
"><pre class="notranslate"><span class="pl-mdr">@@ -474,6 +474,9 @@</span> public class NetUtils {
         Enumeration interfaces = NetworkInterface.getNetworkInterfaces();
         while (interfaces.hasMoreElements()) {
             NetworkInterface i = (NetworkInterface) interfaces.nextElement();
<span class="pl-mi1"><span class="pl-mi1">+</span>            if (!i.isUp()) {</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                continue;</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>            }</span>
             Enumeration addresses = i.getInetAddresses();
             while (addresses.hasMoreElements()) {
                 InetAddress address = (InetAddress) addresses.nextElement();
</pre></div>