Archive for the ‘BGP’ Category

postheadericon Working with Local Preferences

Background
One of my consulting customers request that I review the bgp configuration for errors. I asked what problems he experienced, he advised me that every time his primary Internet connection dropped or bounced or if he rebooted the router he would have to bounce his secondary line after to secure the primary internet connection. I informed him this was natural because you are only receiving a default route from both of your ISP’s and each has only one AS for path selection so whenever you reboot your equipment the first bgp connection to establish is your primary route.

Why?
BGP routes learned from outside (eBGP) select paths on mostly on AS Path length. If you have the same AS path length the router will select the first route to appear in the BGP table. You as the administrator must tell BGP to select the routes you prefer.

Local Preference Vs. Weight
The only Difference between Weight and Local Preference is Local Preference is distributed within your local AS. Weight is Cisco Defined and Router Specific only. Both are a numeric value and you set with the higher value being the preferred route.
Default Local Preference 100
Default Weight 0

Why use Local Preference
I selected Local Preference because my customer might split the BGP connections onto 2 separate routers and run HSRP (Hot Standby Routing Protocol) to diversify the network. Local preference will propagate to all routers with the same AS. This will work perfect once the

Network Diagram

Local Preference Lab

 

Router C

router bgp 300
no synchronization
bgp log-neighbor-changes
network 208.229.144.0 mask 255.255.252.0
aggregate-address 208.229.144.0 255.255.252.0
neighbor 10.0.0.49 remote-as 100
neighbor 10.0.0.49 description GW-to-L3
neighbor 10.0.0.49 soft-reconfiguration inbound
neighbor 10.0.0.49 prefix-list 10288-out out
neighbor 10.0.0.49 route-map gw-l3-out in
neighbor 10.0.0.8 remote-as 200
neighbor 10.0.0.8 description GW-to-Cogent
neighbor 10.0.0.8 soft-reconfiguration inbound
no auto-summary

route-map gw-l3-out permit 10
set local-preference 110

Verify Commands
Show ip bgp
BGP table version is 3722274, local router ID is 208.229.147.17
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal
Origin codes: i – IGP, e – EGP, ? – incomplete
Network Next Hop Metric LocPrf Weight Path
* 0.0.0.0 10.0.0.8 0 0 33321 i
*>i 10.0.0.49 0 110 0 33321 i

As you can tell the best route (indicated by >) is the one with LocPrf of 110

postheadericon BGP Load Sharing with 2 ISP’s


Problem:

Two or more separate connections to the internet from different providers
provides network redundancy. Adding BGP routing with an AS (Autonomous System)
number will provide network failover without IP migration. The default BGP
configuration provides a single path selection. This tutorial will provide you
the information to load balance or share your outbound network connections
evenly.

Tools:

Monitoring tool of bandwidth (I like MRTG)

AS number from Arin.net

Class C network address or /24 Most ISP’s will not announce routes less than a
/24

Default routing from your providers at a minimum. This will work with partial
routes and default routes.

Network Diagram:

BGP ins – outs:

BGP will only select one path (the best) to install in the routing table. BGP
has a command maximum-paths. The maximum-paths command will load share between
equal costs routes. The problem is the AS paths are different because you have
internet connections to separate providers.

Solution:

The solution is very simple we will add our AS path to the incoming routes from
each ISP. The router will think the routes are from the SAME AS and will install
both into routing table. We will need to install the maximum-paths 2 in the bgp
configuration because bgp does not load share by default.

I am using fast Ethernet connection because I do not have enough serial
connections

ISP A Router Configuration:

Ethernet Interface

interface FastEthernet0/0

ip address 10.1.1.1 255.255.255.252

no ip directed-broadcast

duplex auto

speed auto

BGP Configuration to send default routing

router bgp 65535

neighbor 10.1.1.2 remote-as 27006

neighbor 10.1.1.2 default-originate

neighbor 10.1.1.2 soft-reconfiguration inbound

ISP B Router Configuration

Ethernet Interface

interface FastEthernet0/0

ip address 10.0.0.1 255.255.255.252

no ip directed-broadcast

duplex auto

speed auto

BGP Configuration to send default routing to the customer

router bgp 6500

neighbor 10.0.0.2 remote-as 27006

neighbor 10.0.0.2 default-originate

neighbor 10.0.0.2 soft-reconfiguration inbound

