# IPv4 Address

Key: `technology.internet.ip_v4`

Standard 4-octet IPv4 address format (e.g., 192.168.1.1). Resolves to VARCHAR with INET validation. Can optionally parse to DuckDB INET type with the inet extension.

Page: <https://meridian.online/docs/projects/finetype/types/technology/internet/ip_v4>

Samples: `192.168.1.1`, `8.8.8.8`, `127.0.0.1`, `10.0.0.0`

## Background

### Origin

The Internet Protocol that IPv4 addresses belong to is specified in RFC 791, dated September 1981.[[1]](https://www.rfc-editor.org/rfc/rfc791) RFC 791 states that addresses are fixed length of four octets (32 bits).[[1]](https://www.rfc-editor.org/rfc/rfc791) IPv4 was the first version deployed for production on SATNET in 1982 and on the ARPANET in January 1983.[[2]](https://en.wikipedia.org/wiki/IPv4)

IPv4 addresses are most often written in dot-decimal notation: four octets expressed individually in decimal numbers, without any extra leading zeros, separated by periods.[[2]](https://en.wikipedia.org/wiki/IPv4) The primary address pool of the Internet, maintained by IANA, was exhausted on 3 February 2011.[[2]](https://en.wikipedia.org/wiki/IPv4)

### Use

RFC 6890, Special-Purpose IP Address Registries, lists 127.0.0.0/8 as the Loopback block.[[3]](https://www.rfc-editor.org/rfc/rfc6890.txt)

Python's ipaddress module accepts an IPv4 address as four decimal integers in the inclusive range 0 to 255, separated by dots.[[4]](https://docs.python.org/3/library/ipaddress.html) The ipaddress documentation says leading zeroes are not tolerated, to prevent confusion with octal notation.[[4]](https://docs.python.org/3/library/ipaddress.html) Since Python 3.9.5, leading zeros in an IPv4 address string are treated as an error.[[4]](https://docs.python.org/3/library/ipaddress.html) When a column holds values like 010.001.001.001, decide deliberately what they mean before parsing, rather than letting whichever library is to hand decide for you. (Meridian's view)

DuckDB's inet extension defines the INET data type for storing IPv4 and IPv6 Internet addresses.[[5]](https://duckdb.org/docs/current/core_extensions/inet.html) DuckDB's inet extension supports the CIDR notation for subnet masks.[[5]](https://duckdb.org/docs/current/core_extensions/inet.html) In DuckDB, the host component of an INET value can be extracted using the HOST() function.[[5]](https://duckdb.org/docs/current/core_extensions/inet.html) Keeping the original text alongside a parsed address column is cheap insurance, because a column that mixes bare addresses, prefixes and IPv6 values tends to surprise someone later. (Meridian's view)

### Where you'll meet it

Google's own Public DNS documentation gives its IPv4 addresses as 8.8.8.8 and 8.8.4.4.[[6]](https://developers.google.com/speed/public-dns/docs/using)

## Sources

1. [RFC 791: Internet Protocol](https://www.rfc-editor.org/rfc/rfc791) — standard
2. [IPv4](https://en.wikipedia.org/wiki/IPv4) — secondary source
3. [RFC 6890: Special-Purpose IP Address Registries](https://www.rfc-editor.org/rfc/rfc6890.txt) — standard
4. [ipaddress — IPv4/IPv6 manipulation library](https://docs.python.org/3/library/ipaddress.html) — documentation
5. [inet Extension](https://duckdb.org/docs/current/core_extensions/inet.html) — documentation
6. [Get Started \| Public DNS \| Google for Developers](https://developers.google.com/speed/public-dns/docs/using) — organisation
