Using 'ip addr' over ifconfig
|Status:||Code Insufficient||Start date:||06/03/2008|
|Keywords:||Affected Facter version:|
# 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.
#5 Updated by Miah Johnson almost 5 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
#10 Updated by Julien GEORGES over 2 years ago
- File facter-ip_addr-linux.patch added
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.
#27 Updated by Jeff McCune 11 months ago
- Status changed from In Topic Branch Pending Review to Code Insufficient
- Assignee deleted (
- 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 27 days ago
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