CPE Router Configuration

Fast Ethernet Interfaces

interface FastEthernet0/0

description to_ISP_A

ip address 10.1.1.2 255.255.255.252

duplex auto

speed auto

interface FastEthernet0/1

description to_ISP_B

ip address 10.0.0.2 255.255.255.252

duplex auto

speed auto

BGP Configuration

router bgp 27006

bgp log-neighbor-changes

neighbor 10.0.0.1 remote-as 6500

neighbor 10.0.0.1 route-map prepend-as in

neighbor 10.0.0.1 soft-reconfiguration inbound

neighbor 10.1.1.1 remote-as 65535

neighbor 10.1.1.1 soft-reconfiguration inbound

neighbor 10.1.1.1 route-map prepend-as in

maximum-paths 2

Route Map for Prepending AS

route-map prepend-as permit 10

set as-path prepend 27006

Check you work with show commands from the CPE

Make sure you both bgp peers are connected and sharing information

Show ip bgp summary

BGP router identifier 10.1.1.2, local AS number 27006

BGP table version is 2, main routing table version 2

1 network entries using 97 bytes of memory

3 path entries using 108 bytes of memory

1 multipath network entries and 2 multipath paths

4 BGP path attribute entries using 240 bytes of memory

4 BGP AS-PATH entries using 96 bytes of memory

0 BGP route-map cache entries using 0 bytes of memory

0 BGP filter-list cache entries using 0 bytes of memory

BGP using 541 total bytes of memory

1 received paths for inbound soft reconfiguration

BGP activity 2/1 prefixes, 5/2 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd

10.0.0.1 4 6500 21 23 2 0 0 00:03:30 1

10.1.1.1 4 65535 22 23 2 0 0 00:03:29 1

Check to see if each peer is sending you a default route

Check the bgp table to see the routes Notice you will see you AS number
prepeneded to your ISP’s AS number. This is normal and needed for the
configuration to work.

cpe#show ip bgp

BGP table version is 2, local router ID is 10.1.1.2

Status codes: s suppressed, d damped, h history, * valid, > best, i – internal

Origin codes: i – IGP, e – EGP, ? – incomplete

Network Next Hop Metric LocPrf Weight Path

*> 0.0.0.0 10.1.1.1 0 27006 65535 i

* 10.0.0.1 0 27006 6500 i
cpe#show ip bgp neighbors 10.0.0.1 received-routes

BGP table version is 4, local router ID is 10.1.1.2

Status codes: s suppressed, d damped, h history, * valid, > best, i – internal

Origin codes: i – IGP, e – EGP, ? – incomplete

Network Next Hop Metric LocPrf Weight Path

* 0.0.0.0 10.0.0.1 0 6500 i

cpe#show ip bgp neighbors 10.1.1.1 received-routes

BGP table version is 2, local router ID is 10.1.1.2

Status codes: s suppressed, d damped, h history, * valid, > best, i – internal

Origin codes: i – IGP, e – EGP, ? – incomplete

Network Next Hop Metric LocPrf Weight Path

* 0.0.0.0 10.1.1.1 0 65535 i

Check to see if both routes have been installed in the routing table.

Show ip route

cpe#show ip route

Codes: C – connected, S – static, I – IGRP, R – RIP, M – mobile, B – BGP

D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area

N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2

E1 – OSPF external type 1, E2 – OSPF external type 2, E – EGP

i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2

ia – IS-IS inter area, * – candidate default, U – per-user static route

o – ODR, P – periodic downloaded static route

Gateway of last resort is 10.1.1.1 to network 0.0.0.0

10.0.0.0/30 is subnetted, 2 subnets

C 10.0.0.0 is directly connected, FastEthernet0/1

C 10.1.1.0 is directly connected, FastEthernet0/0

B* 0.0.0.0/0 [20/0] via 10.1.1.1, 00:06:18

[20/0] via 10.0.0.1, 00:06:18

Everything looks great.  Now configure your monitoring tools to monitor
your outbound traffic, you should experience almost evenly distributed traffic.

If you have any comments or requests send to
my email
address admin@ccnalab.net

Next: Influencing Inbound Traffic

Cheers

Jim G

IBS Network Team

Thanks to Impact Business Solutions for use of the routers and bandwidth to set
up this scenario

Do you want more ?

View Results

Loading ... Loading ...

Categories