Advanced CCIE Routing & Switching: Narbik Kocharians CCSI, CCIE #12410 R&S, Security, SP
Advanced CCIE Routing & Switching: Narbik Kocharians CCSI, CCIE #12410 R&S, Security, SP
Advanced CCIE Routing & Switching: Narbik Kocharians CCSI, CCIE #12410 R&S, Security, SP
Narbik Kocharians
CCSI, CCIE #12410
R&S, Security, SP
BGP
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 1 of 13
© 2015 Narbik Kocharians. All rights reserved
Lab 44 – Establishing a BGP session using the
correct TTL Value
Lo0 Lo0
1.1.1.1/32 2.2.2.2/24
.1 12.1.1.0/24
.2
R1 R2
On R1:
R1(config)#int s1/2
R1(config-if)#ip addr 12.1.1.1 255.255.255.0
R1(config-if)#no shu
R1(config)#int lo0
R1(config-if)#ip addr 1.1.1.1 255.255.255.255
You can use an IGP of your choice to provide reachability to the loopback interfaces, in this case we will
use OSPF:
R1(config)#router ospf 1
R1(config-router)#netw 0.0.0.0 0.0.0.0 area 0
On R2:
R2(config)#int s1/1
R2(config-if)#ip addr 12.1.1.2 255.255.255.0
R2(config-if)#no shu
R2(config)#int lo0
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 2 of 13
© 2015 Narbik Kocharians. All rights reserved
R2(config-if)#ip addr 2.2.2.2 255.255.255.255
R2(config)#router ospf 1
R2(config-router)#netw 0.0.0.0 0.0.0.0 area 0
On R1:
R1#sh ip rou ospf | b Gate
Gateway of last resort is not set
On R2:
R2#sh ip rou ospf | b Gate
Gateway of last resort is not set
Let’s establish an EBGP session using the loopback0 interfaces. R1 should be configured in AS 100, and R2
in AS 200:
On R1:
R1(config)#router bgp 100
R1(config-router)#neigh 2.2.2.2 remot 200
R1(config-router)#neigh 2.2.2.2 update-source lo0
On R2:
R2(config)#router bgp 200
R2(config-router)#neigh 1.1.1.1 remot 100
R2(config-router)#neigh 1.1.1.1 update-source lo0
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 3 of 13
© 2015 Narbik Kocharians. All rights reserved
What should the hop count be set to?
Between the two routers the hop count should be set to 1, it is obvious that we don’t have another
router between R1 and R2, so why is it that BGP session between the two routers is not established?
When two BGP routers are forming a BGP session, they consult their routing table to ensure that the
neighbor’s configured IP address is in the routing table as directly connected.
This is the sanity check just like RIP. In RIP we can always disable this sanity check using the “No validate-
update-source”, can we disable the sanity check in BGP?
Yes, we can instruct BGP to disable this check using the “Neighbor disable-connected-check”. Let’s test
this:
On R1:
R1(config)#router bgp 100
R1(config-router)#neigh 2.2.2.2 disable-connected-check
On R2:
R2(config)#router bgp 200
R2(config-router)#neigh 1.1.1.1 disable-connected-check
You should see the following console message stating that the two routers have formed an EBGP session.
On R1:
R1#sh ip bgp neighbors 2.2.2.2 | i TTL
Perfect!
Can we establish this session using the “Neighbor ebgp-multihop” command? Let’s configure and verify:
Let’s remove the “Neighbor disable-connected-check” command and replace it with “Neighbor ebgp-
multihop” command:
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 4 of 13
© 2015 Narbik Kocharians. All rights reserved
R1(config)#router bgp 100
R1(config-router)#no neighbor 2.2.2.2 disable-connected-check
On R2:
R2(config)#router bgp 200
R2(config-router)#no neighbor 1.1.1.1 disable-connected-check
R2#cle ip bgp *
On R1:
R1(config)#router bgp 100
R1(config-router)#neigh 2.2.2.2 ebgp-multihop 2
The reason this worked is NOT because the TTL should be set to two going from one loopback to the
other, we have tested that already in the previous example. The reason this worked is because we are
telling BGP that the neighbor is more than one hop away so don’t check your routing table because the
neighbor’s configured IP address is not going to be directly connected. Basically lying to BGP so it does
not perform the sanity check.
Can we establish an EBGP session using another method without using the previously used two
commands?
Yes, let configure and verify:
Let’s remove the “Neighbor ebgp-multihop” command and replace it with “Neighbor ttl-security hops”
command and verify:
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 5 of 13
© 2015 Narbik Kocharians. All rights reserved
R1(config)#router bgp 100
R1(config-router)#no neigh 2.2.2.2 ebgp-multihop 2
R1#cle ip bgp *
On R2:
R2(config)#router bgp 200
R2(config-router)#no neigh 1.1.1.1 ebgp-multihop
We can see that neighbor adjacency between these two routers is down. Let’s configure the “Neighbor
ttl-security hops” command and verify:
On R1:
R1(config)#router bgp 100
R1(config-router)#neighbor 2.2.2.2 ttl-security hops 2
Connection is ECN Disabled, Mininum incoming TTL 253, Outgoing TTL 255
With the “Neighbor ttl-security hops” command we are telling BGP to send the packets out with a TTL of
255, and accept a packet with TTL of 253 or higher. This means that the TTL should be 253…254 meaning
that the neighbor is two hops away.
Remember when we send a packet, it goes out with a TTL of 255 and the TTL decrements as it traverses
the routers. How did we get 253 or higher? Subtract 2 from 255, two is the configured TTL value.
Since we told BGP to accept a packet with a TTL of 2 it no longer consults the local routing table for the
neighbor’s configured IP address to be directly connected.
NOTE: If the “Neighbor ttl-security hops” command is set to 1, BGP will perform a sanity check and they
will fail to establish a BGP peer session.
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 6 of 13
© 2015 Narbik Kocharians. All rights reserved
Neighbor ebgp-multihop – Sets the TTL of the packet to the configured value, if the value is omitted, it
will auto-set the value to 255. This is the IP TTL, there is no TTL field in any BGP packets, and it is wrong
to say EBGP packets have a TTL of 1. The correct statement is the IP TTL and NOT BGP TTL.
Neighbor disable-connected-check – Sets the IP TTL to 1. We use this command to tell BGP NOT to
consult its routing table to see if the neighbor’s configured IP address is directly connected, this
command disables BGP’s sanity check.
Neighbor ttl-security hops – The IP TTL configured in this command is the result of subtracting the
configured value from 255. If the value is set to 5, the outgoing TTL will always be set to 255 but you will
accept the incoming packets with a TTL of 250 (255-5) or higher, in this case we are claiming that the
neighbor is 5 hops away.
Another use of this command is to tell BGP not to consult its routing table to see if the neighbor’s
configured IP address is directly connected.
Is it possible to establish an EBGP session based on the loopback interfaces without using any of the
three commands?
On R2:
On R1:
R1(config)#router bgp 100
R1(config-router)#no neighbor 2.2.2.2 ttl-security hops 2
R1#cle ip bgp *
R1#
To accomplish this task in a creative way, we will use the IP unnumber command and change the
encapsulation of this link to PPP. To see the existing BGP’s configuration:
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 7 of 13
© 2015 Narbik Kocharians. All rights reserved
R1#sh run | s router bgp
R1(config)#int s1/2
R1(config-if)#ip unnumbered lo0
R1(config-if)#encap ppp
On R2:
R2#sh run | s router bgp
R2(config)#int s1/1
R2(config-if)#ip unnumbered lo0
R2(config-if)#encap ppp
The big question is why and how did BGP form a BGP session?
When we configured “IP unnumbered lo0” it set the IP address of R1’s serial 1/2 interface to 1.1.1.1, let’s
verify:
R1#sh ip int br | ex un
Then the PPP encapsulation is configured. In IPv4 when we encapsulate with a link with PPP, peer’s
neighbor route is injected into our routing table. This is the IP address of R2’s serial interface which is set
based on its loopback interface. Let’s verify:
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 8 of 13
© 2015 Narbik Kocharians. All rights reserved
Gateway of last resort is not set
Since the neighbors configured IP address is in our routing table as directly connected, BGP will form a
peer session.
.1 12.1.1.0/24
.2 .3
23.1.1.0/24
R1 R2 R3
On R1:
R1(config)#int s1/2
R1(config-if)#ip addr 12.1.1.1 255.255.255.0
R1(config-if)#no shu
R1(config)#int lo0
R1(config-if)#ip addr 1.1.1.1 255.255.255.255
On R2:
R2(config)#int s1/1
R2(config-if)#ip addr 12.1.1.2 255.255.255.0
R2(config-if)#no shut
R2(config)#int lo0
R2(config-if)#ip addr 2.2.2.2 255.255.255.255
R2(config)#int s1/3
R2(config-if)#ip addr 23.1.1.2 255.255.255.0
R2(config-if)#no shu
On R3:
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 9 of 13
© 2015 Narbik Kocharians. All rights reserved
R3(config)#int s1/2
R3(config-if)#ip addr 23.1.1.3 255.255.255.0
R3(config-if)#no shut
R3(config)#int lo0
R3(config-if)#ip addr 3.3.3.3 255.255.255.0
On All Routers:
Rx(config)#router ospf 1
Rx(config-router)#netw 0.0.0.0 0.0.0.0 a 0
Now, let’s establish an EBGP session between R1 and R3 using their loopback0 interfaces. The question is
what should the TTL be set to?
Well, from R1’s perspective to get to the loopback0 interface of R3 we have to go over two routers, so
the TTL should be set to two. Let’s configure R1 in AS 100, and R3 in AS 300. Let’s configure and verify:
On R1:
R1(config)#router bgp 100
R1(config-router)#neigh 3.3.3.3 remote 300
R1(config-router)#neigh 3.3.3.3 update lo0
R1(config-router)#neigh 3.3.3.3 ebgp-multihop 2
On R3:
R3(config)#router bgp 300
R3(config-router)#neigh 1.1.1.1 remot 100
R3(config-router)#neigh 1.1.1.1 update lo0
R3(config-router)#neigh 1.1.1.1 ebgp-multihop 2
What if we remove the “Neighbor ebgp-multihop” command and replace it with “Neighbor disable-
connected-check”? will the neighbor adjacency be established?
The answer is a big NO, because the “Neighbor disable-connected-check” command sets the TTL to 1,
and the TTL must be 2 or more.
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 10 of 13
© 2015 Narbik Kocharians. All rights reserved
Can we make this work without removing any BGP command, configuring GRE tunnel, IPsec or an IPnIP
tunnel?
R3#cle ip bgp *
R3#
On R1:
R1(config)#router bgp 100
R1(config-router)#no neigh 3.3.3.3 ebgp-multihop 2
R1(config-router)#neigh 3.3.3.3 disable-connected-check
To configure an adjacency, we will configure “mpls ip” on the links that interconnect the routers:
R1(config)#int s1/2
R1(config-if)#mpls ip
On R2:
R2(config)#int s1/1
R2(config-if)#mpls ip
R2(config)#int s1/3
R2(config-if)#mpls ip
On R3:
R3(config)#int s1/2
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 11 of 13
© 2015 Narbik Kocharians. All rights reserved
R3(config-if)#mpls ip
By default, the penultimate hop popper, in this case R2 will remove the label. In this step we will instruct
R2 not to remove the label.
On R1:
R1#sh mpls ldp binding 1.1.1.1 32
lib entry: 1.1.1.1/32, rev 10
local binding: label: imp-null
remote binding: lsr: 2.2.2.2:0, label: 16
The following command instructs the neighboring LSR (R2) not to remove the label:
On R2:
R2#sh mpls ldp binding 1.1.1.1 32
On R3:
R3(config)#mpls ldp explicit-null
So far we have instructed the PHP (R2) not to pop the label, now the second problem that we face is the
TTL.
When an IP packet enters an MPLS network, the TTL of the IP packet is propagated to the TTL field in the
label, and as the labeled packet traverses hop by hop from router to router, the TTL field of the labeled
packet is decremented, and when the packet exits the MPLS network, the TTL of the labeled packet is
propagated to the TTL field in the IP packet.
Let’s instruct MPLS not to propagate the TTL back to the TTL field of the IP packet. With this
configuration, the routers (R1 and R3) will receive the packets with a TTL of 1. Let’s configure and verify:
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 12 of 13
© 2015 Narbik Kocharians. All rights reserved
On All Routers:
Rx(config)#no mpls ip propagate-ttl
Erase the configuration and reload the routers before proceeding to the next lab.
CCIE R&S by Narbik Kocharians Advanced CCIE R&S Work Book v5.0 Page 13 of 13
© 2015 Narbik Kocharians. All rights reserved