Showing posts with label BGP. Show all posts
Showing posts with label BGP. Show all posts

Saturday, August 11, 2012

BGP Regular Expression


On R4, I only want to learn routes from R5 that originated from AS100 and deny everything else. One way of accomplishing this is to use a BGP filter-list. We will use the topology in figure 1.


Figure 1
Current BGP Config with the filter-list already applied.

R4#show running-config | section router bgp
router bgp 300
 no synchronization
 bgp log-neighbor-changes
 network 172.16.1.0 mask 255.255.255.0
 network 172.17.1.0 mask 255.255.255.0
 network 175.175.1.0 mask 255.255.255.0
 neighbor 192.168.4.2 remote-as 100
 neighbor 192.168.4.2 weight 100
 neighbor 192.168.4.2 maximum-prefix 100
 neighbor 192.168.6.2 remote-as 300
 neighbor 192.168.6.2 filter-list 1 in
 no auto-summary
R4#


Verify debug:

R4#show debugging
IP routing:
  BGP updates debugging is on for address family: IPv4 Unicast


Verify AS Path Access-List:

R4#show ip as-path-access-list
AS path access list 1
    permit ^100$


Perform a route refresh for peer 192.168.6.2:

R4#clear ip bgp 192.168.6.2 in
R4#

Confirms AS Path Access-List is working as expected from debug:

*Mar  1 01:00:14.715: BGP(0): 192.168.6.2 rcvd UPDATE w/ attr: nexthop 192.168.6.2, origin i, localpref 100, metric 0
*Mar  1 01:00:14.719: BGP(0): 192.168.6.2 rcvd 176.176.1.0/24 -- DENIED due to: filter-list;
*Mar  1 01:00:14.723: BGP(0): 192.168.6.2 rcvd 172.19.1.0/24 -- DENIED due to: filter-list;
*Mar  1 01:00:14.727: BGP(0): 192.168.6.2 rcvd 172.18.1.0/24 -- DENIED due to: filter-list;
*Mar  1 01:00:14.731: BGP(0): 192.168.6.2 rcvd UPDATE w/ attr: nexthop 192.168.6.2, origin i, localpref 100, metric 0, path 100
*Mar  1 01:00:14.735: BGP(0): 192.168.6.2 rcvd 9.9.9.0/24
*Mar  1 01:00:14.743: BGP(0): 192.168.6.2 rcvd UPDATE w/ attr: nexthop 192.168.6.2, origin i
R4#, localpref 100, metric 0, path 100
*Mar  1 01:00:14.747: BGP(0): 192.168.6.2 rcvd 8.8.8.0/24
*Mar  1 01:00:14.751: BGP(0): 192.168.6.2 rcvd 7.7.7.0/24
*Mar  1 01:00:14.751: BGP(0): 192.168.6.2 rcvd UPDATE w/ attr: nexthop 192.168.6.2, origin ?, localpref 100, metric 0, path 100
*Mar  1 01:00:14.751: BGP(0): 192.168.6.2 rcvd 177.177.1.0/24

Verifying BGP database:

R4#show ip bgp
BGP table version is 32, local router ID is 175.175.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
* i7.7.7.0/24       192.168.6.2              0    100      0 100 i
*>                  192.168.4.2                          100 100 i
* i8.8.8.0/24       192.168.6.2              0    100      0 100 i
*>                  192.168.4.2                          100 100 i
* i9.9.9.0/24       192.168.6.2              0    100      0 100 i
*>                  192.168.4.2              0           100 100 i
*> 172.16.1.0/24    0.0.0.0                  0         32768 i
*> 172.17.1.0/24    0.0.0.0                  0         32768 i
*> 175.175.1.0/24   0.0.0.0                  0         32768 i
* i177.177.1.0/24   192.168.6.2              0    100      0 100 ?
*>                  192.168.4.2                          100 100 ?
R4#

Further Reading:

Using Regular Expressions in BGP

Juniper Using Regular Expressions



Wednesday, August 8, 2012

Show IP BGP Explained

show ip bgp 1.1.1.1

192.168.1.1 (metric 700) from 192.168.1.1 (192.168.1.1)
Origin IGP, Metric 1700, localpref 100, valid, internal, best

  1. Next-hop.
  2. IGP metric to reach next-hop. Taken directly from the routing table.
  3. Address of the router that gave you the update.
  4. ID of that router.
  5. MED - multi-exit discriminator