Learn R Programming

ipaddress (version 1.0.2)

common_network: 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)

Value

An ip_network vector

Arguments

address1

An ip_address vector

address2

An ip_address vector

See Also

summarize_address_range()

Examples

Run this code
# 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"))

Run the code above in your browser using DataLab