The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #1346

Using 'ip addr' over ifconfig

Added by Ian Christian over 6 years ago. Updated 11 months ago.

Status:Code InsufficientStart date:06/03/2008
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:library
Target version:2.x
Keywords: Affected Facter version:
Branch:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket is now tracked at: https://tickets.puppetlabs.com/browse/FACT-184


Description

# facter
/usr/lib/ruby/site_ruby/1.8/facter/ipmess.rb:85: command not found: /sbin/ifconfig -a
/usr/bin/facter:54: command not found: /sbin/ifconfig -a
/usr/bin/facter:54: command not found: dnsdomainname
/usr/bin/facter:54: command not found: domainname
/usr/bin/facter:54: command not found: /sbin/ifconfig
architecture => i386
domain => internal.HIDDEN
facterversion => 1.3.8
fqdn => ruby-test.internal.HIDDEN
hardwareisa => unknown
hardwaremodel => i686
hostname => ruby-test
id => root
ipaddress => 10.200.201.73

It would be nice if when ifconfig can’t be found, it falls back to using ‘ip addr’ (or the other way around) – also, notice that domainname and dnsdomainname are not present on this system – however facter does appear to get them correct regardless.

facter-ip_addr-linux.patch Magnifier - Patch Facter 1.5.7-1 - ip addr (for linux systems) (7.77 KB) Julien GEORGES, 06/28/2011 08:23 am


Related issues

Related to Facter - Bug #2938: interfaces that don't match ^\w+[.:]?\d+ are ignored Closed 12/16/2009
Related to Facter - Bug #5816: ipaddress fact uses the IP of the alphabetically earliest... Duplicate 01/09/2011
Related to Facter - Bug #1574: ipaddress fact does not show all IP addresses when using ... Duplicate 09/12/2008
Related to Facter - Bug #15001: ipaddress fact fails on Fedora 17 Merged - Pending Release 06/13/2012
Related to Facter - Bug #15798: Fails to handle network interface names longer than 9 cha... Investigating 08/02/2012
Duplicated by Facter - Bug #4498: ipaddress* facts do not include secondary IPs Duplicate 08/08/2010
Duplicated by Facter - Bug #11113: Later revisions of Archlinux have no ifconfig Duplicate 11/30/2011

History

#1 Updated by James Turnbull over 6 years ago

  • 6 changed from Unreviewed to Needs more information

What platform is this? Versions?

#2 Updated by James Turnbull over 6 years ago

  • Category set to library
  • Target version set to 1.5.0

#3 Updated by Redmine Admin over 6 years ago

  • Status changed from 1 to Needs More Information

#4 Updated by James Turnbull over 6 years ago

  • Target version changed from 1.5.0 to 14

#5 Updated by Miah Johnson almost 6 years ago

The ‘ip’ command is available on most Linux distributions, in the iproute2 package. The ‘ip’ command provides avanced functionality that isnt available in ifconfig.

http://www.linuxfoundation.org/en/Net:Iproute2 http://en.wikipedia.org/wiki/Iproute2 http://www.policyrouting.org/iproute2-toc.html

#6 Updated by Joe McDonagh over 5 years ago

Just to chime in on this- ifconfig is being deprecated on Linux, so it may be worth it to start moving towards the use of ip for network facts on Linux systems.

#7 Updated by Benedikt Böhm over 5 years ago

the following patch fixes the domainname/dnsdomainname warnings: http://github.com/hollow/facter/commit/92f6b049724a620f3833dde10b8126a70ce52a08

#8 Updated by Paul Nasrat over 4 years ago

  • Status changed from Needs More Information to Accepted
  • Assignee set to martin krafft

Assigning to Martin as in Issue #4498

#9 Updated by Spencer Rinehart over 3 years ago

Arch Linux recently deprecated net-tools in favor of iproute2 and yp-tools. [1] I give a big +1 for ip addr.

[1] http://www.archlinux.org/news/deprecation-of-net-tools/

#10 Updated by Julien GEORGES over 3 years ago

Hi everyone, I’ve work on a personal patch for facter 1.5.7-1 to use ‘ip addr’ instead of ‘ifconfig’.

I had some trouble with ifconfig when you enable infiniband interfaces. In this situation, ifconfig is obsolete and facter prints a lot of garbage messages like that :

Ifconfig uses the ioctl access method to get the full address information, which limits hardware addresses to 8 bytes. Because Infiniband address has 20 bytes, only the first 8 bytes are displayed correctly.

Here is my little contribution, you will find my svn diff file attached to this issue (facter-ip_addr-linux.patch).

This patch is only for linux usage! I didn’t modify the code for the other systems (like ‘OpenBSD’, ‘NetBSD’, ‘FreeBSD’, ‘Darwin’…) because I don’t have any of these systems to test my modifications. If you use one of these systems, be careful if you apply this patch.

I’ll be glad if you give me some return about my work or if you have any advice to improve this patch.

Thanks, Julien.

#11 Updated by Alex Demidov about 3 years ago

On Gentoo hosts ifconfig -a output has interface names truncated to 9 chars (see this gentoo bug) so facter actually broken there because it gets incorrect interfaces list. See this discussion in puppet-users google group for additional details.

#12 Updated by Ken Barber about 3 years ago

  • Description updated (diff)
  • Assignee deleted (martin krafft)

#13 Updated by Ken Barber almost 3 years ago

According to #11113 – the June version of Archlinux no longer includes ifconfig … so Facter is broken for that.

#14 Updated by Adrien Thebo almost 3 years ago

  • Target version changed from 14 to 144

This should happen sooner rather than later. We can add another fact resolution that uses ip if it’s available, and then fall back to ifconfig if it isn’t present.

#15 Updated by shubhra sinha varma almost 3 years ago

  • Status changed from Accepted to Investigating

#16 Updated by Shawn Taaj almost 3 years ago

  • Assignee set to Shawn Taaj

#17 Updated by Shawn Taaj almost 3 years ago

  • Assignee deleted (Shawn Taaj)

#18 Updated by shubhra sinha varma almost 3 years ago

  • Status changed from Investigating to Accepted
  • Assignee set to shubhra sinha varma

#19 Updated by shubhra sinha varma over 2 years ago

Linux is functional (ip addr instead of ifconfig), working on other parts.

#20 Updated by shubhra sinha varma over 2 years ago

  • Status changed from Accepted to Code Insufficient

#21 Updated by Anonymous over 2 years ago

The submitted pull request was entirely wrong.

#22 Updated by Jeff Weiss over 2 years ago

  • Target version deleted (144)

#23 Updated by Anonymous over 2 years ago

I’ve made a pull request for this at https://github.com/puppetlabs/facter/pull/254 , figured it couldn’t hurt to patch up or attempt to.

#24 Updated by Anonymous over 2 years ago

  • Status changed from Code Insufficient to In Topic Branch Pending Review

This has gone through several more incarnations and is now at: https://github.com/puppetlabs/facter/pull/267

#25 Updated by Anonymous over 2 years ago

  • Assignee changed from shubhra sinha varma to Anonymous

#26 Updated by Michael Moll almost 2 years ago

What’s the status of the pull request? I would need a fix for Bug #4498 (ipaddress* facts do not include secondary IPs)…

#27 Updated by Jeff McCune almost 2 years ago

  • Status changed from In Topic Branch Pending Review to Code Insufficient
  • Assignee deleted (Anonymous)
  • Target version set to 2.x

Michael Moll wrote:

What’s the status of the pull request? I would need a fix for Bug #4498 (ipaddress* facts do not include secondary IPs)…

I commented at https://github.com/puppetlabs/facter/pull/267, but I’ll merge this in once it’s rebased against master. It looks like all of the concerns have been addressed. Please make sure to mention my name in the pull request so I get a notification that it’s ready, otherwise I might overlook the newly rebased pull request.

Thanks for the ping, -Jeff

#28 Updated by James Eckersall about 1 year ago

Hi,

I’d like to bump this issue if possible. At the company I work, we don’t really use alias interfaces at all – we add multiple ip’s to the same interface.

In addition to this, we have a small number of boxes where we effectively cannot run Puppet due to the number of IP’s. We have ~500 alias interfaces and facter takes ~25 seconds to iterate through all these. This causes puppet to timeout :( I know 500 IP’s is a fringe case, but I’m sure mine can’t be the only case of this.

My related post on puppet-users group https://groups.google.com/forum/#!topic/puppet-users/3DuLHuXXMH0

J

#29 Updated by Felix Frank about 1 year ago

James,

this is seeing more work as discussed in the PR https://github.com/puppetlabs/facter/pull/384

#30 Updated by Anonymous 11 months ago

Redmine Issue #1346 has been migrated to JIRA:

https://tickets.puppetlabs.com/browse/FACT-184

Also available in: Atom PDF