Linux Client Default Gateway Analysis

@IanDM

I suggest you create an analysis to handle the data collection. You can then select the results and copy the them into the paste buffer for post-processing in Excel. One possible challenge is that a machine might have multiple gateways defined. It will be easy to identify any other outliers.

As a side note, a cloned Linux VM will get an eth1 interface, when the source VM had an eth0 interface. This may be why you’re seeing a handful of eth1 interfaces in your environment.

Analysis Name
Gateways

Property1
Windows Gateway
if name of operating system contains “Win” then gateways of adapters of network as string else “not Windows”

Property2
Linux Global Gateway
if name of operating system contains “Linux” then (if (exists file “/etc/sysconfig/network” whose (exists (lines of it) whose (it starts with “GATEWAY=”))) then (following texts of firsts “=” of (lines of file “/etc/sysconfig/network”) whose (it starts with “GATEWAY”)) else “no global gateway”) else “not Linux”

Property3
Linux eth0 Gateway
if name of operating system contains “Linux” then (if (exists file “/etc/sysconfig/network-scripts/ifcfg-eth0” whose (exists (lines of it) whose (it starts with “GATEWAY=”))) then (following texts of firsts “=” of (lines of file “/etc/sysconfig/network-scripts/ifcfg-eth0”) whose (it starts with “GATEWAY”)) else “no gateway at eth0”) else “not Linux”

Property4
Linux eth1 Gateway
if name of operating system contains “Linux” then (if (exists file “/etc/sysconfig/network-scripts/ifcfg-eth1” whose (exists (lines of it) whose (it starts with “GATEWAY=”))) then (following texts of firsts “=” of (lines of file “/etc/sysconfig/network-scripts/ifcfg-eth1”) whose (it starts with “GATEWAY”)) else “no gateway at eth1”) else “not Linux”

Property5
Linux bond0 Gateway
if name of operating system contains “Linux” then (if (exists file “/etc/sysconfig/network-scripts/ifcfg-bond0” whose (exists (lines of it) whose (it starts with “GATEWAY=”))) then (following texts of firsts “=” of (lines of file “/etc/sysconfig/network-scripts/ifcfg-bond0”) whose (it starts with “GATEWAY”)) else “no gateway at bond0”) else “not Linux”

The exists operator is great for validating the presence or absence of any object. In this case we’re using it to confirm that the various system configuration files are present before trying to locate the gateway information.

1 Like