Skip to content

Prefix List

Configure IPv4 and IPv6 prefix lists for route filtering and access control. Prefix lists provide a powerful mechanism to filter routes based on network prefixes and prefix lengths, commonly used in routing policies, route maps, and access control.

Diagram
NameTypeConstraintMandatoryDefault Value
prefix_listsClass[prefix_lists]No

prefix_lists (iosxr.devices.configuration)

Section titled “prefix_lists (iosxr.devices.configuration)”
NameTypeConstraintMandatoryDefault Value
ipv4List[ipv4]No
ipv6List[ipv6]No

ipv4 (iosxr.devices.configuration.prefix_lists)

Section titled “ipv4 (iosxr.devices.configuration.prefix_lists)”
NameTypeConstraintMandatoryDefault Value
nameStringmax: 32Yes
entriesList[entries]No

ipv6 (iosxr.devices.configuration.prefix_lists)

Section titled “ipv6 (iosxr.devices.configuration.prefix_lists)”
NameTypeConstraintMandatoryDefault Value
nameStringmax: 32Yes
entriesList[entries]No

entries (iosxr.devices.configuration.prefix_lists.ipv4)

Section titled “entries (iosxr.devices.configuration.prefix_lists.ipv4)”
NameTypeConstraintMandatoryDefault Value
sequenceIntegermin: 1, max: 2147483646Yes
actionChoicedeny, permitNo
exact_lengthIntegermin: 0, max: 32No
maskAnyString or Integer[min: 0, max: 32] or String[Regex: ^.*[\$\%]\{.*$]No
max_lengthIntegermin: 0, max: 32No
min_lengthIntegermin: 0, max: 32No
prefixIPNo
remarkStringNo

entries (iosxr.devices.configuration.prefix_lists.ipv6)

Section titled “entries (iosxr.devices.configuration.prefix_lists.ipv6)”
NameTypeConstraintMandatoryDefault Value
sequenceIntegermin: 1, max: 2147483646Yes
actionChoicedeny, permitNo
exact_lengthIntegermin: 0, max: 128No
maskIntegermin: 0, max: 128No
max_lengthIntegermin: 0, max: 128No
min_lengthIntegermin: 0, max: 128No
prefixIPNo
remarkStringNo
zoneIntegermin: 0, max: 4294967295No

  • IPv6 prefix list remarks (remark) are not supported via gNMI. Use remarks only in IPv4 prefix lists.

IPv4 Mask Formats

The IPv4 mask field accepts both dotted-decimal and prefix-length:

  • dotted-decimal (e.g., 255.255.255.0)
  • prefix-length integer (e.g., 24)

Both formats can be used interchangeably. The normalization layer automatically converts prefix-length integers to dotted-decimal before sending to the device, preventing configuration drift.

Example-1: IPv4 prefix list with permit and deny entries.

iosxr:
devices:
- name: router-1
host: 10.10.10.1:57400
configuration:
prefix_lists:
ipv4:
- name: MGMT_NETWORKS
entries:
- sequence: 10
action: permit
prefix: 192.168.1.0
mask: 255.255.255.0
exact_length: 24
- sequence: 20
action: deny
prefix: 0.0.0.0
mask: 0.0.0.0

Example-2: IPv4 prefix list with remarks and range matching.

iosxr:
devices:
- name: router-1
host: 10.10.10.1:57400
configuration:
prefix_lists:
ipv4:
- name: MGMT_NETWORKS
entries:
- sequence: 5
remark: "Allow management subnet"
- sequence: 10
action: permit
prefix: 192.168.1.0
mask: 24
exact_length: 24
- sequence: 20
action: permit
prefix: 10.0.0.0
mask: 255.0.0.0
min_length: 8
max_length: 24
- sequence: 25
remark: "Deny all others"
- sequence: 30
action: deny
prefix: 0.0.0.0
mask: 0.0.0.0

Example-3: IPv6 prefix list with permit/deny entries and zone.

iosxr:
devices:
- name: router-1
host: 10.10.10.1:57400
configuration:
prefix_lists:
ipv6:
- name: IPV6_MGMT
entries:
- sequence: 10
action: permit
prefix: "2001:db8:1::"
mask: 48
min_length: 64
max_length: 128
- sequence: 20
action: deny
prefix: "::"
mask: 0

Example-4: IPv4 and IPv6 prefix lists on one device.

iosxr:
devices:
- name: router-1
host: 10.10.10.1:57400
configuration:
prefix_lists:
ipv4:
- name: MGMT_NETWORKS
entries:
- sequence: 10
action: permit
prefix: 192.168.1.0
mask: 255.255.255.0
exact_length: 24
- name: LOOPBACK_NETWORKS
entries:
- sequence: 10
action: permit
prefix: 172.16.0.0
mask: 255.240.0.0
exact_length: 32
ipv6:
- name: IPV6_MGMT
entries:
- sequence: 10
action: permit
prefix: "2001:db8:1::"
mask: 48
min_length: 64
max_length: 128
- name: IPV6_LOOPBACKS
entries:
- sequence: 10
action: permit
prefix: "2001:db8:ffff::"
mask: 48
exact_length: 128