Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

network interfaces not detected correctly, plus BMC/IPMI detection (bogus/ephemeral hubs) #640

Open
Stoatwblr opened this issue Feb 21, 2019 · 2 comments

Comments

@Stoatwblr
Copy link
Contributor

Per IRC discussion:

On linux systems (at least):

  • Bonds, vlans, IPaliases and loopbacks are all being detected and listed as physical interfaces.
  • Bond slave ethernet devices are showing macs of the parent bond, not the physical network address.

A bond may have an explicitly defined mac address, or may pick up any one of the ethernet device's macs (first one to be detected wins the race)

  • Also, if the devices are already manually defined when fusioninventory-agent is first run the agent/Fi4G does not take over their entries, but creates duplicate new ones.

Adding to the confusion, if the device is a server and has a BMC/IPMI, the ethernet and MAC address of that device is frequently "piggybacked" on one of the computer's physical interfaces via a "vampire tap"

  • and may have the same mac utilising failover between eth1 & 2
  • OR use different macs on the different interfaces
  • OR have a dedicated interface with one mac and failover to the "piggyback" connection using another mac

This has the effect of making it look like there is a hub present that may appear/disappear frequently.

@Stoatwblr
Copy link
Contributor Author

Stoatwblr commented Feb 21, 2019

  • see also the issue I raised in BUG: Race condition in device network port handling #375, where a fixed IP address may "float" between interfaces, depending which one is active (and DHCP configurations)

  • On top of that, known interfaces on known hardware may acquire new IP addresses and you DO NOT want to lose history of the old ones by having the old ones overwritten.

In my opinion: IP addresses should be treated as "alias" devices so they can be dynamically shifted between physical/aggregate devices as required. If this is not done the database ends up with a LOT of needless duplicate IP entries over time

@Stoatwblr
Copy link
Contributor Author

Stoatwblr commented Mar 7, 2019

See comments on the Netdisco importation and xml extension thread.

It looks like part of the problem I'm seeing is due to the fact that some of the systems here have configured IP addresses on [eth0|bond0].vlan or [eth0|bond0]:alias without putting anything on the bare eth0 or bond0 entries - that utterly breaks the XML, but even when (mostly) sane XML is being sent from the computers, entries are wildly wrong in GLPI with ifindexes ignored and bonds not created properly even though they're sent in the right format..

The existing Network.pm can't cope with that scenario.

Having said that, use of the "ip" command and (on linux) of /sys/class/net is suboptimal.

To explain:

# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp2s0f0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:10:9b:13:dd:60 brd ff:ff:ff:ff:ff:ff
3: enp2s0f1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP mode DEFAULT group default qlen 1000
    link/ether 00:10:9b:13:dd:68 brd ff:ff:ff:ff:ff:ff
4: enp3s0f0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:10:9b:13:dc:60 brd ff:ff:ff:ff:ff:ff
5: enp3s0f1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP mode DEFAULT group default qlen 1000
    link/ether 00:10:9b:13:dd:68 brd ff:ff:ff:ff:ff:ff
6: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 00:10:9b:13:dd:68 brd ff:ff:ff:ff:ff:ff

