Thursday, March 12, 2015

DMVPN NHRP in NBMA


Cho topo nhu hinh ve:
 network NBMA: 192.254.100.x/24
 network tun     : 155.1.0.x/24
R1,R2 Spoke.  R5 hub

Trên  R1, R2 tạo default route trỏ đến R5 sử dụng ip next-hop
Trên R5 tạo 2 đường static route trỏ lần lượt đến L0 của R1, R2 qua ipnexthop

R1#show run | se ip route
ip route 0.0.0.0 0.0.0.0 155.1.0.5

R2#show run | se ip route
ip route 0.0.0.0 0.0.0.0 155.1.0.5

R5#show run | se ip route
ip route 150.1.1.1 255.255.255.255 155.1.0.1
ip route 150.1.2.2 255.255.255.255 155.1.0.2

Thực hiện kiểm tra bảng NHRP trên R1 và R5 ta có:

R1#show ip nhrp
155.1.0.5/32 via 155.1.0.5
   Tunnel0 created 00:51:27, never expire
   Type: static, Flags: used
   NBMA address: 169.254.100.5
R5#show ip nhrp
155.1.0.1/32 via 155.1.0.1
   Tunnel0 created 00:00:48, expire 00:04:11
   Type: dynamic, Flags: unique registered used nhop
   NBMA address: 169.254.100.1
155.1.0.2/32 via 155.1.0.2
   Tunnel0 created 00:00:48, expire 00:04:12
   Type: dynamic, Flags: unique registered used nhop
   NBMA address: 169.254.100.2

Trên R1 ping 150.1.2.2 R2
R1#ping 150.1.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.1.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 6/9/15 ms

=> ping thành công 100%

Giải thích: (chú ý ping trong GRE yêu cầu phải có đầy đủ địa chỉ tunnel source and tunnel dest, bằng cách router sử dụng giao thức nhrp để tiềm kiếm trong NBMA)
khi ping 150.1.2.2, R1 tra trong bảng định tuyến với default- route trỏ qua R5 với next-hop 155.1.0.5 tương ứng với địa chỉ NBMA trong bảng nhrp là 169.254.100.5.quá trình đóng gói tin thành công,  gói tin sẽ được gửi sang R5. tương tự R5 cũng có static route đến 150.1.2.2 qua R2 với nexhop tương ứng với NBMA trong bảng nhrp: 169.254.100.2 -> gói tin đóng gói thành công.

Trên R5 thay đổi đường static route trỏ qua R2 bằng exit interface.

R5#show run | se ip route
ip route 150.1.1.1 255.255.255.255 155.1.0.1
ip route 150.1.2.2 255.255.255.255 Tunnel0


Từ R1 ping 150.1.2.2. và debug ip nhrp trên R5

R1#ping 150.1.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.1.2.2, timeout is 2 seconds:

%NHRP-3-PAKERROR: Received Error Indication from 155.1.0.5, code: protocol generic error(7), (trigger src: 155.1.0.1 (nbma: 169.254.100.1) dst: 150.1.2.2), offset: 0, data: 00 01 08 00 00 00 00 00 00 FF 00 58 D8 C0 00 34 ...
%NHRP-3-PAKERROR: Received Error Indication from 155.1.0.5, code: protocol generic error(7), (trigger src: 155.1.0.1 (nbma: 169.254.100.1) dst: 150.1.2.2), offset: 0, data: 00 01 08 00 00 00 00 00 00 FF 00 58 D8 C0 00 34

R5#debug ip nhrp
NHRP: nhrp_ifcache: Avl Root:A46837D0
NHRP: NHRP could not map 150.1.1.1 to NBMA, cache entry not found
NHRP: MACADDR: if_in null netid-in 0 if_out Tunnel0 netid-out 1
NHRP: Checking for delayed event NULL/150.1.1.1 on list (Tunnel0).
NHRP-MPLS:  tableid: 0 vrf:
NHRP: No delayed event node found.
NHRP: nhrp_ifcache: Avl Root:A46837D0
NHRP: No cache for forwarding(0)
NHRP-MPLS: AVL node found tableid: 0 vrf:
NHRP: swidb Tunnel0, nhrp_cache_update
NHRP-MPLS:  tableid: 0 vrf:
NHRP: nhrp_ifcache: Avl Root:A46837D0
NHRP: Enqueued NHRP Resolution Request for destination: 150.1.1.1
NHRP-MPLS:  tableid: 0 vrf:
IP: s=155.1.0.5 (local), d=150.1.1.1 (Tunnel0), len 100, encapsulation failed
    ICMP type=8, code=0
NHRP: Checking for delayed event NULL/150.1.1.1 on list (Tunnel0).
NHRP-MPLS:  tableid: 0 vrf:
NHRP: No delayed event node found.
NHRP: nhrp_ifcache: Avl Root:A46837D0
NHRP: nhrp_ifcache: Avl Root:A46837D0
NHRP: Sending NHRP Resolution Request for dest: 150.1.1.1 to nexthop: 150.1.1.1 using our src: 155.1.0.5
NHRP-MPLS:  tableid: 0 vrf:
NHRP: Attempting to send packet through interface Tunnel0 via DEST  dst 150.1.1.1
NHRP: Send Resolution Request via Tunnel0 vrf 0, packet size: 88
      src: 155.1.0.5, dst: 150.1.1.1
NHRP: nhrp_ifcache: Avl Root:A46837D0
NHRP: NHRP could not map 150.1.1.1 to NBMA, cache entry not found
NHRP: Encapsulation failed for destination 150.1.1.1 out Tunnel0.
Success rate is 0 percent (0/1)

Quá trình ping không thành công.

Giải thích: quá trình gói tin đi từ R1-R5 ok
Khi gói tin từ R5, thấy dest 150.1.2.2 nó tra trong bảng NHRP để tìm địa chỉ NBMA nhưng k thấy. Vì nó chính là HUB hay NHS nên k thể request nên quá trình ping fail.

Solution: sử dụng static trỏ qua ip next-hop , lúc đó R5 sẽ thấy trong bảng nhrp để đến địa chỉ 150.1.2.2 nó sẽ có địa chỉ NBMA
269.254.100.2
      hoặc sử dụng map static

#ip nhrp map 150.1.2.2 269.254.100.2

MPLS TE priority


    1. Priority
    Some tunnels are more inportance than others. For example, you might have tunnels carrying VoIP traffic and tunnels carrying data traffic that a competing for the sme resource. You might simple have spme data tunnels that are more importance than others.
    Each tunnel has a priority, and more-importance tunnels take precedence over less-important tunnels. Less-important tunnels are pushed out of the way and are made to recalculate a path, and their resource are given to the more important tunnel


    EX: tun0 and tun 1 cung di tren 1 duong R1-R2-R4

    " show mpls traffic-eng topology "

    Truong hop1: bandwidth tun0 = tun1 = 0

    Priority
    Bandwith
    config
    Total Allocated
    Global Pool Reservable
    Tun0 (priority 5 5)
    5
    0
    0
    50

    6
    0
    0
    50
    Tun1 (priority 7 7)
    7
    0
    0
    50

    Truong hop2: bandwidth tun1=30, bandwith tun0 = 0

    Priority
    Bandwith
    config
    Total Allocated
    Global Pool Reservable
    Tun0 (priority 5 5)
    5
    0
    0
    50

    6
    0
    0
    50
    Tun1 (priority 7 7)
    7
    30
    30
    20


    Truong hop3: bandwidth tun1=30 va bandwidth tun0 = 10
    Vi tun 0 pri 5, nen no se preemt bandwith pri 6 and 7.
    Truong hop 2: pri 7 co bandwidth con lai = 20, nhung pri 5 chiem 10 -> con lai 10
                               pri 6 co bandwidth con lai = 50 (chua dung), nhung pri5 chiem 10 -> con lai 40


    Priority
    Bandwith
    config
    Total Allocated
    Global Pool Reservable
    Tun0 (priority 5 5)
    5
    10
    10
    40

    6
    0
    0
    40
    Tun1 (priority 7 7)
    7
    30
    30
    10

    Truong hop4: bandwidth tun 1=30 , bandwidth tun0 = 40.
        pri 7 bandwidth = 30 con lai bandwidth 20  nhung bi Pri5 bandwith = 40,
        -> pri7 k du bandwidth ->  duong tun1 down de giai phong bang thong cung cap tun0


    Priority
    Bandwith
    config
    Total Allocated
    Global Pool Reservable
    Tun0 (priority 5 5)
    5
    40
    40
    10

    6
    0
    0
    10
    Tun1 (priority 7 7)
    7
    30
    0
    10

    Ketluan: 50k bandwith duoc su dung cho tat ca gia tri priority 0 -7
    Priority thap la tot nhat, co kha nang chiem giu bang thong cua prority cao hon. Priority =0 khong bi chiem giu


    1. Priority :  setup and holding priority

    Bw[5]
    40
    10

    Bw[6]
    0
    10

    Bw[7]
    0
    10





    Tunnel 0
    40
    priority
    7       6
    Tunnel 1
    30
    priority
    7       5

    Cho 2 tunnel:
    Tunnel 1: priority  7 6
    Tunnel 2: priority   6 5
    Gia su tunnel 1 up truoc. Khi tunnel 2 up, no se so sanh gia tri setup priority cua no voi gia tri hold priority cua tunnle 1 neu nho hon thi tunnel 2 len va tunnel 1 down.

ISIS backdoor


R1#show is da

IS-IS Level-1 Link State Database:
LSPID                 LSP Seq Num  LSP Checksum  LSP Holdtime      ATT/P/OL
R1.00-00            * 0x00000006   0x4C93          701                          0/0/0
R2.00-00              0x00000009   0xBAED        1186                        1/0/0
R2.01-00              0x00000002   0x9B0F        699                           0/0/0

Cau hinh sao cho R1 khong co default route tren bang dinh tuyen. Bang 2 cach. Cau hinh tren R1 or tren R2

  • Cau hinh R1:
router isis
 net 49.0012.0000.1111.0000.00
 is-type level-1
 ignore-attached-bit

Command tren bi an trong IOS.
R1# show ip route
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     2.0.0.0/24 is subnetted, 1 subnets
i L1    2.2.2.0 [115/20] via 10.1.12.2, FastEthernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.12.0 is directly connected, FastEthernet0/0
R1#show isis da

IS-IS Level-1 Link State Database:
LSPID                 LSP Seq Num  LSP Checksum  LSP Holdtime      ATT/P/OL
R1.00-00            * 0x00000006   0x4C93        520               0/0/0
R2.00-00              0x00000009   0xBAED        1006              1/0/0
R2.01-00              0x00000002   0x9B0F        518               0/0/0

=> R1 van nhan ATT = 1. tuy nhien tren bang dinh tuyen khong co default-route.


  • Cau hinh R2.
router isis
 net 49.0012.0000.2222.0000.00
 is-type level-1-2 backdoor

R1#show isis da

IS-IS Level-1 Link State Database:
LSPID                 LSP Seq Num  LSP Checksum  LSP Holdtime      ATT/P/OL
R1.00-00            * 0x00000007   0x4A94        1149              0/0/0
R2.00-00              0x0000000A   0xB0FE        1132               0/0/0
R2.01-00              0x00000003   0x9910        1020               0/0/0

=> R1 set gia tri ATT = 0.  khong nhan defaul-route.


  • Nhan xet:
    • Cach 1: muon filter default-route tren tung router
    • Cach 2: filtter default-route trong 1 area level 1

  • Tuy theo yeu cau, su dung cach phu hop :)

