{"record":{"id":"8c9d47c4c85732d9","repo":"SonarSource/sonarqube","slug":"unable-to-get-a-valid-mac-address-will-use-a-dumm","errorCode":null,"errorMessage":"Unable to get a valid mac address, will use a dummy address","messagePattern":"Unable to get a valid mac address, will use a dummy address","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"server/sonar-server-common/src/main/java/org/sonar/server/platform/serverid/MacAddressProvider.java","lineNumber":56,"sourceCode":"  private static final Logger LOGGER = LoggerFactory.getLogger(MacAddressProvider.class);\n  private static final SecureRandom SECURE_RANDOM = new SecureRandom();\n  public static final int BYTE_SIZE = 6;\n\n  private MacAddressProvider() {\n    // only static stuff\n  }\n\n  public static byte[] getSecureMungedAddress() {\n    byte[] address = null;\n    try {\n      address = getMacAddress();\n    } catch (SocketException se) {\n      LOGGER.warn(\"Unable to get mac address, will use a dummy address\", se);\n      // address will be set below\n    }\n\n    if (!isValidAddress(address)) {\n      LOGGER.warn(\"Unable to get a valid mac address, will use a dummy address\");\n      address = constructDummyMulticastAddress();\n    }\n\n    byte[] mungedBytes = new byte[BYTE_SIZE];\n    SECURE_RANDOM.nextBytes(mungedBytes);\n    for (int i = 0; i < BYTE_SIZE; ++i) {\n      mungedBytes[i] ^= address[i];\n    }\n\n    return mungedBytes;\n  }\n\n  private static boolean isValidAddress(@Nullable byte[] address) {\n    if (address == null || address.length != BYTE_SIZE) {\n      return false;\n    }\n    for (byte b : address) {\n      if (b != 0x00) {","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-server-common/src/main/java/org/sonar/server/platform/serverid/MacAddressProvider.java#L38-L74","documentation":"After (possibly) catching a SocketException, getSecureMungedAddress() validates the MAC address. If the address is null or not a valid unicast address (e.g. loopback, all-zero), this second warning is logged and a locally-administered dummy multicast address is constructed. Server id generation continues using secure random munged bytes, so this is a fallback, not a failure.","triggerScenarios":"NetworkInterface enumeration returned only invalid addresses (loopback-only VMs, all-zero MACs from virtualized NICs, certain VPS/cloud instances) so isValidAddress(address) returns false.","commonSituations":"Cloud VMs or containers with virtual NICs reporting zeroed MACs; hosts with only the loopback interface up; network drivers reporting null hardware addresses; Mac OS/Linux environments with unusual bonding/virtual bridges.","solutions":["Bring up a real network interface so a valid MAC is visible to the JVM.","If server id must be stable across clones/containers, generate it once and reuse it (server id management in Administration > System), rather than relying on the MAC.","Accept the dummy address if the server id is stored — it remains valid and unique.","Check JVM access to interface hardware addresses (some hardened environments block reading hwaddr).","Only investigate if you see this warning repeatedly with changing server ids, e.g. licensing or telemetry issues."],"exampleFix":"// before\nip link set eth0 down\n// after\nip link set eth0 up","handlingStrategy":"fallback","validationCode":"# ensure a real MAC is visible before server-id generation\nmac=$(cat /sys/class/net/$(ip route show default | awk '/default/ {print $5}')/address 2>/dev/null)\n[ -n \"$mac\" ] && [ \"$mac\" != \"00:00:00:00:00:00\" ] || echo 'WARNING: invalid MAC, server id will use dummy address'","typeGuard":null,"tryCatchPattern":"// treat the warning as benign if the server id is persisted; alert only on instability\nif (!MacAddressProvider.isValidAddress(address)) {\n    logger.warn(\"Using dummy MAC for server id; persist the server id to keep it stable\");\n}","preventionTips":["Bring up a physical/virtual NIC so a valid MAC is reported.","On cloned VMs, reuse an existing server id instead of regenerating.","Ignore the warning only when server id persistence is confirmed.","Verify hardware address visibility from the JVM on hardened hosts."],"tags":["sonarqube","network","server-id","mac-address"],"backgroundTag":"missing-network-interface","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}