Skip to content

is_link_local

Checks whether an IP address is a link-local address.

is_link_local(x:ip) -> bool

The is_link_local function checks whether a given IP address x is a link-local address.

For IPv4, link-local addresses are in the range 169.254.0.0 to 169.254.255.255 (169.254.0.0/16).

For IPv6, link-local addresses are in the range fe80::/10.

Link-local addresses are used for communication between nodes on the same network segment and are not routable on the internet.

from {
ipv4_link_local: 169.254.1.1.is_link_local(),
ipv6_link_local: fe80::1.is_link_local(),
not_link_local: 192.168.1.1.is_link_local(),
}
{
ipv4_link_local: true,
ipv6_link_local: true,
not_link_local: false,
}

is_v4, is_v6, is_multicast, is_loopback, is_private, is_global, ip_category

Last updated: