Alan Phillips
2012-Sep-19 15:31 UTC
[Puppet Users] Puppet on Windows 2003 Server > wrong IP via facter?
Hello! I''m just getting started working with Puppet and testing on a Windows 2003 server. When I run facter on this server it returns a wrong value for the ipaddress (should be 10.10.0.203, but facter sets ipaddress=10.0.0.203). As you can see from the following ipconfig output, facter is looking at the TELECOM Ethernet adapter instead of the adapter used for the local domain (QALAB). Any work-around for this situation? C:\Documents and Settings\Administrator>ipconfig Windows IP Configuration Ethernet adapter QALAB 10.10.0.203: Connection-specific DNS Suffix . : IP Address. . . . . . . . . . . . : 10.10.0.203 Subnet Mask . . . . . . . . . . . : 255.255.254.0 Default Gateway . . . . . . . . . : 10.10.0.1 Ethernet adapter TELECOM 10.0.0.203: Connection-specific DNS Suffix . : IP Address. . . . . . . . . . . . : 10.0.0.203 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/XqsWrS-vLHUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Josh Cooper
2012-Sep-19 22:08 UTC
Re: [Puppet Users] Puppet on Windows 2003 Server > wrong IP via facter?
Hi Alan, On Wed, Sep 19, 2012 at 8:31 AM, Alan Phillips <alanphil@gmail.com> wrote:> Hello! > > I''m just getting started working with Puppet and testing on a Windows 2003 > server. When I run facter on this server it returns a wrong value for the > ipaddress (should be 10.10.0.203, but facter sets ipaddress=10.0.0.203). As > you can see from the following ipconfig output, facter is looking at the > TELECOM Ethernet adapter instead of the adapter used for the local domain > (QALAB). Any work-around for this situation? > > C:\Documents and Settings\Administrator>ipconfig > > Windows IP Configuration > > Ethernet adapter QALAB 10.10.0.203: > > Connection-specific DNS Suffix . : > IP Address. . . . . . . . . . . . : 10.10.0.203 > Subnet Mask . . . . . . . . . . . : 255.255.254.0 > Default Gateway . . . . . . . . . : 10.10.0.1 > > Ethernet adapter TELECOM 10.0.0.203: > > Connection-specific DNS Suffix . : > IP Address. . . . . . . . . . . . : 10.0.0.203 > Subnet Mask . . . . . . . . . . . : 255.255.255.0 > Default Gateway . . . . . . . . . : > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/XqsWrS-vLHUJ. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en.Facter (on all platforms) doesn''t handle multiple interfaces very well. The logic is typically pick the ipaddress from the "first" interface. See http://projects.puppetlabs.com/issues/5816 This code is undergoing some changes. See http://projects.puppetlabs.com/issues/1346 and https://github.com/puppetlabs/facter/pull/267 On Windows the current logic is: require ''socket'' IPSocket.getaddress(Socket.gethostname) I''m not sure why it does this to be honest. I would have expected it to use WMI to only report on interfaces that have IP enabled, something like: wmic nicconfig where (IPEnabled = "true") get IPAddress Or using netsh: netsh.exe interface ip show ipaddresses 10 where 10 is my interface index for my "Local Area Connection" interface Note facter does, or at least should be, reporting on the ipaddress associated with each interface, downcased and with underscores. In my case: ipaddress_local_area_connection => 172.16.138.231 ipaddress_loopback_pseudo_interface_1 => 127.0.0.1 Josh -- Josh Cooper Developer, Puppet Labs -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.