BGP DMZ Link BW

                          BGP DMZ Link BW
Topology :
 Cho topology : + R2 thiết lp neighbor R1 qua EBGP
                 +  R2 thiết lp neighbor R3 qua EBGP
Trên R1 và R3 to mng loopback L1 : 8.8.8.0/24 qung bá vào R2
  Trên R2 “ show ip bgp 8.8.8.0/24 “

 R2 hc mng 8.8.8.0/24 qua R1 bi vì R2 nhận update từ R1 sớm hơn so với R3 ( break step 10)
Let's configure BGP multipath to install both paths:
!
router bgp 2
 neighbor 10.1.12.1 remote-as 1
 neighbor 10.1.23.3 remote-as 3
 maximum-paths 2
Sau khi “maximum-paths 2 ” ta thấy bảng định tuyến chỉ có 1 tuyến đường tới mạng 8.8.8.0/24
***note :
Still we have only one path in the RIB. This is because even though all the attributes weight, local preference, AS path length, origin code, MED, and IGP distance are same, AS paths are not identical. There is a hidden IOS command to bypass this requirement.
R2(config)#router bgp 2
R2(config-router)#bgp bestpath as-path multipath-relax   // equal load balancing bwt same length but different AS Path
R2(config-router)#
Kết quả ta thấy :


Cu hình chnh share count :

Gi ta cấu hình  unequal cost load-sharing  với tỉ lệ 1:3  trên R2 để tới mạng 8.8.8.0/24
!
interface Serial0/0
 bandwidth 100
 ip address 10.1.12.2 255.255.255.0
!
interface Serial0/1
 bandwidth 300
 ip address 10.1.23.2 255.255.255.0
!
router bgp 2
 bgp bestpath as-path multipath-relax
 bgp dmzlink-bw
 neighbor 10.1.12.1 remote-as 1
 neighbor 10.1.12.1 dmzlink-bw
 neighbor 10.1.23.3 remote-as 3
 neighbor 10.1.23.3 dmzlink-bw
 maximum-paths 2
 !
 address-family nsap
  maximum-paths 2
 exit-address-family
!


BGP orf


Trong mô hình mạng thực tế, router PE sẽ adver một lượng lớn prexfix sang router CE. Để tiết kiệm băng thông giữa link router PE và CE . Vì không thể được truy cập vao router PE để cấu hình filter. BGP orf là feature rất hữu dụng để filter lượng route ở PE trước khi adver sang CE. Khi cấu hình router PE sẽ chấp nhận BGP orf khi ấy feature mới được enable.

R2 filter out network 2.2.2.0/24 being advertise R1. config in R1





R1:
router bgp 100
 network 1.1.1.0 mask 255.255.255.0
 neighbor 10.1.12.2 remote-as 100
 neighbor 10.1.12.2 capability orf prefix-list both
 neighbor 10.1.12.2 prefix-list ofr in
 no auto-summary
!
ip prefix-list ofr seq 5 deny 2.2.2.0/24
ip prefix-list ofr seq 10 permit 0.0.0.0/0 le 32

R2:
router bgp 100
 network 2.2.2.0 mask 255.255.255.0
 neighbor 10.1.12.1 remote-as 100
 neighbor 10.1.12.1 capability orf prefix-list both
 no auto-summary


ORF or outbound route filtering is the technique that allows a BGP peer to “push” a filter to the remote neighbor. The neighbor then applies the prefix filter to the outbound updates sent to the peer that pushed the filter. This feature is particularly helpful in situations when BGP peers exchange large amount of BGP information. Applying filtering outbound on the remote peer instead of inbound on the local peer significantly decreases the amount of routing information send across the link. There are two types of ORF filters defined in IETF’s draft – prefix-list based and community based. Cisco IOS supports only the prefix-list ORFs