ip "link" - shows the link devices rather than network addresses.
Those numbers in the first column are the IFINDEX values of the interfaces (we'll come back to those in a minute)

Even better than that is the oneline format:

# ip -o link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000\    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp2s0f0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000\    link/ether 00:10:9b:13:dd:60 brd ff:ff:ff:ff:ff:ff
3: enp2s0f1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP mode DEFAULT group default qlen 1000\    link/ether 00:10:9b:13:dd:68 brd ff:ff:ff:ff:ff:ff
4: enp3s0f0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000\    link/ether 00:10:9b:13:dc:60 brd ff:ff:ff:ff:ff:ff
5: enp3s0f1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP mode DEFAULT group default qlen 1000\    link/ether 00:10:9b:13:dd:68 brd ff:ff:ff:ff:ff:ff
6: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000\    link/ether 00:10:9b:13:dd:68 brd ff:ff:ff:ff:ff:ff

Doesn't seem like much? Let's try it on another box:

# ip -o link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN \    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000\    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000\    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
5: bond0.3000@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
6: bond0.3001@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
7: bond0.3002@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
8: bond0.3003@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
9: bond0.3009@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
10: bond0.505@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
11: bond0.506@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
12: bond0.511@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
13: bond0.530@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
14: bond0.628@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
15: bond0.640@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
16: bond0.641@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
17: bond0.642@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
18: bond0.643@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
19: bond0.645@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
20: bond0.646@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
21: bond0.670@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
22: bond0.672@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
23: bond0.69@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
24: bond0.70@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
25: bond0.73@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff

And where it really comes into its own is when you use it for address display:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN \    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
1: lo    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000\    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000\    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
4: bond0    inet 10.0.1.248/24 brd 10.0.1.255 scope global bond0:10x1
4: bond0    inet 192.168.1.248/24 brd 192.168.1.255 scope global bond0:192x1
4: bond0    inet 192.168.2.248/24 brd 192.168.2.255 scope global bond0:192x2
4: bond0    inet 192.168.99.248/24 brd 192.168.99.255 scope global bond0:192x99
5: bond0.3000@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
5: bond0.3000    inet 192.168.144.248/24 brd 192.168.144.255 scope global bond0.3000
5: bond0.3000    inet 192.168.10.248/24 brd 192.168.10.255 scope global bond0.3000
6: bond0.3001@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
6: bond0.3001    inet 10.110.153.248/23 brd 10.110.153.255 scope global bond0.3001
7: bond0.3002@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
7: bond0.3002    inet 10.110.151.248/21 brd 10.110.151.255 scope global bond0.3002
8: bond0.3003@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
8: bond0.3003    inet 10.110.167.248/21 brd 10.110.167.255 scope global bond0.3003
9: bond0.3009@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
9: bond0.3009    inet 192.168.225.248/24 brd 192.168.225.255 scope global bond0.3009
10: bond0.505@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
10: bond0.505    inet 192.168.53.248/24 brd 192.168.53.255 scope global bond0.505
10: bond0.505    inet 192.168.54.248/24 brd 192.168.54.255 scope global bond0.505:
11: bond0.506@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
11: bond0.506    inet 192.168.56.248/24 brd 192.168.56.255 scope global bond0.506
12: bond0.511@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
12: bond0.511    inet 192.168.52.248/24 brd 192.168.52.255 scope global bond0.511
13: bond0.530@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
13: bond0.530    inet 192.168.30.248/24 brd 192.168.30.255 scope global bond0.530
14: bond0.628@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
14: bond0.628    inet 192.168.128.248/23 brd 192.168.129.255 scope global bond0.628
15: bond0.640@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
15: bond0.640    inet 192.168.140.248/24 brd 192.168.140.255 scope global bond0.640
16: bond0.641@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
16: bond0.641    inet 192.168.141.248/24 brd 192.168.141.255 scope global bond0.641
17: bond0.642@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
17: bond0.642    inet 192.168.142.248/24 brd 192.168.142.255 scope global bond0.642
18: bond0.643@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
18: bond0.643    inet 192.168.143.248/24 brd 192.168.143.255 scope global bond0.643
19: bond0.645@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
19: bond0.645    inet 192.168.145.248/24 brd 192.168.145.255 scope global bond0.645
20: bond0.646@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
20: bond0.646    inet 192.168.146.248/24 brd 192.168.146.255 scope global bond0.646
21: bond0.670@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
21: bond0.670    inet 192.168.170.248/24 brd 192.168.170.255 scope global bond0.670
22: bond0.672@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
22: bond0.672    inet 192.168.172.248/24 brd 192.168.172.255 scope global bond0.672
23: bond0.69@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
23: bond0.69    inet 130.40.69.248/24 brd 130.40.69.255 scope global bond0.69
24: bond0.70@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
24: bond0.70    inet 130.40.71.248/23 brd 130.40.71.255 scope global bond0.70
25: bond0.73@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP \    link/ether 0c:c4:7a:03:24:fb brd ff:ff:ff:ff:ff:ff
25: bond0.73    inet 130.40.73.248/24 brd 130.40.73.255 scope global bond0.73

You can see that this does show the link devices in parseable format next to the L3 network addresses (and the ifindex that they're associated with)

On to /sys/class/net - Linux/Network.pm has most of the right ideas, but then goes offcourse in a few others.

First of all, this area only holds link(L2) devices, and you can tell real vs virtual ones apart pretty easily:

# ls -l
total 0
lrwxrwxrwx 1 root root    0 Feb 27 20:54 bond0 -> ../../devices/virtual/net/bond0
lrwxrwxrwx 1 root root    0 Feb 27 20:54 bond0.3000 -> ../../devices/virtual/net/bond0.3000
lrwxrwxrwx 1 root root    0 Feb 27 20:54 bond0.3001 -> ../../devices/virtual/net/bond0.3001
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.3002 -> ../../devices/virtual/net/bond0.3002
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.3003 -> ../../devices/virtual/net/bond0.3003
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.3009 -> ../../devices/virtual/net/bond0.3009
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.505 -> ../../devices/virtual/net/bond0.505
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.506 -> ../../devices/virtual/net/bond0.506
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.511 -> ../../devices/virtual/net/bond0.511
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.530 -> ../../devices/virtual/net/bond0.530
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.628 -> ../../devices/virtual/net/bond0.628
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.640 -> ../../devices/virtual/net/bond0.640
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.641 -> ../../devices/virtual/net/bond0.641
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.642 -> ../../devices/virtual/net/bond0.642
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.643 -> ../../devices/virtual/net/bond0.643
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.645 -> ../../devices/virtual/net/bond0.645
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.646 -> ../../devices/virtual/net/bond0.646
lrwxrwxrwx 1 root root    0 Feb 27 20:55 bond0.670 -> ../../devices/virtual/net/bond0.670
lrwxrwxrwx 1 root root    0 Feb 27 20:56 bond0.672 -> ../../devices/virtual/net/bond0.672
lrwxrwxrwx 1 root root    0 Feb 27 20:56 bond0.69 -> ../../devices/virtual/net/bond0.69
lrwxrwxrwx 1 root root    0 Feb 27 20:56 bond0.70 -> ../../devices/virtual/net/bond0.70
lrwxrwxrwx 1 root root    0 Feb 27 20:56 bond0.73 -> ../../devices/virtual/net/bond0.73
-rw-r--r-- 1 root root 4096 Feb 27 20:54 bonding_masters
lrwxrwxrwx 1 root root    0 Feb 27 20:54 eth0 -> ../../devices/pci0000:00/0000:00:19.0/net/eth0
lrwxrwxrwx 1 root root    0 Feb 27 20:54 eth1 -> ../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/eth1
lrwxrwxrwx 1 root root    0 Feb 27 20:54 lo -> ../../devices/virtual/net/lo

For the most part you don't actually need "ip" or "ifconfig" to get the physical interfaces.

It nicely gives you a list of bonding masters and each bond has a list of slaves.

# cat bonding_masters 
bond0

# ls bond0
addr_assign_type  broadcast  dormant   gro_flush_timeout  link_mode         phys_port_id  slave_eth1  tx_queue_len
address           carrier    duplex    ifalias            mtu               power         speed       type
addr_len          dev_id     features  ifindex            name_assign_type  queues        statistics  uevent
bonding           dev_port   flags     iflink             operstate         slave_eth0    subsystem
# ls bond0/bonding/
active_slave    ad_partner_mac     arp_ip_target  lp_interval  num_grat_arp       queue_id        use_carrier
ad_actor_key    ad_select          arp_validate   miimon       num_unsol_na       resend_igmp     xmit_hash_policy
ad_aggregator   all_slaves_active  downdelay      mii_status   packets_per_slave  slaves
ad_num_ports    arp_all_targets    fail_over_mac  min_links    primary            tlb_dynamic_lb
ad_partner_key  arp_interval       lacp_rate      mode         primary_reselect   updelay
# cat bond0/bonding/slaves 
eth0 eth1

Each slave keeps its hwaddr on file (no need to mess with ethtool)

# cat eth0/bonding_slave/perm_hwaddr 
0c:c4:7a:03:24:fb

And: this is where it gets to be fun:

Each port has a ifindex AND an iflink:

An ifindex is just like you'd expect on a switch - it enumerates the ports. The iflink matches the ifindexes for PHYSICAL devices (Bonds are counted as a physical device because they're enhancing bandwidth).
For LOGICAL/Virtual devices (vlans, frame relay PVCs, etc), the iflink shows the parent _physical interface:


# grep . */if*
bond0.3000/ifindex:5
bond0.3000/iflink:4
bond0.3001/ifindex:6
bond0.3001/iflink:4
bond0.3002/ifindex:7
bond0.3002/iflink:4
bond0.3003/ifindex:8
bond0.3003/iflink:4
bond0.3009/ifindex:9
bond0.3009/iflink:4
bond0.505/ifindex:10
bond0.505/iflink:4
bond0.506/ifindex:11
bond0.506/iflink:4
bond0.511/ifindex:12
bond0.511/iflink:4
bond0.530/ifindex:13
bond0.530/iflink:4
bond0.628/ifindex:14
bond0.628/iflink:4
bond0.640/ifindex:15
bond0.640/iflink:4
bond0.641/ifindex:16
bond0.641/iflink:4
bond0.642/ifindex:17
bond0.642/iflink:4
bond0.643/ifindex:18
bond0.643/iflink:4
bond0.645/ifindex:19
bond0.645/iflink:4
bond0.646/ifindex:20
bond0.646/iflink:4
bond0.670/ifindex:21
bond0.670/iflink:4
bond0.672/ifindex:22
bond0.672/iflink:4
bond0.69/ifindex:23
bond0.69/iflink:4
bond0.70/ifindex:24
bond0.70/iflink:4
bond0.73/ifindex:25
bond0.73/iflink:4
bond0/ifindex:4
bond0/iflink:4
eth0/ifindex:2
eth0/iflink:2
eth1/ifindex:3
eth1/iflink:3
lo/ifindex:1
lo/iflink:1

What that means is that there's little need to call external programs, except to get the IP addresses (there's nothing for them in /sys/ or /proc/)

