Friday, 8 May 2020

BGP CHAPTER 16 - BGP - LOCAL PREFERENCE

In this post we will be focusing on an very important BGP Attribute -Local Preference.

  • Local Preference is an Well-Known Discretionary BGP Attribeute.
  • It is not local to the router but local to an AS .
  • It is exchanged with iBGP neighbor.
  • Local Preference set on an router in an AS is propagated to all the internal routers of that AS.
  • It is not exchanged with eBGP neighbor  
  • Used to manipulate the outbound traffic decision of an AS.
  • Higher Local Preference is preferred .
  • Default value is 100.
R1#sh ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0              unassigned      YES unset  administratively down down
Serial0                    12.0.0.1        YES manual up                    up
Serial1                    13.0.0.1        YES manual up                    up
Serial2                    unassigned      YES unset  administratively down down
Serial3                    unassigned      YES unset  administratively down down
R1#sh int des
Interface                      Status         Protocol Description
Fa0                            admin down     down
Se0                            up             up       connection to R2
Se1                            up             up       connection to R3
Se2                            admin down     down
Se3                            admin down     down
R1#sh ip bgp sum
BGP router identifier 13.0.0.1, local AS number 100
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.0.0.2        4   200      13      13        1    0    0 00:10:43        0
13.0.0.3        4   200      11      11        1    0    0 00:07:46        0

R2#sh int des
Interface                      Status         Protocol Description
Fa0                            admin down     down
Se0                            up             up       connection to R1
Se1                            up             up       connection to R4
Se2                            admin down     down
Se3                            admin down     down
R2#sh ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0              unassigned      YES unset  administratively down down
Serial0                    12.0.0.2        YES manual up                    up
Serial1                    24.0.0.2        YES manual up                    up
Serial2                    unassigned      YES unset  administratively down down
Serial3                    unassigned      YES unset  administratively down down
R2#sh ip bgp sum
BGP router identifier 24.0.0.2, local AS number 200
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.0.0.1        4   100      14      14        1    0    0 00:11:26        0
24.0.0.4        4   200      13      14        1    0    0 00:10:35        0

R3#sh ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0              unassigned      YES unset  administratively down down
Serial0                    34.0.0.3        YES manual up                    up
Serial1                    13.0.0.3        YES manual up                    up
Serial2                    unassigned      YES unset  administratively down down
Serial3                    unassigned      YES unset  administratively down down
R3#sh int des
Interface                      Status         Protocol Description
Fa0                            admin down     down
Se0                            up             up       connection to R4
Se1                            up             up       connection to R1
Se2                            admin down     down
Se3                            admin down     down
R3#sh ip bgp sum
BGP router identifier 34.0.0.3, local AS number 200
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
13.0.0.1        4   100      13      13        1    0    0 00:09:14        0
34.0.0.4        4   200      12      12        1    0    0 00:08:41        0

R4#sh ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0              unassigned      YES unset  administratively down down
Serial0                    34.0.0.4        YES manual up                    up
Serial1                    24.0.0.4        YES manual up                    up
Serial2                    unassigned      YES unset  administratively down down
Serial3                    unassigned      YES unset  administratively down down
R4#sh int des
Interface                      Status         Protocol Description
Fa0                            admin down     down
Se0                            up             up       connection to R3
Se1                            up             up       connection to R2
Se2                            admin down     down
Se3                            admin down     down
R4#sh ip bgp sum
BGP router identifier 34.0.0.4, local AS number 200
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
24.0.0.2        4   200      15      14        1    0    0 00:11:51        0
34.0.0.3        4   200      13      13        1    0    0 00:09:12        0

!!! Lets configure an LOOPBACK INTERFACE ON R1 AND ADVERTISE SAME IN BGP
R1(config)#int loopback 0
R1(config-if)#ip address 100.0.0.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#^Z

R1(config)#router bgp 100
R1(config-router)#network 100.0.0.0 mask 255.255.255.0
R1(config-router)#network 12.0.0.0 mask 255.255.255.0
R1(config-router)#network 13.0.0.0 mask 255.255.255.0
R1(config-router)#^Z

