How to configure the interface to only use certain NIC

Solution Unverified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x
    • 7.0.x

Issue

  • There are 2 NICs with the same IP address, but one NIC is down.

    # ip address show
    ...
    3: ens9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
        link/ether 52:54:00:ee:c6:16 brd ff:ff:ff:ff:ff:ff
        inet 192.168.1.1/24 scope global ens9
           valid_lft forever preferred_lft forever
    4: ens10: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
        link/ether 52:54:00:52:78:ca brd ff:ff:ff:ff:ff:ff
        inet 192.168.1.1/24 scope global ens10
           valid_lft forever preferred_lft forever
    

    And my standalone.xml (or host.xml in domain mode) has <up/> criteria to identify a NIC uniquely.

        <interfaces>
            <interface name="management">
                <up/>
                <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
            </interface>
            <interface name="public">
                <up/>
                <inet-address value="${jboss.bind.address:127.0.0.1}"/>
            </interface>
        </interfaces>
    

    But my server is not able to start with the following errors.

    # $JBOSS_HOME/bin/standalone.sh -b 192.168.1.1 -bmanagement=192.168.1.1
    ...
    04:38:52,839 WARN  [org.jboss.as.controller] (MSC service thread 1-3) WFLYCTL0023: Value '192.168.1.1' for interface selection criteria 'inet-address' is ambiguous, as more than one address or network interface available on the machine matches it. Because of this ambiguity,
     no address will be selected as a match. Matching addresses: [/192.168.1.1].  Matching network interfaces: [ens9, ens10].
    04:38:52,840 WARN  [org.jboss.as.controller] (MSC service thread 1-4) WFLYCTL0023: Value '192.168.1.1' for interface selection criteria 'inet-address' is ambiguous, as more than one address or network interface available on the machine matches it. Because of this ambiguity,
     no address will be selected as a match. Matching addresses: [/192.168.1.1].  Matching network interfaces: [ens9, ens10].
    04:38:52,840 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.network.public: org.jboss.msc.service.StartException in service jboss.network.public: WFLYSRV0082: failed to resolve interface public
            at org.jboss.as.server.services.net.NetworkInterfaceService.start(NetworkInterfaceService.java:91)
            at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
            at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
     
    
    04:38:52,841 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.network.management: org.jboss.msc.service.StartException in service jboss.network.management: WFLYSRV0082: failed to resolve interface management
            at org.jboss.as.server.services.net.NetworkInterfaceService.start(NetworkInterfaceService.java:91)
            at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
            at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
    ...
    

Resolution

Upgrade to EAP 6.4 CP16 or 7.1.0. These will be released Q2 or Q3 of 2017.

Root Cause

There is a bug1 in a logic of identifying a listen socket.

Diagnostic Steps

This bug is not always reproducible. In some cases, a server is able to start without the issue. EAP 7 is more likely able to avoid the issue than EAP 6.

Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.