4. BGP configuration steps
Enable BGP routing process, <as-number> is the AS system ID
of router, 1~65535.
Configure a BGP neighbor and AS number of a peer
Configure BGP Route Advertisement
ZXR10(config)# router bgp < as-number>
ZXR10(config-bgp)# neighbor [ < ipv4-address> | < peer-group-name>
] remote-as < number>
ZXR10(config-bgp)# network< ip-address> < net-mask>
ZXR10(config-bgp)# redistribute < protocol>
6. Establishing EBGP Neighbor
EBGP:physical connected directly
--Use IP addresses of interconnected interfaces
to create BGP connection
--Use IP addresses of loopback interfaces to
create BGP connection
8. Establishing EBGP Neighbor--Show BGP neighbor
R1#show ip bgp neighbor
BGP neighbor is 129.213.1.2, remote AS 65001, external link
BGP version 4, remote router ID 129.213.1.2
BGP state = Established, up for 00:04:21
hold time is 90 seconds, keepalive interval is 30 seconds
……
Connections established 1
Local host: 129.213.1.1, Local port: 179
Foreign host: 129.213.1.2, Foreign port: 1024
R2#show ip bgp neighbor
BGP neighbor is 129.213.1.1, remote AS 65000, external link
BGP version 4, remote router ID 129.213.1.1
BGP state = Established, up for 00:00:27
hold time is 90 seconds, keepalive interval is 30 seconds
……
Connections established 1
Local host: 129.213.1.2, Local port: 1024
Foreign host: 129.213.1.1, Foreign port: 179
9. Establishing EBGP Neighbor--Loopback address
R1# config terminal
R1(config)# interface fei-0/1/0/1
R1(config-if)# ip address 192.168.1.1 255.255.255.252
R1(config-if)# exit
R1(config)# interface Loopback1
R1(config-if)# ip address 1.1.1.1 255.255.255.255
R1(config-if)# exit
R1(config)# router bgp 65000
R1(config-bgp)# neighbor 1.1.1.2 remote-as 65001
R1(config-bgp)# neighbor 1.1.1.2 ebgp-multihop
R1(config-bgp)# neighbor 1.1.1.2 update-source Loopback1
R1(config-bgp)# exit
R1(config)# ip route 1.1.1.2 255.255.255.255 192.168.1.2
R2(config)# router bgp 65001
R2(config-bgp)# neighbor 1.1.1.1 remote-as 65000
R2(config-bgp)# neighbor 1.1.1.1 ebgp-multihop ttl 5
R2(config-bgp)# neighbor 1.1.1.1 update-source Loopback1
R2(config-bgp)# exit
R2(config)# ip route 1.1.1.1 255.255.255.255 192.168.1.1
By default, TTL value for EBGP is 1
use "ebgp-multihop" command while
establishing EBGP neighbor on not
directly connected interfaces. default TTL
value is 8
10. R1#show ip bgp neighbor
BGP neighbor is 1.1.1.2, remote AS 65001, external link
BGP version 4, remote router ID 1.1.1.2
BGP state = Established, up for 00:01:01
hold time is 90 seconds, keepalive interval is 30 seconds
……
Connections established 1
Local host: 1.1.1.1, Local port: 179
Foreign host: 1.1.1.2, Foreign port: 1026
R2#show ip bgp neighbor
BGP neighbor is 1.1.1.1, remote AS 65000, external link
BGP version 4, remote router ID 1.1.1.1
BGP state = Established, up for 00:02:03
hold time is 90 seconds, keepalive interval is 30 seconds
……
Connections established 1
Local host: 1.1.1.2, Local port: 1026
Foreign host: 1.1.1.1, Foreign port: 179
Establishing EBGP Neighbor--Show BGP neighbor
11. Establishing IBGP Neighbor
IBGP:physical connected directly
or not connected directly
-- Use IP addresses of loopback interfaces to
create BGP connection
-- Synchronization
-- Full mesh
-- valuable nexthop(have reachable route)
13. Establishing IBGP Neighbor--Show BGP Neighbor
R2#show ip bgp neighbor
BGP neighbor is 1.1.1.3, remote AS 65001, internal link
BGP version 4, remote router ID 1.1.1.3
BGP state = Established, up for 00:01:25
hold time is 90 seconds, keepalive interval is 30 seconds
……
Connections established 1
last error code is 6
Local host: 1.1.1.2, Local port: 179
Foreign host: 1.1.1.3, Foreign port: 1096
R3#show ip bgp neighbor
BGP neighbor is 1.1.1.2, remote AS 65001, internal link
BGP version 4, remote router ID 1.1.1.2
BGP state = Established, up for 00:03:07
……
Connections established 1
last error code is 5
Local host: 1.1.1.3, Local port: 1096
Foreign host: 1.1.1.2, Foreign port: 179
15. Configuring BGP Route Advertisement
1. Use network command to advertise route
Advertise the concrete network routes learned from IGP protocol
(static,RIP、OSPF、ISIS etc)
2. Use redistribute command to advertise route
Redistribute all the routes learned from IGP protocol(s) while
there are a lot of routes which are hard to aggregate
3. BGP route aggregation
Aggregate the routes to one summary route and advertise to
other BGP neighbors, therefore can reduce the size of IP routing
table significantly.
Make sure the mask of all the routes are equal while configuring
route aggregation on routers, in order to avoid black hole route
16. Using network to Advertise Route
R2 runs OSPF as IGP protocol.
R2 requires advertising the
network segment 18.0.0.0/8 which is
discovered by OSPF in BGP.
R2#config terminal
R2(config)#interface fei-0/1/0/1
R2(config-if)#ip address 192.168.2.1 255.255.255.252
R2(config-if)#exit
R2(config)#router bgp 65001
R2(config-bgp)#neighbor 192.168.2.2 remote-as 65000
R2(config-bgp)#network 18.0.0.0 255.255.255.0
R2(config-bgp)#exit
R2(config)#router ospf 1
R2(config-ospfv2)#network 18.0.0.0 0.255.255.255 area 0
R2(config-ospfv2)#exit
R1#config terminal
R1(config)#interface fei-0/1/0/1
R1(config-if)#ip address 192.168.2.2 255.255.255.252
R1(config-if)#exit
R1(config)#router bgp 65000
R1(config-bgp)#neighbor 192.168.2.1 remote-as 65001
R1(config-bgp)#exit
17. Using network to Advertise Route-- Show BGP route
R2 runs OSPF as IGP protocol.
R2 requires advertising the
network segment 18.0.0.0/8 which is
discovered by OSPF in BGP.
R1#show ip bgp route
Status codes: *-valid, >-best, i-internal,s-stale
Origin codes: i-IGP, e-EGP, ?-incomplete
Dest NextHop Metric LocPrf RtPrf Path
*>18.0.0.0/8 192.168.2.1 20 65001 i
“*” indicates the route is available
“>” indicates the route is the best choice
“i” indicates this is a IBGP route, without “i” indicates
this is a EBGP route or local route
Next-hop:If the address is full zero, that means this
route is generated by router itself
Local-Pre:the priority level of route which is learned
by BGP. The default value is 100
Path:shows the origin of this route. Three types:
IGP, EGP and incomplete
18. Using redistribute to Advertise Route
R2 runs OSPF as IGP protocol.
Now it needs to redistribute all
OSPF routes information on R2 into BGP.
R2#config terminal
R2(config)#interface fei-0/1/0/1
R2(config-if)#ip address 192.168.2.1 255.255.255.252
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-ospfv2)#network 18.0.0.0 0.0.0.255 area 0
R2(config-ospfv2)#exit
R2(config)#router bgp 65001
R2(config-bgp)#neighbor 192.168.2.2 remote-as 65000
R2(config-bgp)#redistribute ospf-int
R2(config-bgp)#redistribute connected
R2(config-bgp)#exit
19. Using redistribute to Advertise Route-- Show BGP
Route
R1#show ip bgp route
Status codes: *-valid, >-best, i-internal,s-stale
Origin codes: i-IGP, e-EGP, ?-incomplete
Dest NextHop Metric LocPrf RtPrf Path
*> 18.0.0.0/8 192.168.2.1 20 65001 ?
R2 runs OSPF as IGP protocol.
Now it needs to redistribute all
OSPF routes information on R2 into BGP.
20. Configuring Route Aggregation
R1 advertises the segments of its own and
the segments of R3 (192.168.0.0/24,
192.168.1.0/24, 192.168.2.0/24 and
192.168.3.0/24) to R2 in AS300.
OSPF is run on the link between R1 and R3.
R1(config)#interface fei-0/1/0/1
R1(config-if)#ip address 2.2.2.2 255.255.255.0
R1(config-if)#exit
R1(config)#router bgp 100
R1(config-bgp)#neighbor 2.2.2.1 remote-as 300
R1(config-bgp)#aggregate-address 192.168.0.0
255.255.252.0 count 0 summary-only
R1(config-bgp)#redistribute ospf-int
R1(config-bgp)#redistribute connected
R1(config-bgp)#exit
R1(config)#router ospf 1
R1(config-ospfv2)#network 192.168.3.0 0.0.0.255 area 0
R1(config-ospfv2)#network 10.1.1.0 0.0.0.3 area 0
R1(config-ospfv2)#exit
If the command is used without the parameter
summary-only, R2 will advertise the detailed
routes with the aggregated route
21. Configuring Route Aggregation-- Show BGP route
R2#show ip bgp route
Status codes: *valid, >best, i-internal
Origin codes: i-IGP, e-EGP, ?-incomplete
Dest NextHop Metric LocPrf RtPrf Path
*>192.168.0.0/22 2.2.2.2 20 100 i
R2#show ip bgp route detail 192.168.0.0 255.255.252.0
BGP routing table entry for 192.168.0.0/22
01:02:19 received from 2.2.2.2
origin i, nexthop 2.2.2.2,atomic,aggr 100 2.2.2.2,
as path [100]
R1 advertises the segments of its own and
the segments of R3 (192.168.0.0/24,
192.168.1.0/24, 192.168.2.0/24 and
192.168.3.0/24) to R2 in AS300.
OSPF is run on the link between R1 and R3.