common_network: Find the common network of two addresses

View source: R/common_network.R

common_networkR Documentation

Find the common network of two addresses

Description

Returns the smallest network that contains both addresses.

This can construct a network from its first and last addresses. However, if the address range does not match the network boundaries, then the result extends beyond the original address range. Use summarize_address_range() to receive a list of networks that exactly match the address range.

Usage

common_network(address1, address2)

Arguments

address1

An ip_address vector

address2

An ip_address vector

Value

An ip_network vector

See Also

summarize_address_range()

Examples

# address range matches network boundaries
common_network(ip_address("192.168.0.0"), ip_address("192.168.0.15"))

# address range does not match network boundaries
common_network(ip_address("192.167.255.255"), ip_address("192.168.0.16"))

ipaddress documentation built on April 4, 2023, 9:09 a.m.