Configuring Route Map for Neighbors

Route maps are used to control and modify routing information that is exchanged between routing domains. Route maps consist of a list of match and set configuration commands. The match commands specify match criteria and the set commands specify the action taken if the match criteria are met.

When applied to incoming or outgoing routes, route map provides the control on the distribution of routes between two BGP peers.

When configuring “In direction Routemap for the Neighbor”, the route map will be applied on the routes coming from that Neighbor before installing to the local RIB.

When configuring “Out direction Routemap for the Neighbor”, the route map will be applied on the routes advertised to that neighbor.

The figure shown below depicts the topology setup used for this configuration.

Figure 1. BGP Configuration and Testing Topology


Use the following commands to configure BGP routing.

  1. To enable BGP in Router R1:

    Execute the following commands:

    • Enter the Global Configuration Mode.
    iS5comm# configure terminal
    • Enter the Autonomous System ( AS) number in R1.
    iS5comm(config)# as-num 100
    • Configure the router-id in R1.
    iS5comm(config)# router-id 12.0.0.1
    • Enable BGP in R1.
    iS5comm(config)# router bgp 100
    • Configure R2 (with as-num 100) as internal peer in R1.
    iS5comm(config-router)# neighbor 12.0.0.2 remote-as 100
    • Configure Out Direction Route Map for the peer R2.
    iS5comm(config-router)# neighbor 10.0.0.2 route-map RMAP out
    • Configure In Direction Route Map for the peer R2.
    iS5comm(config-router)# neighbor 12.0.0.2 route-map INRMAP in
    • Create Route map RMAP.
    iS5comm(config)# route-map  RMAP permit 10
    • Match destination ip 16.0.0.0 /8
    iS5comm(config-rmap-RMAP)# match destination ip 16.0.0.0 255.0.0.0
    • Set local preference.
    iS5comm(config-rmap-RMAP)# set local-preference 150
    • Create Route map INRMAP. local preference.
    iS5comm(config)# route-map INRMAP permit 10
    • Match destination IP 17.0.0.0 /8
    iS5comm(config-rmap-RMAP)# match destination ip 17.0.0.0 255.0.0.0
    • Set local preference
    iS5comm(config-rmap-RMAP)# set local-preference 125

  2. To enable BGP in Router R2:

    Execute the following commands:

    • Enter the Global Configuration Mode.
    iS5comm# configure terminal
    • Enter the Autonomous System ( AS) number in R2.
    iS5comm(config)# as-num 100
    • Configure the router-id in R2.
    iS5comm(config)# router-id 12.0.0.2
    • Enable BGP in R2.
    iS5comm(config)# router bgp 100
    • Configure R1 (with as-num 100) as internal peer in R2.
    iS5comm(config-router)# neighbor 12.0.0.1 remote-as 100

  3. R1: Add static route 16.0.0.0/8.
  4. R2: Add static route 17.0.0.0/8 and verify the results.

    Type the following:

    • R1:
    iS5comm# show ip bgp neighbor
    BGP neighbor is 12.0.0.2, remote AS 100, external link
    BGP version 4, remote router ID 12.0.0.2
    BGP state = Established, up for 2 minutes 43 seconds, un-authenticated session
    Configured BGP Maximum Prefix Limit 100
    Configured Connect Retry Count 5
    Current Connect Retry Count 0
    Peer Passive : DISABLED
    Peer Status : NOT DAMPED
    Rcvd update before 0 secs, hold time is 90, keepalive interval is 30 secs
    Neighbors Capability:
    Route-Refresh: Advertised and received
    Address family IPv4 Unicast: Advertised and received
    Received 7 messages, 0 Updates
    Sent 7 messages, 0 Updates
    Route refresh: Received 0, sent 0.
    Minimum time between advertisement runs is 5 seconds
    Connections established 1 time(s)
    Local host: 12.0.0.1, Local port: 179
    Foreign host: 12.0.0.2, Foreign port: 49152
    Last Error: Code 0, SubCode 0.

  5. R2: View the BGP session information using ‘show ip bgp summary’, ‘show ip bgp neighbor’ and ‘show ip bgp info’ commands.

    Type the following:

    iS5comm# show ip bgp summary
    BGP router identifier is 10.0.0.2, local AS number 100
    BGP table version is 0
    Neighbor  Version AS MsgRcvd MsgSent Up/DownState/PfxRcd
     -------------------------------- ----------------
    10.0.0.1  4      100  6      6       00:00:00:0  Established

    iS5comm# show ip bgp summary
    BGP neighbor is 10.0.0.1, remote AS 100, internal link
    BGP version 4, remote router ID 10.0.0.1
    BGP state = Established, up for 2 minutes 27 seconds
    Configured BGP Maximum Prefix Limit 100
    Configured Connect Retry Count 5
    Current Connect Retry Count 0
    Peer Passive : DISABLED
    Peer Status : NOT DAMPED
    Rcvd update before 0 secs, hold time is 90, keepalive interval is 30 secs
    Neighbors Capability:
    Route-Refresh: Advertised and received
    Address family IPv4 Unicast: Advertised and received
    Received 6 messages, 0 Updates
    Sent 6 messages, 0 Updates
    Route refresh: Received 0, sent 0.
    Minimum time between advertisement runs is 5 seconds
    Connections established 1 time(s)
    Local host: 10.0.0.2, Local port: 179
    Foreign host: 10.0.0.1, Foreign port: 49152
    Last Error: Code 0, SubCode 0.

    iS5comm# show ip bgp bgp
    BGP table version is 3,local router ID is 12.0.0.1
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
     S Stale
     Origin codes: i - IGP, e - EGP, ? - incomplete
    
    
     Type       Network            NextHop     Metric  LocPrf  Path  Origin
    ----       -------            -------     ------  ------  ----  ------
     >           12.0.0.0/ 8         0.0.0.0       0       0     -     i
     >           16.0.0.0/ 8         0.0.0.0               0     -     ?
     >i          17.0.0.0/ 8        12.0.0.2             125     -     ?

    • R2:
    iS5comm# show ip bgp bgp
    BGP table version is 3,local router ID is 12.0.0.2
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
     S Stale
    Origin codes: i - IGP, e - EGP, ? - incomplete
    Type   Network NextHop   Metric LocPrf Path  Origin
    -----  ------ ------  ------  ----  ------ 
    >    12.0.0.0/ 8  0.0.0.0   0      0     -      i 
    >i   16.0.0.0/ 8  12.0.0.1  150          -     ? 
    >    17.0.0.0/ 8  0.0.0.0    0           -     ?