If there are a large number of IPRanges to be added to an iQSonar v3 configuration it can be very time consuming to do this via the UI. The following instruction should be used to populate the database directly and SQL scripts are included.
Step-by-step guide
Add IPAddresses to the IPRange Table
If targeting specific IPAddresses, the StartIP and EndIP should be the same, If targeting as IPRanges, the StartIP and EndIP should be the beginning and end IPAddresses of the range.
Note: If using Locations - a LocationID will need to be set for each row inserted, if Not using Locations, LocationID should be NULL
Please confirm the Location Name for the IPRanges by checking Locations in your UI, or using select * from Location in your iQSonar Database and use the appropriate LocationID with the script below.IPRange InsertINSERT INTO IPRange (StartIP, EndIP, IPRangeTypeEnumID, ServiceTypeENumID, LocationID, Description) VALUES ('192.168.1.1', '192.168.1.1', (SELECT IPRangeTypeEnumID FROM IPRangeTypeEnum WHERE IPRangeTypeEnum = 'Range'), (SELECT ServiceTypeEnumID FROM ServiceTypeEnum WHERE ServiceType = 'Discovery.Port'), (SELECT LocationID from Location where name = 'Location Name'), 'Description')
- Update Map Table.
After running the above SQL Script row for each IPRange you wish to add the two scripts below will need to be run and these will update the corresponding map tables.
These updates assume only one iQSonar scanning server in use, if you have more than one Scan Engine, the MapIPRange_Server script will need to be modified.
INSERT INTO MapIPRangePortList (IPRangeID, PortListID) SELECT ip.IPRangeID, pl.PortListID FROM IPRange AS ip INNER JOIN PortList AS pl ON pl.IsDefault = 1 WHERE IPRangeID NOT IN (SELECT IPRangeID FROM MapIPRangePortList)
INSERT INTO MapIPRange_Server (_ServerID, IPrangeID) SELECT 1, IPRangeID FROM IPRange WHERE IPRangeID NOT IN (SELECT IPRangeID FROM MapIPRange_Server)
Attached IPRange insert Example.xlsx can be used to create a bulk insert, below instructions should be used with this document and contain information on how to make changes. The resulting SQL code should be run against the IQData Database.
- Populate Column B with the required StartIP
- Populate Column D with the required EndIP
- IPRange Type is set to Range, if this is needed to be changed replace the word 'range' in Column E with 'subnet'
- Service Type is set to Port Discovery, if this is required to be changed replace 'Discovery.Port' in Column E with 'Discovery.ICMP'
- Populate Column F with the Location.Name appropriate to the IPRange from the Location table.
- Populate Column H with a description for the location, this is a free text field and can contain any string.
Once the above has been completed, copy column K and paste it into Sql Server Management Studion
Related articles