R2(config)#router bgp 200
R2(config-router)#network 12.0.0.0 mask 255.255.255.0
R2(config-router)#network 24.0.0.0 mask 255.255.255.0
R2(config-router)#^Z

R3(config)#router bgp 200
R3(config-router)#network 34.0.0.0 mask 255.255.255.0
R3(config-router)#network 13.0.0.0 mask 255.255.255.0
R3(config-router)#^Z

R4(config)#router bgp 200
R4(config-router)#network 34.0.0.0 mask 255.255.255.0
R4(config-router)#network 24.0.0.0 mask 255.255.255.0
R4(config-router)#^Z

Lets check on R4 what is path to reach 100.0.0.0/24 network .

R4#sh ip bgp
BGP table version is 11, local router ID is 34.0.0.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
* i12.0.0.0/24      34.0.0.3                 0    100      0 100 i
*>i                 24.0.0.2                 0    100      0 100 i
*>i13.0.0.0/24      24.0.0.2                 0    100      0 100 i
* i                 34.0.0.3                 0    100      0 100 i
*> 24.0.0.0/24      0.0.0.0                  0         32768 i
*> 34.0.0.0/24      0.0.0.0                  0         32768 i
* i100.0.0.0/24     34.0.0.3                 0    100      0 100 i
*>i                 24.0.0.2                 0    100      0 100 i


On R4 we can see that to reach 100.0.0.0/24 network there are 2 path 
having next hop 24.0.0.2 and 34.0.0.3 and both are reachable .

Path 1 - via 24.0.0.2 i.e via R2
Path 2 - via 34.0.0.2 i.e via R3

Path 1 is preferred here

R4#traceroute 100.0.0.1

Type escape sequence to abort.
Tracing the route to 100.0.0.1

  1 24.0.0.2 20 msec 40 msec 8 msec

  2 12.0.0.1 [AS 100] 64 msec 36 msec 44 msec


Now we will use LOCAL PREFERENCE and make Path 2 preferred path.
i.e we will be changing the outbound path for AS 200 to reach 100.0.0.0/24 which belongs to some different AS.

Here we can check the local preference both paths is 100

R3(config)#route-map TECHSTUFF
R3(config-route-map)#set local-preference 200
R3(config-route-map)#^Z

R3#sh route-map TECHSTUFF
route-map TECHSTUFF, permit, sequence 10
  Match clauses:
  Set clauses:
    local-preference 200
  Policy routing matches: 0 packets, 0 bytes
R3(config)#router bgp 200
R3(config-router)#neighbor 13.0.0.1 route-map TECHSTUFF in
R3(config-router)#^Z
R3#
R3#clear ip bgp * soft in
R3#clear ip bgp * soft out

R4#sh ip bgp
BGP table version is 8, local router ID is 34.0.0.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
*>i12.0.0.0/24      34.0.0.3                 0    200      0 100 i
* i                 24.0.0.2                 0    100      0 100 i
* i13.0.0.0/24      24.0.0.2                 0    100      0 100 i
*>i                 34.0.0.3                 0    200      0 100 i
*> 24.0.0.0/24      0.0.0.0                  0         32768 i
*> 34.0.0.0/24      0.0.0.0                  0         32768 i
*>i100.0.0.0/24     34.0.0.3                 0    200      0 100 i
* i                 24.0.0.2                 0    100      0 100 i


R4#traceroute 100.0.0.1

Type escape sequence to abort.
Tracing the route to 100.0.0.1

  1 34.0.0.3 36 msec 36 msec 20 msec
  2 13.0.0.1 64 msec 60 msec 68 msec


Now we can check that the Path 2 is selected .

This is how we can use Local Preference for manipulating outbounding traffic of an AS .

Hope you all find the post useful !!!!!!


Thanks for reading 

Thursday, 7 May 2020

BGP CHAPTER 14 - Understanding BGP Attributes


