Configure FRRouting route maps and prefix lists for advanced routing policies

Advanced 45 min May 02, 2026 146 views
Ubuntu 24.04 Debian 12 AlmaLinux 9 Rocky Linux 9

Set up FRRouting with route maps and prefix lists to control BGP route advertisement, implement traffic engineering, and create sophisticated routing policies for enterprise networks.

Prerequisites

  • Root or sudo access
  • Basic understanding of BGP and routing concepts
  • Network interfaces configured with IP addresses
  • Understanding of AS numbers and BGP communities

What this solves

FRRouting route maps and prefix lists give you precise control over BGP routing policies. Use them to filter routes based on prefixes, modify BGP attributes for traffic engineering, and implement complex routing decisions across your network infrastructure.

Step-by-step installation

Update system packages

Start by updating your package manager to ensure you get the latest versions of all packages.

sudo apt update && sudo apt upgrade -y
sudo dnf update -y

Install FRRouting

Install FRRouting package along with essential networking tools for BGP routing management.

sudo apt install -y frr frr-pythontools iproute2 net-tools
sudo dnf install -y frr frr-pythontools iproute net-tools

Enable BGP daemon

Configure FRRouting to enable the BGP daemon which is required for route maps and prefix lists.

bgpd=yes
ospfd=no
ospf6d=no
ripd=no
ripngd=no
isisd=no
pimd=no
ldpd=no
nhrpd=no
eigrpd=no
babeld=no
sharpd=no
pbrd=no
bfdd=no
fabricd=no
vrrpd=no
pathd=no

Start and enable FRRouting

Start the FRRouting service and enable it to automatically start on boot.

sudo systemctl enable --now frr
sudo systemctl status frr

Create and configure prefix lists

Access FRRouting configuration shell

Connect to the FRRouting configuration interface to create prefix lists and route maps.

sudo vtysh

Create basic prefix lists

Define prefix lists to match specific network ranges. This example creates lists for internal networks and customer routes.

configure terminal
!
ip prefix-list INTERNAL_NETWORKS seq 10 permit 10.0.0.0/8 le 24
ip prefix-list INTERNAL_NETWORKS seq 20 permit 172.16.0.0/12 le 24
ip prefix-list INTERNAL_NETWORKS seq 30 permit 192.168.0.0/16 le 24
!
ip prefix-list CUSTOMER_ROUTES seq 10 permit 203.0.113.0/24
ip prefix-list CUSTOMER_ROUTES seq 20 permit 198.51.100.0/24
ip prefix-list CUSTOMER_ROUTES seq 30 permit 198.51.101.0/24
!
ip prefix-list DEFAULT_ROUTE seq 10 permit 0.0.0.0/0
!
ip prefix-list DENY_ALL seq 10 deny any

Create advanced prefix lists with length matching

Use prefix length operators to match routes more precisely. The le (less than or equal) and ge (greater than or equal) operators control subnet matching.

!
ip prefix-list AGGREGATE_ROUTES seq 10 permit 10.0.0.0/8 ge 16 le 20
ip prefix-list HOST_ROUTES seq 10 permit 0.0.0.0/0 ge 32
ip prefix-list SMALL_SUBNETS seq 10 permit 0.0.0.0/0 ge 28
!
ip prefix-list TRANSIT_PREFIXES seq 10 deny 10.0.0.0/8 le 32
ip prefix-list TRANSIT_PREFIXES seq 20 deny 172.16.0.0/12 le 32
ip prefix-list TRANSIT_PREFIXES seq 30 deny 192.168.0.0/16 le 32
ip prefix-list TRANSIT_PREFIXES seq 40 permit any

Configure route maps with filtering policies

Create basic route map for prefix filtering

Route maps apply policies to matched prefixes. This example filters internal networks and sets BGP attributes.

!
route-map FILTER_INTERNAL permit 10
 match ip address prefix-list INTERNAL_NETWORKS
 set local-preference 200
 set community 65001:100
!
route-map FILTER_INTERNAL deny 20

Create route map for customer traffic engineering

Implement traffic engineering by modifying BGP attributes like AS-path prepending and MED values for different customer routes.

!
route-map CUSTOMER_POLICY permit 10
 match ip address prefix-list CUSTOMER_ROUTES
 set metric 100
 set as-path prepend 65001 65001
 set community 65001:200
!
route-map CUSTOMER_POLICY permit 20
 match ip address prefix-list DEFAULT_ROUTE
 set local-preference 50
