{"record":{"id":"676e4d0707a461f2","repo":"apache/hadoop","slug":"no-such-interface-strinterface","errorCode":null,"errorMessage":"No such interface ${strInterface}","messagePattern":"No such interface (.+?)","errorType":"exception","errorClass":"UnknownHostException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/DNS.java","lineNumber":191,"sourceCode":"   * \n   */\n  public static String[] getIPs(String strInterface,\n      boolean returnSubinterfaces) throws UnknownHostException {\n    if (\"default\".equals(strInterface)) {\n      return new String[] { cachedHostAddress };\n    }\n    NetworkInterface netIf;\n    try {\n      netIf = NetworkInterface.getByName(strInterface);\n      if (netIf == null) {\n        netIf = getSubinterface(strInterface);\n      }\n    } catch (SocketException e) {\n      LOG.warn(\"I/O error finding interface {}\", strInterface, e);\n      return new String[] { cachedHostAddress };\n    }\n    if (netIf == null) {\n      throw new UnknownHostException(\"No such interface \" + strInterface);\n    }\n\n    // NB: Using a LinkedHashSet to preserve the order for callers\n    // that depend on a particular element being 1st in the array.\n    // For example, getDefaultIP always returns the first element.\n    LinkedHashSet<InetAddress> allAddrs = new LinkedHashSet<InetAddress>();\n    allAddrs.addAll(Collections.list(netIf.getInetAddresses()));\n    if (!returnSubinterfaces) {\n      allAddrs.removeAll(getSubinterfaceInetAddrs(netIf));\n    }\n\n    String ips[] = new String[allAddrs.size()];\n    int i = 0;\n    for (InetAddress addr : allAddrs) {\n      ips[i++] = addr.getHostAddress();\n    }\n    return ips;\n  }","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/DNS.java#L173-L209","documentation":"UnknownHostException('No such interface <name>') thrown by DNS.getIPs (string variant, used to resolve this machine's own IP) when NetworkInterface.getByName(strInterface) and the sub-interface lookup both return null — i.e., the configured network interface name does not exist on the host. The interface usually comes from properties like 'dfs.datanode.dns.interface' or 'mapreduce.tasktracker.dns.interface'; a SocketException during the lookup is caught and degrades to the cached host address instead, so this throw specifically means 'name not found'.","triggerScenarios":"Configuration names an interface absent on the machine: 'dfs.datanode.dns.interface=eth0' on a host whose NIC is 'ens33' or 'enp0s3'; typo in the interface name; container/minimal-VM environments that only expose 'lo' or 'eth1'.","commonSituations":"Cloud images and modern distros using predictable NIC names (ens*, enp*) while configs assume eth0; moving a Hadoop config between bare-metal and VMs; Docker containers with renamed veth interfaces.","solutions":["List real interfaces on the node with 'ip link show' or 'ifconfig -a'","Set the dns.interface property to an existing interface name, or to 'default' to use the canonical hostname resolution instead","If the interface exists but is named differently per node, use per-node config or switch to 'dfs.datanode.dns.nameserver' + 'dfs.datanode.dns.matcher' hostname-based resolution"],"exampleFix":"# before\n<property><name>dfs.datanode.dns.interface</name><value>eth0</value></property>  # host only has ens33 -> UnknownHostException at startup\n\n# after\n<property><name>dfs.datanode.dns.interface</name><value>ens33</value></property>","handlingStrategy":"validation","validationCode":"String ifName = conf.get(\"dfs.datanode.dns.interface\", \"default\");\nif (!\"default\".equals(ifName) && NetworkInterface.getByName(ifName) == null) {\n  throw new IllegalStateException(\"dfs.datanode.dns.interface \" + ifName + \" does not exist; found: \"\n      + Collections.list(NetworkInterface.getNetworkInterfaces()));\n}","typeGuard":null,"tryCatchPattern":"catch (UnknownHostException e) { /* 'No such interface <name>' */ fail fast at startup with the list of available interfaces; }","preventionTips":["Validate dns.interface names against 'ip link' output during provisioning","Prefer 'default' or hostname-based resolution when hardware naming varies across the fleet","Re-check after OS upgrades that rename NICs (predictable names)"],"tags":["dns","network-interface","configuration","datanode","hadoop-common"],"backgroundTag":"network-interface-not-found","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}