In all our previous post we have seen Concept and Configuration of BGP neighborship , Advertisement of networks in BGP , BGP Synchronization rule , Auto Summary etc.

From this post onwards we will start focusing on BGP Attributes and understand what exactly role does BGP Attributes play in BGP .

As we are aware that each routing protocol uses some metric for path selection 
e.g. RIP uses Hop count , EIGPR uses a composite metric which includes Bandwidth and Delay (by default) , OSPF uses Cost i.e Bandwith to calculate the best route. 

Similarly BGP also uses something known as "Attributes" to the find the best route to reach a destination.

It is very important to have good understanding of BGP Attributes before understanding BGP Path Selection Process.



There are 4 categories of BGP Attributes :-

1) Well Known Mandatory -  
  • Supported (Known/Understand) by all BGP Routers
  • Must be present in BGP Update Message.
  • AS Path, Origin ,Next Hop.

2) Well Known Discretionary - 
  • Supported (Known/Understand) by all BGP Routers.
  • May or May not be present in BGP Update Message.
  • Local Preference

3) Optional Transitive -
  • May or May not be supported  a BGP Routers.
  • Passed on the other BGP Routers.
  • Aggregator , Community.
4) Optional Non-Transitive-
  • May or May not be supported by a BGP Routers.
  • If not supported may ignore the update and may not pass on to the other BGP Routers.
  • MED ,Router Cluster list , Router Originator List.

Hope you all like this post !!!

Thanks for Reading 

Wednesday, 6 May 2020

Switching Tshoot Ticket - 2


PC AND LAPTOP BOTH ARE IN THE SAME VLAN 10 (10.1.1.0/24)
WHEREAS SERVER IS IN THE ANOTHER VLAN 20 (10.1.2.0/24)

SW1 is a Layer 3 Switch

SW2 , SW3 AND SW4 are Layer 2 Switches

Issue :-

=================

Not able to ping Server from PC 






From PC we are not able to ping server


C:\>ping 10.1.2.2

Pinging 10.1.2.2 with 32 bytes of data:

Reply from 10.1.1.1: Destination host unreachable.
Reply from 10.1.1.1: Destination host unreachable.
Reply from 10.1.1.1: Destination host unreachable.
Request timed out.

Ping statistics for 10.1.2.2:

Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

But able to ping the Gateway i.e SW1

C:\>ping 10.1.1.1

Pinging 10.1.1.1 with 32 bytes of data:

Reply from 10.1.1.1: bytes=32 time=1ms TTL=255
Reply from 10.1.1.1: bytes=32 time<1ms TTL=255
Reply from 10.1.1.1: bytes=32 time<1ms TTL=255
Reply from 10.1.1.1: bytes=32 time<1ms TTL=255

Ping statistics for 10.1.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms


Let's check on the Gateway

SW1#ping 10.1.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/1/3 ms

SW1#ping 10.1.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.2, timeout is 2 seconds:
.....

Success rate is 0 percent (0/5)

Able to PC but not server

Lets check the SVI status for vlan 20

SW1#sh int vlan 20
Vlan20 is down, line protocol is down
Hardware is CPU Interface, address is 00d0.ba25.3302 (bia 00d0.ba25.3302)
Internet address is 10.1.2.1/24
MTU 1500 bytes, BW 100000 Kbit, DLY 1000000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
ARP type: ARPA, ARP Timeout 04:00:00
Last input 21:40:21, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
1682 packets input, 530955 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicast)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
563859 packets output, 0 bytes, 0 underruns
0 output errors, 23 interface resets

0 output buffer failures, 0 output buffers swapped out


VLAN 20 IS DOWN

SW1#sh vlan brief

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/4, Fa0/5, Fa0/6, Fa0/7
Fa0/8, Fa0/9, Fa0/10, Fa0/11
Fa0/12, Fa0/13, Fa0/14, Fa0/15
Fa0/16, Fa0/17, Fa0/18, Fa0/19
Fa0/20, Fa0/21, Fa0/22, Fa0/23
Fa0/24, Gig0/1, Gig0/2
10 VLAN0010 active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active

SW1#


You can see L2 VLAN 20 IS NOT CREATED

Lets create it

SW1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#
SW1(config)#vlan 20
SW1(config-vlan)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up

SW1(config-vlan)#^Z
SW1#
%SYS-5-CONFIG_I: Configured from console by console
sh int vlan 20
Vlan20 is up, line protocol is up
Hardware is CPU Interface, address is 00d0.ba25.3302 (bia 00d0.ba25.3302)
Internet address is 10.1.2.1/24
MTU 1500 bytes, BW 100000 Kbit, DLY 1000000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
ARP type: ARPA, ARP Timeout 04:00:00
Last input 21:40:21, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
1682 packets input, 530955 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicast)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
563859 packets output, 0 bytes, 0 underruns
0 output errors, 23 interface resets
0 output buffer failures, 0 output buffers swapped out


SW1#


!!!!! Now we can see that Vlan 20 is UP

SW1#ping 10.1.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/2/8 ms


SW1#

Able to ping from SW1

Lets check from PC

C:\>ping 10.1.2.2

Pinging 10.1.2.2 with 32 bytes of data:

Reply from 10.1.2.2: bytes=32 time=13ms TTL=127
Reply from 10.1.2.2: bytes=32 time<1ms TTL=127
Reply from 10.1.2.2: bytes=32 time<1ms TTL=127
Reply from 10.1.2.2: bytes=32 time<1ms TTL=127

Ping statistics for 10.1.2.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 13ms, Average = 3ms


Able to ping

Issue resolved


Thanks for Reading !!!!

Tuesday, 5 May 2020

BGP CHAPTER 13 - Next Hop Self in BGP

Today in this post we will focus on a BGP  "Next Hop Self "

Lets try to understand with help of the below Lab 


In this LAB R1 AND R2 belongs to AS 100 , R3 belongs to AS 200

There is already iBGP  Configuration between R1 & R2 ,eBGP between Configuration between R1 & R2 

!! Checks for Interfaces and IP address assigned 

R1#sh int des
Interface                      Status         Protocol Description
Fa0                            up             up       Connection to R2
Se0                            up             up       Connection to R3

R1#sh ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0              121.1.1        YES manual up                    up
Serial0                    13.1.1.1        YES manual up                    up

R2#sh int des
Interface                      Status         Protocol Description
Fa0                            up             up       Connection to R1

R2#sh ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0              12.1.1.2      YES manual up                    up


R3#sh int des
Interface                      Status         Protocol Description
Se0                            up             up       Connection to R3

R3#sh ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0              unassigned      YES unset  administratively down down
Serial0                    13.1.1.3        YES manual up                    up

!! Checks for BGP Neighborship

R1#sh ip bgp summary
BGP router identifier 13.1.1.1, local AS number 100
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.1.1.2        4   100       8       8        1    0    0 00:05:18        0
13.1.1.3        4   200       7       7        1    0    0 00:03:51        0

R2#sh ip bgp summary
BGP router identifier 12.1.1.1, local AS number 100
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.1.1.1        4   100       8       8        1    0    0 00:05:49        0

R3#sh ip bgp summ
BGP router identifier 13.1.1.3, local AS number 200
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
13.1.1.1        4   100       8       8        1    0    0 00:04:57        0

Next Hop Behaviour In BGP

  • When a BGP router sends an update (route) to its eBGP neighbor its next-hop will be itself.
  • When a BGP router sends an update (route) to its iBGP neighbor its next-hop will not change.
Now lets configure an loopback interface on R3 and advertise it to its eBGP Neighbor R1 and check the Next Hop Behavior.

R3(config)#int loopback 0

R3(config-if)#ip address 100.0.0.1 255.255.255.0
R3(config-if)#^Z


R3(config)#router bgp 200

R3(config-router)#network 100.0.0.0 mask 255.255.255.0
R3(config-router)#^Z

