salt icon indicating copy to clipboard operation
salt copied to clipboard

grains['ipv4'] only returning two ip addresses

Open gl1ch opened this issue 13 years ago • 10 comments

I have several hosts setup with multiple IP addresses and as of the update to 0.16.2 I have noticed that grains['ipv4'] is only returning two ip addresses.

gl1ch avatar Aug 12 '13 22:08 gl1ch

Windows? Linux? FreeBSD? Other?

terminalmage avatar Aug 13 '13 01:08 terminalmage

Both master and minion are Debian 7.0

gl1ch avatar Aug 13 '13 15:08 gl1ch

@gl1ch Linux IP detection can be done either with iproute or ifconfig, with iproute being preferred.

On the minion where you're seeing this issue, does command -v ip return anything? If so, please post the output of ip link show and ip addr show. If not, please post the output of ifconfig -a.

Please take care to obfuscate any IP addresses.

terminalmage avatar Aug 14 '13 21:08 terminalmage

Here you go:

# command -v ip
/sbin/ip

# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 00:22:33:aa:00:00 brd ff:ff:ff:ff:ff:ff

# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:22:33:aa:00:00 brd ff:ff:ff:ff:ff:ff
    inet 555.555.555.107/22 brd 555.555.558.255 scope global eth0:7
    inet 555.555.555.106/22 brd 555.555.558.255 scope global secondary eth0:6
    inet 555.555.555.105/22 brd 555.555.558.255 scope global secondary eth0:5
    inet 555.555.555.104/22 brd 555.555.558.255 scope global secondary eth0:4
    inet 555.555.555.103/22 brd 555.555.558.255 scope global secondary eth0:3
    inet 555.555.555.102/22 brd 555.555.558.255 scope global secondary eth0:2
    inet 555.555.555.101/22 brd 555.555.558.255 scope global secondary eth0:1
    inet 555.555.555.100/22 brd 555.555.558.255 scope global secondary eth0:0
    inet 555.555.555.109/22 brd 555.555.558.255 scope global secondary eth0:8
    inet 555.555.555.110/22 brd 555.555.558.255 scope global secondary eth0:9
    inet 555.555.555.28/22 brd 555.555.558.255 scope global secondary eth0
    inet6 fe80::250:46ff:febc:8/64 scope link 
       valid_lft forever preferred_lft forever

gl1ch avatar Aug 14 '13 22:08 gl1ch

OK. I edited your post to use triple-backticks so it's more readable.

You said that only two addresses are showing up. Are the ones marked "secondary" the ones not showing up now?

inet 555.555.555.106/22 brd 555.555.558.255 scope global secondary eth0:6

terminalmage avatar Aug 14 '13 22:08 terminalmage

Here is what I get back from the server.

# salt 'myserver*' grains.item ipv4
myserver.domain.net:
  ipv4:
      127.0.0.1
      555.555.555.107

gl1ch avatar Aug 14 '13 22:08 gl1ch

OK, thanks, I'll look into this.

terminalmage avatar Aug 15 '13 16:08 terminalmage

@gl1ch Do you see the missing IP addresses in the output from salt minion-id network.interfaces?

terminalmage avatar Aug 15 '13 16:08 terminalmage

ip_interfaces shows the following. Note that it is specifying the ip address of one of the sub-interfaces as eth0:

ip_interfaces: {'lo': ['127.0.0.1'], 'eth0': ['555.555.555.107']}

gl1ch avatar Aug 15 '13 17:08 gl1ch

No, I wasn't talking about the ip_interfaces grain. I was talking about the module function network.interfaces.

At any rate, I found the problem and fixed it in https://github.com/saltstack/salt/pull/6719.

terminalmage avatar Aug 15 '13 17:08 terminalmage