IP address updating - Server Discovery

Abdul Musavvir
Kilo Guru

Hello All

 

We have a server which has two IP addresses

primary IP address  - active

secondary IP address - inactive

 

So through discovery the secondary IP address is not reachable as it is inactive.

After some time the primary IP will become inactive and secondary IP will be active. In this case, the existing CI records will be updated and the IP address field value will be replaced with secondary IP.

 

What we need is 

Primary IP - to stay on IP address field even it is inactive

Secondary IP - to be populated in new IP field and added as a new record in cmdb_ci_ip_address table.

 

Any suggestions will be helpful.

 

Thanks in Advance

-Abdul Musavvir

4 REPLIES 4

Abbas_5
Tera Sage
Tera Sage

Hello @Abdul Musavvir ,

Please refer to the below link:
https://docs.servicenow.com/en-US/bundle/vancouver-it-operations-management/page/product/discovery/r...

 

If it is helpful, mark it as a thumbs-up!

Thanks & Regards,
Abbas

Rahul Priyadars
Giga Sage
Giga Sage

Some detailing about How IP is worked by Discovery- 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0687602

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0864627

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0821592

 

For ur use case u need some customization in Pattern  to Update second IP Attribute in CI.

But how u will identify which one is Secondary IP ?

 

Regards

RP

Alvaro Paronuzz
ServiceNow Employee
ServiceNow Employee

Was the solution identified? I am seeing a similar behavior and I would really appreciate if someone could share how this has been addressed.

 

Thanks and Regards,

AP

AJ-TechTrek
Giga Sage
Giga Sage

Hi @Abdul Musavvir ,

 

As per my understanding Why the issue happens:


By default, ServiceNow Discovery:


* Uses the reachable IP (active one) during Discovery.
* Updates the CI’s ip_address field with the current reachable IP.
* Maintains multiple IPs in the cmdb_ci_ip_address table (linked via cmdb_ci_ip_router or similar tables).
So when primary becomes inactive, Discovery overwrites ip_address with the new active IP.

 

Target:
* Keep the original (primary) IP in the ip_address field even if it becomes inactive.
* Capture new (secondary) IP as an additional record in cmdb_ci_ip_address.
* Both IPs remain visible and associated with the CI.

 

Solution approach (recommended) will help to resolve this issue -


1. Ensure both IPs are discovered and stored
* Even if secondary is inactive, Discovery normally only picks reachable IPs.
* To get both, configure:
* Discovery > IP Ranges / Schedules: Scan full subnet including both IPs.
* Discovery Behaviors: By default, Discovery doesn't remove old IPs; it keeps them in cmdb_ci_ip_address but updates ip_address on the CI.
* Confirm: check if you already have both IPs in cmdb_ci_ip_address linked to the CI via ip_address relationship.

 

2. Prevent ip_address field from being overwritten
* Create a Business Rule on your CI class (e.g., cmdb_ci_computer):
* Runs before update.
* Checks: if ip_address field is about to be replaced (new active IP) AND current ip_address is primary.
* Cancels the change or resets to original primary IP.
Pseudo-code example:
if (current.ip_address == 'Primary_IP' && current.ip_address != newRecord.ip_address) {
newRecord.ip_address = current.ip_address; // keep primary IP
}
(Replace 'Primary_IP' dynamically; maybe store it in another field like u_primary_ip.)

 

3. Store secondary IP separately
* Add a custom field on CI: u_secondary_ip.
* After Discovery adds a new IP in cmdb_ci_ip_address, write a Business Rule or Scripted REST / Scheduled Job:
* Find additional IPs linked to CI.
* Update u_secondary_ip with the new IP.

 

4. Keep cmdb_ci_ip_address table clean
* Don’t block Discovery from adding/removing IPs in cmdb_ci_ip_address.
* Let it add the new IP when it’s reachable; your logic ensures the CI record keeps primary IP in ip_address and moves the new IP to u_secondary_ip.

 

Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.
 

Thank You
AJ - TechTrek with AJ - ITOM Trainer
LinkedIn:- https://www.linkedin.com/in/ajay-kumar-66a91385/
YouTube:- https://www.youtube.com/@learnitomwithaj
Topmate:- https://topmate.io/aj_techtrekwithaj (Connect for 1-1 Session)
ServiceNow Community MVP 2025