R1#sh ip bgp
BGP table version is 2, local router ID is 13.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
*> 100.0.0.0/24     13.1.1.3                 0             0 200 i

R2#sh ip bgp
BGP table version is 1, local router ID is 12.1.1.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
* i100.0.0.0/24     13.1.1.3                 0    100      0 200 i

R2#ping 100.0.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.0.0.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

From R2 100.0.0.1 is not pingable because for it next hop to reach it is 13.1.1.3 for which it dont have route .

Solution on it to -
  • Add static route for 100.0.0.1/24 on R2 and reverse route on R3.
  • Advertise the LAN WAN links network in BGP.
  • Configure Next hop self on R1 and reverse route on R3.
Lets add static router for 100.0.0.1/24 on R2 and reverse route on R3.

R2(config)#ip route 100.0.0.0 255.255.255.0 12.1.1.1
R2(config)#^Z

R3(config)#ip route 12.1.1.0 255.255.255.0 13.1.1.1
R3(config)#^Z

R2#ping 100.0.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/29/40 ms

Lets remove the static route and advertise WAN links in BGP .
R2(config)#no ip route 100.0.0.0 255.255.255.0 12.1.1.1
R2(config)#

R3(config)#no ip route 12.1.1.0 255.255.255.0 13.1.1.1
R3(config)#^Z

R1(config)#router bgp 100
R1(config-router)#network 12.1.1.0 mask 255.255.255.0
R1(config-router)#network 13.1.1.0 mask 255.255.255.0
R1(config-router)#^Z

R2(config)#router bgp 100
R2(config-router)#network 12.1.1.0 mask 255.255.255.0
R2(config-router)#^Z
R2#

R3(config)#router bgp 200
R3(config-router)#network 13.1.1.0 mask 255.255.255.0
R3(config-router)#^Z
R3#

!! Checking BGP table on R2

R2#sh ip bgp
BGP table version is 11, local router ID is 12.1.1.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
* i12.1.1.0/24      12.1.1.1                 0    100      0 i
*>                  0.0.0.0                  0         32768 i
*>i13.1.1.0/24      12.1.1.1                 0    100      0 i
*>i100.0.0.0/24     13.1.1.3                 0    100      0 200 i
R2#

R2#ping 100.0.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/21/36 ms

Lets remove the network advertisment of 13.1.1.1/24 network on R1 and R3.

R3(config)#router bgp 200
R3(config-router)#no network 13.1.1.0 mask 255.255.255.0
R3(config-router)#^Z

R1(config)#router bgp 100
R1(config-router)#no network 13.1.1.0 mask 255.255.255.0
R1(config-router)#^Z

Now we wont be able to reach 100.0.0.1 from R2

R2#ping 100.0.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.0.0.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)


R1(config)#router bgp 100
R1(config-router)#neighbor 12.1.1.2 next-hop-self  
R1(config-router)#^Z

R2#sh ip bgp
BGP table version is 15, local router ID is 12.1.1.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
* i12.1.1.0/24      12.1.1.1                 0    100      0 i
*>                  0.0.0.0                  0         32768 i
*>i100.0.0.0/24     12.1.1.1                 0    100      0 200 i
R2#


R2#ping 100.0.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/25/44 ms

Hope you all like this post 

Thanks for reading !!!

Monday, 4 May 2020

BGP CHAPTER 12 - BGP SYNCHRONIZATION RULE


Today we will discuss regarding BGP Synchronization Rule which states-

"Don't use or advertise the route/s learned via an iBGP neighbor to an eBGP neighbor unless & until the same is/are learned via some other IGP like RIP , OSPF ,EIGRP etc . "


This feature is off by default in Cisco IOS Software release 12.2(8)T and later.

To disable BGP Synchronization 

R1(config)#router bgp 100                    -------> AS is 100
R1(config-router)#no synchronization 

To enable BGP Synchronization 

R1(config-router)#synchronization



Lets check the interfaces of all the Routers

