Find all devices in each subnet

This query identifies all of the subnets listed in the database. For each subnet the query provides the netmask of that subnet and the list of IP addresses collected within that subnet. The IP address collected within a subnet might refer to main nodes or interfaces; typically, they refer to interfaces.

Example

1]  SELECT     s.network Network,
2]             s.netmask Netmask,
3]             e.entityName Entity_Name
4]  FROM       subnet s
5]  INNER JOIN collects c ON c.collectingEntityId = s.entityId
6]  INNER JOIN entityData e ON e.entityId = c.collectedEntityId
7]  ORDER BY   s.network

Description

The table below describes this query.

Table 1. Description of the query
Line numbers Description
1-3 Specify the data to show in the results, as follows:
  • The IP address of the collecting subnet, represented by s.network
  • The netmask of the subnet, represented by s.netmask
  • The name – usually an IP address – of an interface or main node within this subnet, represented by e.entityName
4 Use the subnet table as the driving table for this query. This enables the query to extract all the subnets in the database.
5 Retrieve a listing of all the collected entities within each subnet. At this point the collected entities are identified by their entity identifier only. The corresponding IP address is retrieved in the next line. Do this by joining the collects table.
6 Extract the entity data for each interface or main node collected within each subnet. Do this by joining the entityData table to the query. This enables the query to retrieve the IP address for each of the collected entities.
7 For readability purposes, order the results by the IP address of the collecting subnet.

Results

The table below shows the results of this query.

Table 2. Results of the query 
Network Netmask Entity name
10.1.1.0 255.255.255.0 10.1.1.6
10.1.1.0 255.255.255.0 10.1.1.8
10.1.1.0 255.255.255.0 10.1.1.9
10.1.1.0 255.255.255.0 10.1.1.25
10.1.1.0 255.255.255.0 10.1.1.26
10.1.1.0 255.255.255.0 10.1.1.27
172.18.1.0 255.255.255.0 172.18.1.30
172.18.1.0 255.255.255.0 172.18.1.31
172.20.11.0 255.255.255.248 172.20.11.54
172.20.11.0 255.255.255.248 172.20.11.75