IP address field type
Summarize
Summary of IP address field type
The IP Address field type [ipaddr] in ServiceNow supports storing validated IPv4 and IPv6 addresses, ensuring standardized input and storage. It accepts IPv4 in dot-decimal notation and IPv6 in hex notation, including compressed canonical forms per IETF RFC5952 guidelines.
Show less
Key Features
- Validation and notation support: Accepts valid IPv4 and IPv6 addresses, supporting both expanded and canonical IPv6 formats.
- Standardized storage: IP addresses are stored as VARCHAR fields with a length of 40 characters in the database, typically in standard dot-decimal (IPv4) or canonical (IPv6) notation regardless of input format.
- Canonicalization control: The system can automatically convert IPv6 addresses to canonical format unless overridden by the
ipdatacontrolattribute on the field. - Data migration support: Facilitates migrating existing IP address data stored as strings to the validated IP address field type, enforcing valid IP formats.
- ipdatacontrol attribute: Controls validation and normalization behaviors with four settings:
- canonical: Validates and canonicalizes IPs; rejects invalid addresses.
- canonicalizewhenpossible (default): Validates and canonicalizes valid IPs; accepts invalid IPs without changes.
- expanded: Validates and stores addresses in expanded form for efficient range queries; rejects invalid IPs.
- none: Disables validation and normalization, treating the field like a plain string (used only in emergencies).
Practical Implications for ServiceNow Customers
Using the IP Address field type ensures IP data integrity and consistent formatting, which enhances data quality and search efficiency, especially for IPv6 addresses. The ability to control validation and formatting behavior through the ipdatacontrol attribute allows customization based on your organization’s data handling needs. When migrating legacy IP data, the field type helps enforce valid IP entry, reducing errors and improving reliability in IP-related workflows and reporting.
The IP Address (Validated IPV4, IPV6) [ip_addr] field type stores valid IPv4 and IPv6 addresses.
Support for IPv4 and IPv6
Standard dot-decimal notation is supported for IPv4 and standard hex notation is supported for IPv6. For IPv6, you can use canonical notation to compress zeros. Familiarize yourself with IETF RFC5952 for examples and guidelines on text representation for IPv6 addresses.
- A standard IPv4 address in dot-decimal notation:
10.34.51.20 - An expanded IPv4 address would be zero
padded:
10.1.10.210would be represented as010.001.010.210 - An IPv6 address in fully expanded notation:
1507:f0d0:1002:0051:0000:0000:0000:0004 - The same IPv6 address above using the canonical notation:
1507:f0d0:1002:51::4
How IP addresses are stored in the database
The IP address ip_addr field is a Variable Character (VARCHAR) field with
a length of 40 characters. The values are normally stored in standard (dot-decimal or
canonical) notation for both IPv4 and IPv6 addresses regardless of the notation you use when
you input values in the field.
For example, if you enter an IPv6 address in a non-canonical format (expanded or any other valid formats per IETF RFC5952), by default, the system will store it in canonical format unless an IP Data Control attribute value is defined on that column with a different address format. See the [ip_data_control] glide attribute section in Altering tables and fields using dictionary attributes for more details.
Support for data migration
- canonical: Incoming IP addresses are validated and canonicalized before they are entered in the database. Invalid IP addresses are rejected.
- canonicalize_when_possible: Valid IP addresses are canonicalized
before before being entered in to the database. Invalid IP addresses are also entered in
to the database without being
changed.Note:canonicalize_when_possible is the default value for the ip_data_control attribute, unless it's otherwise specified.
- expanded: The IP addresses are validated and stored in an expanded form to support efficient database range queries. Invalid IP addresses are rejected.
- none: No validation or normalization is performed in this value type. It is used only as an emergency mechanism as it essentially reverts this type to a plain string field.