R1#sh int des
Interface                      Status         Protocol Description
Fa0                            up             up       ***CONNECTION_TO_R2***
Se0                            up             up       ***CONNECTION_TO_R3***

R1#sh ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0              12.1.1.1        YES manual up                    up
Serial0                    13.1.1.1        YES manual up                    up

R2#sh int des
Interface                      Status         Protocol Description
Fa0                            up             up       ***CONNECTION_TO_R1***
Lo0                            up             up

R2#sh ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0              12.1.1.2        YES manual up                    up
Loopback0                  100.0.0.1       YES manual up                    up

R3#sh int des
Interface                      Status         Protocol Description
Se0                            up             up       ***CONNECTION_TO_R1***

R3#sh ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
Serial0                    13.1.1.3        YES manual up                    up

Lets configure BGP on all Routers by keeping synchronization off .

R1(config)#router bgp 100
R1(config-router)#neighbor 12.1.1.2 remote-as 100
R1(config-router)#neighbor 13.1.1.3 remote-as 200
R1(config-router)#no synchronization

R2(config)#router bgp 100
R2(config-router)#neighbor 12.1.1.1 remote-as 100
R2(config-router)#no synchronization

R3(config)#router bgp 200
R3(config-router)#neighbor 13.1.1.1 remote-as 100

Lets advertise 100.0.0.0/24 network on R2 which is iBGP neighbor of R1

R2(config)#router bgp 100
R2(config-router)#network 100.0.0.0 mask 255.255.255.0

Since BGP Synchronization is off on R1 , R1 is using the route i.e installed in its routing and also advertising to R3 which is its eBGP neighbor 

R1#sh ip bgp
BGP table version is 2, local router ID is 13.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
*>i100.0.0.0/24     12.1.1.2                 0    100      0 i


R1#sh ip route
Codes: C - connected, S - static, 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
       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 not set

     100.0.0.0/24 is subnetted, 1 subnets
B       100.0.0.0 [200/0] via 12.1.1.2, 00:39:07
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, FastEthernet0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.1.1.0 is directly connected, Serial0


R3#sh ip route
Codes: C - connected, S - static, 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
       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 not set

     100.0.0.0/24 is subnetted, 1 subnets
B       100.0.0.0 [20/0] via 13.1.1.1, 00:38:31
     13.0.0.0/24 is subnetted, 1 subnets
C       13.1.1.0 is directly connected, Serial0


Now lets ON the Synchronization on R1 !!!!!

R1(config)#router bgp 100
R1(config-router)#synchronization

and check the routing table 

R1#sh ip route
Codes: C - connected, S - static, 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
       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 not set

     100.0.0.0/24 is subnetted, 1 subnets
B       100.0.0.0 [200/0] via 12.1.1.2, 00:41:03
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, FastEthernet0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.1.1.0 is directly connected, Serial0


Still we are able to view the route .

Lets clear the bgp neighborship once 

R1#clear ip bgp *
R1#
R1#
Apr  2 15:54:13.055: %BGP-5-ADJCHANGE: neighbor 12.1.1.2 Down User reset
Apr  2 15:54:13.059: %BGP-5-ADJCHANGE: neighbor 13.1.1.3 Down User reset
Apr  2 15:54:13.839: %BGP-5-ADJCHANGE: neighbor 12.1.1.2 Up
R1#
Apr  2 15:54:14.195: %BGP-5-ADJCHANGE: neighbor 13.1.1.3 Up

!! Now you can see the route is present in bgp table but not in routing table 

R1#sh ip bgp
BGP table version is 2, local router ID is 13.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
* i100.0.0.0/24     12.1.1.2                 0    100      0 i


R1#sh ip route
Codes: C - connected, S - static, 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
       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 not set

     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, FastEthernet0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.1.1.0 is directly connected, Serial0


Lets check the routing table of R3 as well 
R3#sh ip route
Codes: C - connected, S - static, 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
       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 not set

     13.0.0.0/24 is subnetted, 1 subnets
C       13.1.1.0 is directly connected, Serial0