!
route-map CUSTOMER_POLICY deny 30

Create route map for transit provider policies

Configure different policies for multiple transit providers to control route advertisement and path selection.

!
route-map TRANSIT_IN permit 10
 match ip address prefix-list TRANSIT_PREFIXES
 set local-preference 150
 set community 65001:300
!
route-map TRANSIT_OUT permit 10
 match ip address prefix-list INTERNAL_NETWORKS
 set as-path prepend 65001
!
route-map TRANSIT_OUT permit 20
 match ip address prefix-list CUSTOMER_ROUTES
!
route-map TRANSIT_OUT deny 30

Implement advanced routing policies and redistribution

Configure BGP with route maps

Apply the created route maps to BGP neighbors for inbound and outbound route processing.

!
router bgp 65001
 bgp router-id 203.0.113.1
 bgp log-neighbor-changes
!
 neighbor 203.0.113.10 remote-as 65002
 neighbor 203.0.113.10 route-map CUSTOMER_POLICY in
 neighbor 203.0.113.10 route-map FILTER_INTERNAL out
!
 neighbor 203.0.113.20 remote-as 65003
 neighbor 203.0.113.20 route-map TRANSIT_IN in
 neighbor 203.0.113.20 route-map TRANSIT_OUT out
!
 address-family ipv4 unicast
  network 10.0.0.0/16
  network 172.16.0.0/16
 exit-address-family

Configure route redistribution with route maps

Control which routes get redistributed between different routing protocols using route maps.

!
route-map REDISTRIBUTE_CONNECTED permit 10
 match interface eth0
 set metric 50
!
route-map REDISTRIBUTE_STATIC permit 10
 match ip address prefix-list INTERNAL_NETWORKS
 set community 65001:400
!
router bgp 65001
 redistribute connected route-map REDISTRIBUTE_CONNECTED
 redistribute static route-map REDISTRIBUTE_STATIC

Implement conditional route advertisement

Use route maps with conditional logic to advertise routes only when specific conditions are met.

!
route-map CONDITIONAL_ADVERTISE permit 10
 match ip address prefix-list CUSTOMER_ROUTES
 match community 65001:200
 set community 65001:500
!
route-map BACKUP_PATH permit 10
 match ip address prefix-list DEFAULT_ROUTE
 set local-preference 25
 set community 65001:600
!
router bgp 65001
 neighbor 203.0.113.30 remote-as 65004
 neighbor 203.0.113.30 route-map CONDITIONAL_ADVERTISE out
 neighbor 203.0.113.30 route-map BACKUP_PATH in

Save and apply configuration

Write the configuration to memory and exit the configuration interface.

!
write memory
exit

Enable IP forwarding

Configure the system to forward IP packets between network interfaces for proper routing functionality.

echo 'net.ipv4.ip_forward=1' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

Verify your setup

sudo vtysh -c "show ip prefix-list"
sudo vtysh -c "show route-map"
sudo vtysh -c "show ip bgp summary"
sudo vtysh -c "show ip bgp neighbors"
sudo vtysh -c "show ip route"

Check that BGP neighbors are established and routes are being processed correctly:

sudo vtysh -c "show ip bgp neighbors 203.0.113.10 routes"
sudo vtysh -c "show ip bgp community 65001:100"
sudo vtysh -c "show ip bgp regexp 65001"

Common issues

SymptomCauseFix
BGP neighbors won't establishIncorrect AS numbers or IP addressessudo vtysh -c "show ip bgp summary" and verify neighbor config
Routes not being filteredRoute map not applied to neighborAdd route-map POLICY_NAME in/out to neighbor configuration
Prefix list matches wrong networksIncorrect use of le/ge operatorsCheck prefix length logic with show ip prefix-list detail
BGP attributes not being setRoute map deny statement reachedAdd explicit permit statements or reorder route map entries
Routes disappearing from tableConflicting route map policiesReview all route maps with show route-map for conflicts
Performance issues with large tablesInefficient prefix list orderingPut most specific matches first, use sequence numbers

Next steps

Running this in production?

Need this managed professionally? Running BGP at scale adds complexity around capacity planning, failover testing, route optimization, and 24/7 monitoring. See how we run infrastructure like this for European teams managing critical network infrastructure.

Automated install script

Run this to automate the entire setup

Need help?

Don't want to manage this yourself?

We handle private cloud infrastructure for businesses that depend on uptime. From initial setup to ongoing operations.