Friday, 5 June 2009

BGP Lab configs #2

R1


router bgp 1235
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
network 10.1.1.0 mask 255.255.255.0
aggregate-address 16.0.0.0 252.0.0.0 summary-only
neighbor PEERGROUP1235 peer-group
neighbor PEERGROUP1235 remote-as 1235
neighbor PEERGROUP1235 route-reflector-client
neighbor PEERGROUP1235 prefix-list ALLOW520 out
neighbor 10.1.1.2 peer-group PEERGROUP1235
neighbor 10.1.1.3 peer-group PEERGROUP1235
neighbor 10.1.1.5 peer-group PEERGROUP1235
no auto-summary


R2

router bgp 1235
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
network 2.2.2.2 mask 255.255.255.255
network 10.1.1.0 mask 255.255.255.0
neighbor 10.1.1.1 remote-as 1235
no auto-summary
!


R3

router bgp 1235
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
network 3.3.3.3 mask 255.255.255.255
network 10.1.1.0 mask 255.255.255.0
neighbor 10.1.1.1 remote-as 1235
neighbor 10.1.1.4 remote-as 4
no auto-summary
!


R4

router bgp 4
no synchronization
bgp router-id 4.4.4.4
bgp log-neighbor-changes
network 4.4.4.4 mask 255.255.255.255
network 10.1.1.0 mask 255.255.255.0
neighbor 10.1.1.3 remote-as 1235
no auto-summary


R5

router bgp 1235
no synchronization
bgp router-id 5.5.5.5
bgp log-neighbor-changes
network 5.5.5.5 mask 255.255.255.255
network 10.1.1.0 mask 255.255.255.0
network 16.0.0.0
network 17.0.0.0
network 18.0.0.0
network 19.0.0.0
neighbor 10.1.1.1 remote-as 1235
no auto-summary



Most importantly R3 (and R2) should show something like this for
Show ip bgp:

R3#sh ip bgp
BGP table version is 6, local router ID is 3.3.3.3
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
*> 3.3.3.3/32 0.0.0.0 0 32768 i
*> 4.4.4.4/32 10.1.1.4 0 0 4 i
*>i5.5.5.5/32 10.1.1.5 0 100 0 i
* 10.1.1.0/24 10.1.1.4 0 0 4 i
*> 0.0.0.0 0 32768 i
*>i16.0.0.0/6 10.1.1.1 0 100 0 i


R2 obviously wont show 4.4.4.4


Next week I think im going to do a multi area OSPF lab with redistribution...OoooOooo

Thursday, 4 June 2009

BGP Lab #2

Here is another lab:

Njoy :)

BGP Lab configs

Ok here are the import bits from the configs:

R1

router bgp 1
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
network 172.12.123.0 mask 255.255.255.0
neighbor 172.12.123.2 remote-as 234
neighbor 172.12.123.3 remote-as 234
no auto-summary


Show ip bgp

R1#sh ip bgp
BGP table version is 9, local router ID is 1.1.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
*> 1.1.1.1/32 0.0.0.0 0 32768 i
*> 2.2.2.2/32 172.12.123.2 201 0 234 i
*> 3.3.3.3/32 172.12.123.3 101 0 234 i
*> 4.4.4.4/32 172.12.123.3 101 0 234 i
* 172.12.123.2 201 0 234 i
* 172.12.123.0/24 172.12.123.3 101 0 234 i
* 172.12.123.2 201 0 234 i
*> 0.0.0.0 0 32768 i
*> 172.12.234.0/24 172.12.123.3 101 0 234 i
* 172.12.123.2 201 0 234 i



R2:

router bgp 234
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
network 2.2.2.2 mask 255.255.255.255
network 172.12.123.0 mask 255.255.255.0
network 172.12.234.0 mask 255.255.255.0
neighbor 172.12.123.1 remote-as 1
neighbor 172.12.123.1 route-map SET_MED out
neighbor 172.12.234.4 remote-as 234
neighbor 172.12.234.4 next-hop-self
neighbor 172.12.234.4 route-map SET_LOCAL_PREF out
no auto-summary


route maps

ip prefix-list ALL_ROUTES seq 5 permit 0.0.0.0/0 le 32
access-list 110 permit ip any any
!
route-map SET_LOCAL_PREF permit 10
match ip address prefix-list ALL_ROUTES
set local-preference 301
!
route-map SET_MED permit 10
match ip address 110
set metric 201


Show ip bgp:

R2#sh ip bgp
BGP table version is 6, local router ID is 2.2.2.2
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
*> 1.1.1.1/32 172.12.123.1 0 0 1 i
*> 2.2.2.2/32 0.0.0.0 0 32768 i
*>i4.4.4.4/32 172.12.234.4 0 100 0 i
* 172.12.123.0/24 172.12.123.1 0 0 1 i
*> 0.0.0.0 0 32768 i
* i172.12.234.0/24 172.12.234.4 0 100 0 i
*> 0.0.0.0 0 32768 i





R3:



router bgp 234
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
network 3.3.3.3 mask 255.255.255.255
network 172.12.123.0 mask 255.255.255.0
network 172.12.234.0 mask 255.255.255.0
neighbor 172.12.123.1 remote-as 1
neighbor 172.12.123.1 route-map SET_MED out
neighbor 172.12.234.4 remote-as 234
neighbor 172.12.234.4 next-hop-self
neighbor 172.12.234.4 route-map SET_LOCAL_PREF out
no auto-summary
!


Route maps


ip prefix-list ALL_ROUTES seq 5 permit 0.0.0.0/0 le 32
access-list 110 permit ip any any
!
route-map SET_LOCAL_PREF permit 10
match ip address prefix-list ALL_ROUTES
set local-preference 201
!
route-map test permit 10
!
route-map SET_MED permit 10
match ip address 110
set metric 101


Show ip bgp:

R3#sh ip bgp
BGP table version is 10, local router ID is 3.3.3.3
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
*> 1.1.1.1/32 172.12.123.1 0 0 1 i
*> 3.3.3.3/32 0.0.0.0 0 32768 i
*>i4.4.4.4/32 172.12.234.4 0 100 0 i
*> 172.12.123.0/24 0.0.0.0 0 32768 i
* 172.12.123.1 0 0 1 i
*> 172.12.234.0/24 0.0.0.0 0 32768 i
* i 172.12.234.4 0 100 0 i


R4:

router bgp 234
no synchronization
bgp router-id 4.4.4.4
bgp log-neighbor-changes
network 4.4.4.4 mask 255.255.255.255
network 172.12.234.0 mask 255.255.255.0
neighbor 172.12.234.2 remote-as 234
neighbor 172.12.234.3 remote-as 234
no auto-summary


Show ip bgp

FR-R4#sh ip bgp
BGP table version is 7, local router ID is 4.4.4.4
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
* i1.1.1.1/32 172.12.234.3 0 201 0 1 i
*>i 172.12.234.2 0 301 0 1 i
*>i2.2.2.2/32 172.12.234.2 0 301 0 i
*>i3.3.3.3/32 172.12.234.3 0 201 0 i
*> 4.4.4.4/32 0.0.0.0 0 32768 i
* i172.12.123.0/24 172.12.234.3 0 201 0 i
*>i 172.12.234.2 0 301 0 i
* i172.12.234.0/24 172.12.234.3 0 201 0 i
* i 172.12.234.2 0 301 0 i
*> 0.0.0.0 0 32768 i


If you want to full configs mail me :)

Wednesday, 3 June 2009

BGP Lab

Visio of a lab for practising route-maps and BGP:




Answers tomorrow !

Tuesday, 2 June 2009

Custom Queueing Notes

Ratio = Bandwidth % / Avg Packet Size

Normalized = Ratio/ Lowest Ratio

Byte count = Ratio * Avg Packet Size


E.g.
HTTP
B=50%
Avg.Packet=746
Ratio=0.067
N=2
Byte Count=1492

Using Rate-Limit for traffic shapping on cisco routers.

Hi again,

This post starts like a song "..I was working in the lab late one night" and I was playing around with cisco queueing and traffic shaping and whilst working on something for a client I worked out something that maybe be obvious for most but I have never really seen it in any forums/cisco documentation.

Anyway here is the visio of the scenario:
Here is how I did it.

1) Define the ACLs (These are used later for the Class-maps)
-Pings
access-list 110 permit icmp 10.10.0.0 0.0.0.255 any
-Voip
access-list 120 permit ip 10.10.0.0 0.0.0.255 host 192.168.0.5
-DNS
access-list 130 permit tcp 10.10.0.0 0.0.0.255 any eq domain
-Http
access-list 140 permit tcp 10.10.0.0 0.0.0.255 any eq www
-Bulk traffic
access-list 160 permit ip host 192.168.0.3 any

2) Define the class-maps:

class-map match-all VOIP
match access-group 110
match access-group 120
class-map match-all PING
match access-group 110
class-map match-all HTTP
match access-group 140
class-map match-all DNS
match access-group 130

3) Create 2 policy maps. This is because you can only really control outgoing bandwidth therefore you control WAN upstream on the WAN interface
But you control WAN downstream on the LAN interface.

*****************************************
policy-map WAN_OUT
class PING
bandwidth 1024
class VOIP
priority 1024
class DNS
bandwidth 1024
class HTTP
bandwidth 4096
class class-default
fair-queue

*****************************************
policy-map LAN_OUT
class PING
bandwidth 1024
class VOIP
priority 1024
class DNS
bandwidth 1024
class HTTP
bandwidth 4096
class class-default
fair-queue
*****************************************

Then I decided to cap all downstream traffic from 192.168.0.3 to about 256KB/s
This command make sure that when a user downloads a file it can never exceed this amount
(even when not congested)
interface FastEthernet0/1
..
rate-limit output access-group 160 2000000 1000000 1000000 conform-action continue exceed-action drop
..

Notice once again at this command is applied to the LAN interface on the output.


Once finished I used http://www.testyourvoip.com to test the quality whilst user 10.10.0.3 was downloading from the internet, grabing files over FTP & SMB from 192.168.0.3.

...and it worked! scored about 4.5 where as before shaping I had a score of about 3-ish


This isnt perfect, but it was just designed to show that you dont use the input queue on the wan interface to control your downloading you use the output queue on your lan interface.


Hope this helps some people out there.