You can see the 100.0.0.0/24 route is not present in the routing table.


Hope you all find the blog useful !!!!

Thanks for reading !!!!

Sunday, 3 May 2020

BGP CHAPTER 11 - Autosummary in BGP

Today in this post we will study regarding autosummary in BGP .

Let's begin -

  • In chapter no.5-Understanding Network Advertisement in BGP  we have seen how to advertise networks in BGP .
  • BGP refer its routing table to install route in BGP and whenever we want to advertise network in BGP we need to mention exact network and subnet mask (by using keyword mask)that we want to advertise .
  • For example . if we need to advertise an network 100.0.0.0/24 we would advertise it using following cmds
  • R1(config-router)#network 100.0.0.0 mask 255.255.255.0
  • With autosummary enable in BGP , there is a small change how network command works.
  • When BGP Autosummary is enabled we can advertise a classful network and we dont need to mention the subnet mask.
  • Autosummary is not enabled by default.


Lets configure Interfaces for R1 and R2

R1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#
R1(config)#int s0
R1(config-if)#ip add 12.1.1.1 255.255.255.0
R1(config-if)#descr **CONNECTION TO R2**
R1(config-if)#no shut
R1(config-if)#^Z
R1#

R2#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int s0
R2(config-if)#ip add 12.1.1.2 255.255.255.0
R2(config-if)#descr **CONNECTION TO R1**
R2(config-if)#no shut
R2(config-if)#^Z

Lets ping and test

R1#ping 12.1.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/14/52 ms

Configuring BGP Neighborship

R1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#router bgp 100
R1(config-router)#neig
R1(config-router)#neighbor 12.1.1.2 remote-as 200
R1(config-router)#^Z
R1#
R1#
Apr 12 09:03:22.519: %SYS-5-CONFIG_I: Configured from console by console

R2#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#router bgp 200
R2(config-router)#neighbor 12.1.1.1 remote-as 100
R2(config-router)#^Z
R2#


R1#sh ip bgp sum
BGP router identifier 12.1.1.1, local AS number 100
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.1.1.2        4   200       2       2        0    0    0 00:00:15        0
R1#

R2#sh ip bgp sum
BGP router identifier 12.1.1.2, local AS number 200
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.1.1.1        4   100       2       2        0    0    0 00:00:27        0


R1(config)#int loopback 0
R1(config-if)#ip add
Apr 12 09:05:09.307: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R1(config-if)#ip add 100.0.0.1 255.255.255.0
R1(config-if)#^Z
R1#

R1(config)#router bgp 100
R1(config-router)#network 100.0.0.0 mask 255.255.255.0
R1(config-router)#^Z
R1#

R1#sh ip bgp
BGP table version is 2, local router ID is 12.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
*> 100.0.0.0/24     0.0.0.0                  0         32768 i

R2#sh ip bgp
BGP table version is 2, local router ID is 12.1.1.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
*> 100.0.0.0/24     12.1.1.1                 0             0 100 i
R2#

R2#ping 100.0.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/35/40 ms

R1(config)#router bgp 100
R1(config-router)#no network 100.0.0.0 mask 255.255.255.0
R1(config-router)#auto-summary
R1(config-router)#network 100.0.0.0
R1(config-router)#^Z

R1#sh ip bgp
BGP table version is 4, local router ID is 12.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
*> 100.0.0.0        0.0.0.0                  0         32768 i

R2#sh ip route
Codes: C - connected, S - static, 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
       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 not set

B    100.0.0.0/8 [20/0] via 12.1.1.1, 00:01:35
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial0

R2#sh ip bgp
BGP table version is 4, local router ID is 12.1.1.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
*> 100.0.0.0        12.1.1.1                 0             0 100 i
R2#

R2#ping 100.0.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/36/52 ms
R2#

Thanks for reading the post !!

Saturday, 2 May 2020

BGP CHAPTER 10- BGP NEIGHBOR STATES


