Toplogy: 2 3745 With 128mb RAM.
IOS: C3745-ADVENTERPRISEK9-M.
This Basic topology its to cover basic peering between different ASs.
Considerations:
For a eBGP peering to be established there are some things that need to be filled first:
-Different Autonomous Systems (in this case 65501 , 65502).
-Neighbor Must be Reachable , meaning the IP address should be reachable so BGP can establish a TCP session. ( In this case , network is a direct connection between the two Routers).
With this Requirements Understood lets begin the Lab.
Initial Config:
R1:
!
hostname R1
!
!
!
!
!
interface FastEthernet0/0
description Connected_to_R2
ip address 10.1.12.1 255.255.255.0
duplex auto
speed auto
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
!
end
R2:
hostname R2
!
!
interface FastEthernet0/0
description Connected_to_R1
ip address 10.1.12.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
!
end
1) To establish a BGP peering we need to configure the following paramerters on global and router-config modes:
R1 BGP Config:
R1(config)#router bgp 65501
R1(config-router)#neighbor 10.1.12.2 remote-as 65502
In this case we are Starting BGP process with AS (65501) with the router bgp 65501 command, then we proceed to specified the peering router parameters , the neighbor IP address 10.1.12.2 and the remote AS of the neighbor 65502.
The same must be done on R2.
R2 BGP Config:
R2(config)#router bgp 65502
R2(config-router)#neighbor 10.1.12.1 remote-as 65501
Verification:
After this commands are entered we should see the peering coming up:
*Mar 1 00:08:28.219: %BGP-5-ADJCHANGE: neighbor 10.1.12.2 Up
To verify the state of the neighbor we should use the show ip bgp summary , or the show ip bgp neighbor
R2#show ip bgp summary
BGP router identifier 10.1.12.2, local AS number 65502
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.1.12.1 4 65501 4 4 1 0 0 00:01:43 0
Here we can determine the neighbor is in the established state with the blank state output of the state/PfxRcd. We can also see the peering router Ip address (The one used for the peering) the bgp table version, BGP version, the autonomous system of the peering router , message received , message sent and the Up/down time.
R1#show ip bgp summary
BGP router identifier 10.1.12.1, local AS number 65501
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.1.12.2 4 65502 4 4 1 0 0 00:01:10 0
Now the output from the show ip bgp neighbors command:
R1#sh ip bgp neighbors
BGP neighbor is 10.1.12.2, remote AS 65502, external link
BGP version 4, remote router ID 10.1.12.2
BGP state = Established, up for 00:32:06
Last read 00:00:06, last write 00:00:06, hold time is 180, keepalive interval is 60 seconds
-output-omitted-
R2#show ip bgp neighbors
BGP neighbor is 10.1.12.1, remote AS 65501, external link
BGP version 4, remote router ID 10.1.12.1
BGP state = Established, up for 00:32:55
Last read 00:00:55, last write 00:00:55, hold time is 180, keepalive interval is 60 seconds
-output-omitted-
Here we can see other parameters not shown on the show ip bgp summary command, like the type of link (external link) , router ID , neighbor state , hold time and keep alive interval.
Now lets add some Prefixes to advertise.
Considering that BGP needs to match an entry in the routing table to advertise prefixes , i`ll add one loopback on each router.
R1:
R1(config)#int lo0
R1(config-if)#ip add 1.1.1.1 255.0.0.0
R2:
R2(config)#int l0
R2(config-if)#ip add 2.2.2.2 255.0.0.0
We can see both loopbacks added to the routing table as directly connected.
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
C 1.0.0.0/8 is directly connected, Loopback0
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
C 2.0.0.0/8 is directly connected, Loopback0
To advertise the routes on BGP:
R1:
R1(config)#router bgp 65501
R1(config-router)#network 1.0.0.0
R2(config)#router bgp 65502
R2(config-router)#network 2.0.0.0 mask 255.0.0.0
Here we added the respective loopbacks on each router. We used two different approaches, first the network 1.0.0.0 command without mask ( here BGP matches at the classfull boundary , /8 in this case which is precisely the mask used in the interface and the one listed earlier on the routing table. ) the other approach , the one used on R2 , network 2.0.0.0 mask 255.0.0.0 in this case we specified the mask which is also a /8 prefix ( if we had used another mask that do not match the prefix in the routing table it would not have been advertised).
Now lets verify if networks are being advertised. This is achieved with the show ip bgp , which shows the current BGP table.
R1#show ip bgp
BGP table version is 3, local router ID is 10.1.12.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.0.0.0 0.0.0.0 0 32768 i
*> 2.0.0.0 10.1.12.2 0 0 65502 i
R2#show ip bgp
BGP table version is 3, local router ID is 10.1.12.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.0.0.0 10.1.12.1 0 0 65501 i
*> 2.0.0.0 0.0.0.0 0 32768 i
First thing to note its the change on the BGP table version, which is 3 in this case. Then we can see the prefixes on both routers , each one has a next-hop of the peering routers (as it should) , also we can learn that the routes are valid and best (which means they are installed in the routing table ) this is shown by the *> at the beginning of the prefix under the network state, the network belonging to each routers have a next hop of 0.0.0.0 which is the local router. Under PATH we can see the ASs that the Packet traversed to get to this router, in this case is only the AS of the neighboring router.
To verify Installation of the routes in the routing table:
R1#sh ip route | incl B
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
B 2.0.0.0/8 [20/0] via 10.1.12.2, 00:43:52
R2#sh ip route | incl B
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
B 1.0.0.0/8 [20/0] via 10.1.12.1, 00:44:57
Peering established and routes advertised, we are all good to go. This is a pretty simple scenario of a EBGP peering just to remember the basics , next i`ll be posting some related to BGP multihop on eBGP scenarios , IBGP peering , Peer-groups and Peer-templates , authentication and the update-source and neighbor shutdown commands.
PD: Sorry for my bad english, feel free to correct any mistake related to BGP or english grammar :P .
No comments:
Post a Comment