Discussion:
[chef] Force 'main' IP on multi-homed Chef nodes
Vauter, George
2015-05-07 00:27:37 UTC
Permalink
Has anyone found a straightforward way to force Ohai to use a specific interface’s IP address as the “main” ip address for the Chef node? All our server’s are multi-homed (have 2-3 interfaces). Chef is currently picking the IP of an interface that should not be considered the main interface for the node. From what I found so far, Ohai references the order of the routes to determine whi
Troy Ready
2015-05-07 16:54:39 UTC
Permalink
FWIW, the logic used to determine the automatic attribute ipaddress is
located here:
https://github.com/chef/ohai/blob/master/lib/ohai/plugins/network.rb

We've created custom ohai plugins for systems needing an ipaddress
override, and use the ohai cookbook
(https://github.com/opscode-cookbooks/ohai) to deploy them. Not sure if
I'd classify it as straightforward (was fairly daunting for me while I
was learning Chef), but it's the only way that I currently know of to
deal with automatic attributes.
Has anyone found a straightforward way to force Ohai to use a specific interface’s IP address as the “main” ip address for the Chef node? All our server’s are multi-homed (have 2-3 interfaces). Chef is currently picking the IP of an interface that should not be considered the main interface for the node. From what I found so far, Ohai references the order of the routes to determine which interface IP to select…?
Thanks,
George
Christine Draper
2015-05-07 17:37:27 UTC
Permalink
Hi,

I have achieved this before by changing the default route in the IP table
to be the main IP address. Obviously not very helpful unless this is
actually how you want your machines configured.

Regards,
Christine
Post by Troy Ready
FWIW, the logic used to determine the automatic attribute ipaddress is
https://github.com/chef/ohai/blob/master/lib/ohai/plugins/network.rb
We've created custom ohai plugins for systems needing an ipaddress
override, and use the ohai cookbook
(https://github.com/opscode-cookbooks/ohai) to deploy them. Not sure if
I'd classify it as straightforward (was fairly daunting for me while I
was learning Chef), but it's the only way that I currently know of to
deal with automatic attributes.
Post by Vauter, George
Has anyone found a straightforward way to force Ohai to use a specific
interface’s IP address as the “main” ip address for the Chef node? All our
server’s are multi-homed (have 2-3 interfaces). Chef is currently picking
the IP of an interface that should not be considered the main interface for
the node. From what I found so far, Ohai references the order of the
routes to determine which interface IP to select
?
Post by Vauter, George
Thanks,
George
Vauter, George
2015-05-07 23:16:17 UTC
Permalink
Thanks Christine - that would definitely be a simple approach but unfortunately we can’t modify our default route.


@Troy R - thanks for the plugin and cookbook - seems like a good solution.

Thanks,
George
On May 7, 2015, at 1:37 PM, Christine Draper <***@thirdwaveinsights.com<mailto:***@thirdwaveinsights.com>> wrote:

Hi,

I have achieved this before by changing the default route in the IP table to be the main IP address. Obviously not very helpful unless this is actually how you want your machines configured.

Regards,
Christine

On Thu, May 7, 2015 at 11:54 AM, Troy Ready <***@gmail.com<mailto:***@gmail.com>> wrote:
FWIW, the logic used to determine the automatic attribute ipaddress is
located here:
https://github.com/chef/ohai/blob/master/lib/ohai/plugins/network.rb

We've created custom ohai plugins for systems needing an ipaddress
override, and use the ohai cookbook
(https://github.com/opscode-cookbooks/ohai) to deploy them. Not sure if
I'd classify it as straightforward (was fairly daunting for me while I
was learning Chef), but it's the only way that I currently know of to
deal with automatic attributes.
Post by Kevin Keane Subscription
Has anyone found a straightforward way to force Ohai to use a specific interface’s IP address as the “main” ip address for the Chef node? All our server’s are multi-homed (have 2-3 interfaces). Chef is currently picking the IP of an interface that should not be considered the main interface for the node. From what I found so far, Ohai references the order of the routes to determine which interface IP to select
?
Thanks,
George
Kevin Keane Subscription
2015-05-07 20:00:34 UTC
Permalink
Just to add to this: the same problem exists with IPv6 even on a single interface (at least it did last time I checked, which was a number of versions ago), especially with privacy extensions enabled.

To be fair, it is a hard problem to solve.

Kevin Keane

The NetTech

760-721-8339

http://www.4nettech.com

Our values: Privacy, Liberty, Justice

See https://www.4nettech.com/corp/the-nettech-values.html



-----Original message-----
From: Vauter, George <***@inin.com>
Sent: Wednesday 6th May 2015 17:27
To: ***@lists.opscode.com
Subject: [chef] Force 'main' IP on multi-homed Chef nodes


Has anyone found a straightforward way to force Ohai to use a specific interface’s IP address as the “main” ip address for the Chef node? All our server’s are multi-homed (have 2-3 interfaces). Chef is currently picking the IP of an interface that should not be considered the main interface for the node. From what I found so far, Ohai references the order of the routes to determine which interface IP to select
?

Thanks,
George
Loading...