If all L3 addresses are considered aliases, then all they need is for a pseudo-index to be created (incrementing from the top of the ifindex range would do fine) and be linked back to the parent ifindex. The current jumping around trying to find "." or ":" in an network name entry is unnecesary

If you only want to do that for explicit ":" entries then you'll need to add extra logic - and I really don't recommend that as it's unnecessary extra complexity to make things "easier" in simple networks - at cost of making things MUCH harder to adjust mindsets as networks grow. It's better to treat all L3s as aliases and keep it consistent. It will make database relationships easier too - right now there are bogus network names for the same IP addresses popping up all over the place and it's hard to administer/track.

In the same way, "aggregates" should be renamed to "virtual" and all virtual devices placed here - and these need to be able to linked to each other, which GLPI currently doesn't allow (ie: ip addresses linked to bond.vlan linked to bond, linked to multiple ethernets).

NB: MAC addresses assigned to ethernet ports MUST NOT be changed by GLPI as seen in network scans and net-inventory (change the virtual, and if necessary, create a virtual interface)

"Piggybacking"(*) BMCs are a pain. Whilst a physical device (and actually a separate physical computer even though on the same board as the server) i think the best way of handling them is to declare them as "virtual" for networking purposes (they're a "ghost in the machine" after all) and attach them to the ethernet devices that they piggyback on. Currently when GLPI encounters them it creates a "Ghost" unmanaged hub - which cannot be attached to the computer. If you do so, it will be depopulated and a new "Ghost" hub created on the next network scan.

(*) These are separate ethernet devices which parasitically attach to the main computer's ethernet tranceivers to save a few cents in connection hardware. Whoever came up with THAT idea should be thoroughly scrubbed with a lemon zester and then dipped in Isopropanol.

Until GLPI is updated to handle virtual device chaining properly, the only practical way of creating "Bond.vlan" entries safely is to treat each one as a separate aggregate attached to the same ethernet ports. If this is not done then links get smashed at every network scan.

I'll try and dig up how best to approach network port scanning in Free/PCBSD too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant