Ohai not selecting IP address

On a bare metal system we have two network interfaces bonded. They’re also trunked, with a native VLAN coming through untagged, along with another VLAN.

The interfaces are: bond0, bond0:0 and bond0.400. bond0 has no IP address; bond0:0 has the IP address of the native VLAN, and is the ‘system’ IP; bond0.400 is the NFS interface.

The hostname of the system is its FQDN. It is in /etc/hosts, and both forward and reverse DNS work correctly.

When registering the node with chef server, Ohai incorrectly decides that bond0.400 is the system IP. I tried fooling it by temporarily turning off bond0.400 and re-registering, but then Ohai can’t figure out what the IP is.

Googling indicates this is not an unheard of problem. Here’s the relevant ohai output.

  "bond0:0": {
    "addresses": {
      "10.46.144.11": {
        "scope": "Global",
        "broadcast": "10.46.144.255",
        "prefixlen": "24",
        "family": "inet",
        "netmask": "255.255.255.0"
      }
    }
  },


“ipaddress”: null,

While I realize this is a more complicated configuration that many systems, it is not uncommon in servers, and not done in a non-standard way. I realize it is tricky to figure out what ‘the’ IP is for a system when a system has more than one. But ohai is just failing here.

While I’m at it, does it matter that Chef server doesn’t have the ‘IP’ field for the node? What might that break or affect?

Any help?

Am Fri, 4 Oct 2013 18:54:08 +0000
schrieb Ted Fines tfines@digitalriver.com:

On a bare metal system we have two network interfaces bonded.
They're also trunked, with a native VLAN coming through untagged,
along with another VLAN.

The interfaces are: bond0, bond0:0 and bond0.400. bond0 has no IP
address; bond0:0 has the IP address of the native VLAN, and is the
'system' IP; bond0.400 is the NFS interface.

The hostname of the system is its FQDN. It is in /etc/hosts, and
both forward and reverse DNS work correctly.

When registering the node with chef server, Ohai incorrectly decides
that bond0.400 is the system IP. I tried fooling it by temporarily
turning off bond0.400 and re-registering, but then Ohai can't figure
out what the IP is.

Googling indicates this is not an unheard of problem. Here's the
relevant ohai output.

  "bond0:0": {
    "addresses": {
      "10.46.144.11": {
        "scope": "Global",
        "broadcast": "10.46.144.255",
        "prefixlen": "24",
        "family": "inet",
        "netmask": "255.255.255.0"
      }
    }
  },

...
"ipaddress": null,

While I realize this is a more complicated configuration that many
systems, it is not uncommon in servers, and not done in a
non-standard way. I realize it is tricky to figure out what 'the' IP
is for a system when a system has more than one. But ohai is just
failing here.

Afaik Ohai chooses the nodes ipaddress from the interface/address the
default-route uses. So if your server has the default route via
bond0.400, ohai will use that for node['ipaddress'].

Have fun,

Arnold

I've been dealing with similar issues lately, bootstrapping
multi-NIC'd machines and trying to restrict them to a single
interface. Node.ipaddress is used all over the place (which is blowing
up for you), so you'll want to look for those in your code. I added a
library to the apt cookbook to get the IP for an interface, you may be
able to reuse it:
https://github.com/opscode-cookbooks/apt/blob/master/libraries/network.rb

Thanks,
Matt Ray
Cloud Integrations Product Lead :: Opscode
512.731.2218 :: matt@opscode.com
mattray :: GitHub :: IRC :: Twitter

On Fri, Oct 4, 2013 at 1:54 PM, Ted Fines tfines@digitalriver.com wrote:

On a bare metal system we have two network interfaces bonded. They’re also
trunked, with a native VLAN coming through untagged, along with another
VLAN.

The interfaces are: bond0, bond0:0 and bond0.400. bond0 has no IP address;
bond0:0 has the IP address of the native VLAN, and is the ‘system’ IP;
bond0.400 is the NFS interface.

The hostname of the system is its FQDN. It is in /etc/hosts, and both
forward and reverse DNS work correctly.

When registering the node with chef server, Ohai incorrectly decides that
bond0.400 is the system IP. I tried fooling it by temporarily turning off
bond0.400 and re-registering, but then Ohai can’t figure out what the IP is.

Googling indicates this is not an unheard of problem. Here’s the relevant
ohai output.

  "bond0:0": {

    "addresses": {

      "10.46.144.11": {

        "scope": "Global",

        "broadcast": "10.46.144.255",

        "prefixlen": "24",

        "family": "inet",

        "netmask": "255.255.255.0"

      }

    }

  },

"ipaddress": null,

While I realize this is a more complicated configuration that many systems,
it is not uncommon in servers, and not done in a non-standard way. I
realize it is tricky to figure out what ‘the’ IP is for a system when a
system has more than one. But ohai is just failing here.

While I’m at it, does it matter that Chef server doesn’t have the ‘IP’ field
for the node? What might that break or affect?

Any help?