In this blog we will be focusing on BGP Chapter 10 - BGP Neighbor States a.k.a FSM i.e Finite State Machine.

I would recommend to go through previous chapter BGP Messages to get better understanding of this chapter .

So lets  Start  by know few points regarding BGP Neighborship 

  • BGP uses TCP PORT 179 to form Neighbor Adjacency.
  • In BGP Manually configuration of neighbor is required since BGP does not use Mulitcast or Broadcast to discover Neighbors.
Idle :

The BGP process is either administratively down or awaiting the next retry attempt.

Connect :

The BGP process is waiting for the TCP connection to be completed.

Active :

The TCP connection failed , Connect - Retry timer running , listening for incoming
TCP connection.

Opensent :

The TCP connection exists and a BGP Open message has been sent
to the peer , but the matching Open message has not yet been received from the
other router.

Openconfirm :

An Open message has been both sent to and received from the other router.

Established :

All neighbor parameters match , the neighbor relationship works and the
peers can now exchange.

Friday, 1 May 2020

BGP CHAPTER 9 - BGP MESSAGES

Its is very important to have good understand of BGP Messages before Understanding BGP Neighborship Negotation and States (FSM).



BGP Message Type -

BGP Speaker (Router) uses below 4 messages to communicate , to form Neighborship and to exchange routing information with other BGP Speaker.

1)Open
2)Update 
3)Keepalive 
4)Notification

1)OPEN MESSAGE:-
======================

  • As we are aware that BGP Uses TCP Port 179 and Before forming BGP Neighborship an TCP connection must be established.
  • When TCP connection is established between two BGP Speakers an OPEN message is sent by BGP Speakers to each other.
  • This OPEN message contains many parameters which plays an very important role while forming BGP Neighborship.   These parameters are -
a)Version
b)ASN
c)Hold Timer
d)BGP Identifer
e)Many Optional Parameters.

a)Version - 

  • Must Match Between 2 BGP Speakers.
  • Currently Version 4 is by default BGP Version.
  • Incase the version doesnot match its gets negotiated to the lower value .For eg- If a BGP Speaker have BGP Version as 4 and another BGP Speaker have BGP Version 3 then the version will negotiated to Version 3.

b)Autonomous Sytem Number (ASN) -
  • Determine BGP Neighborship is eBGP or iBGP.

c) Hold Timer -

  • Hold Time is number of seconds the BGP Speaker allow between Receipt of Keepalive and/or Update Message .
  • Within Hold time if no Message is received ; neighbor is considered as "DEAD".
  • Must Match Between 2 BGP Speakers.
  • Incase its differs , lower value will be selected .
  • HOLD TIME = 3 X KEEPALIVE TIME.
  • By default Hold Time is 180 Seconds.


d)BGP Identifer -

Its Highest Loopback address configured on the BGP Router(Speaker) and in absence of Loopback interface it will be the Highest IP address of an active Physical Interface on the BGP Router(Speaker)

2) UPDATE MESSAGE :-
============================


  • This message contains the actual route updates
  • It compose of below information-

a) NLRI -Network Layer Reachability Information-BGP Prefix Information - Prefixes which the BGP Speaker is advertising.
b) It includes Withdrawn Route Length , Withdrawn Route (incase when any route is removed)
c) Path Attributes - ORIGIN , AS PATH , NEXT HOP , MULTI_EXIT_DISC(MED)


3)KEEPALIVE MESSAGE:-
=============================
  • Once the BGP Neighorship is up and running ,these Keepalive messages are send continuously between BGP Speaker in a specific interval which is known as Keepalive Interval or Keepalive Time.
  • Keepalive messages are send between BGP Speakers to verify whether peering BGP Neighbor is live or not .
  • By default Keepalive Time is 60 Seconds. 


4)NOTIFICATION MESSAGE :-
==============================
  • Notification Messages  provides Notifications regarding BAD Messages / Error Messages
  • These messages appears in case of misconfiguration or when BGP Peer goes down .

Hope you all find this information useful

Thanks for reading !!!