BGP详解3

八、配置样例1

下面的示例中涉及到BGP的基本配置,涉及到一些基本的知识点,如EBGP多跳、更新源使用环回接口、路由映射发布团体属性等,如下图所示。

clip_image022[4]

下面是其参考配置。

R1#sh running-config

!

interface Loopback0

ip address 192.168.250.1 255.255.255.0

!

interface Loopback1

ip address 192.168.1.213 255.255.255.252

!

interface Loopback6

ip address 5.5.5.5 255.255.255.0

!

interface Serial2/0

ip address 192.168.1.210 255.255.255.252

serial restart-delay 0

!

router bgp 300

no synchronization

bgp log-neighbor-changes

network 192.168.1.212 mask 255.255.255.252

network 192.168.250.0

neighbor 6.6.6.6 remote-as 100

neighbor 6.6.6.6 ebgp-multihop 2

neighbor 6.6.6.6 update-source Loopback6

no auto-summary

!

ip route 6.6.6.0 255.255.255.0 192.168.1.209

!

R2#sh running-config

!

interface Loopback5

ip address 1.1.1.1 255.255.255.255

!

interface Loopback6

ip address 6.6.6.6 255.255.255.0

!

interface Ethernet1/0

ip address 192.168.1.221 255.255.255.252

duplex half

!

interface Ethernet1/1

ip address 192.168.1.193 255.255.255.252

duplex half

!

!

interface Serial2/0

ip address 192.168.1.209 255.255.255.252

serial restart-delay 0

!

interface Serial2/1

ip address 192.168.1.226 255.255.255.252

serial restart-delay 0

!

router ospf 10

log-adjacency-changes

passive-interface Serial2/0

passive-interface Serial2/1

network 1.1.1.1 0.0.0.0 area 0

network 192.168.1.192 0.0.0.3 area 0

network 192.168.1.220 0.0.0.3 area 0

!

router bgp 100

no synchronization

bgp log-neighbor-changes

neighbor 2.2.2.2 remote-as 100

neighbor 2.2.2.2 update-source Loopback5

neighbor 2.2.2.2 next-hop-self

neighbor 3.3.3.3 remote-as 100

neighbor 3.3.3.3 update-source Loopback5

neighbor 3.3.3.3 next-hop-self

neighbor 5.5.5.5 remote-as 300

neighbor 5.5.5.5 ebgp-multihop 2

neighbor 5.5.5.5 update-source Loopback6

neighbor 192.168.1.225 remote-as 200

no auto-summary

!

ip route 5.5.5.0 255.255.255.0 192.168.1.210

!

R3#sh running-config

!

interface Loopback5

ip address 2.2.2.2 255.255.255.255

!

interface Ethernet1/0

ip address 192.168.1.222 255.255.255.252

duplex half

!

interface Ethernet1/1

ip address 192.168.1.198 255.255.255.252

duplex half

!

router ospf 10

log-adjacency-changes

network 2.2.2.2 0.0.0.0 area 0

network 192.168.1.196 0.0.0.3 area 0

network 192.168.1.220 0.0.0.3 area 0

!

router bgp 100

no synchronization

bgp log-neighbor-changes

neighbor 1.1.1.1 remote-as 100

neighbor 1.1.1.1 update-source Loopback5

neighbor 3.3.3.3 remote-as 100

neighbor 3.3.3.3 update-source Loopback5

no auto-summary

!

R4#sh running-config

!

interface Loopback5

ip address 3.3.3.3 255.255.255.255

!

interface Ethernet1/0

ip address 192.168.1.194 255.255.255.252

duplex half

!

interface Ethernet1/1

ip address 192.168.1.197 255.255.255.252

duplex half

!

interface Ethernet1/2

ip address 192.168.1.206 255.255.255.252

duplex half

!

!

router ospf 10

log-adjacency-changes

passive-interface Ethernet1/2

network 3.3.3.3 0.0.0.0 area 0

network 192.168.1.192 0.0.0.3 area 0

!

router bgp 100

no synchronization

bgp log-neighbor-changes

neighbor 1.1.1.1 remote-as 100

neighbor 1.1.1.1 update-source Loopback5

neighbor 1.1.1.1 next-hop-self

neighbor 2.2.2.2 remote-as 100

neighbor 2.2.2.2 update-source Loopback5

neighbor 2.2.2.2 next-hop-self

neighbor 192.168.1.205 remote-as 400

no auto-summary

!

R5#sh running-config

!

interface Loopback0

ip address 192.168.50.1 255.255.255.0

!

interface Loopback1

ip address 192.168.75.1 255.255.255.0

!

interface Loopback3

ip address 192.168.1.201 255.255.255.252

!

interface Ethernet1/0

ip address 192.168.1.205 255.255.255.252

duplex half

!

router bgp 400

no synchronization

bgp log-neighbor-changes

network 192.168.1.200 mask 255.255.255.252

network 192.168.50.0

network 192.168.75.0

neighbor 192.168.1.206 remote-as 100

no auto-summary

!

R6#sh running-config

!

interface Loopback0

ip address 192.168.100.1 255.255.255.0

!

interface Loopback1

ip address 192.168.200.1 255.255.255.0

!

interface Loopback3

ip address 192.168.1.217 255.255.255.252

!

interface Loopback10

ip address 192.168.192.1 255.255.255.0

!

interface Loopback11

ip address 192.168.193.1 255.255.255.0

!

interface Loopback12

ip address 192.168.194.1 255.255.255.0

!

interface Loopback13

ip address 192.168.195.1 255.255.255.0

!

interface Loopback14

ip address 192.168.196.1 255.255.255.0

!

interface Loopback15

ip address 192.168.197.1 255.255.255.0

!

interface Loopback16

ip address 192.168.198.1 255.255.255.0

!

interface Loopback17

ip address 192.168.199.1 255.255.255.0

!

interface Serial2/0

ip address 192.168.1.225 255.255.255.252

serial restart-delay 0

!

router bgp 200

no synchronization

bgp log-neighbor-changes

network 192.168.1.216 mask 255.255.255.252

network 192.168.100.0

network 192.168.192.0

network 192.168.193.0

network 192.168.194.0

network 192.168.195.0

network 192.168.196.0

network 192.168.197.0

network 192.168.198.0

network 192.168.199.0

network 192.168.200.0

aggregate-address 192.168.192.0 255.255.248.0

neighbor 192.168.1.226 remote-as 100

neighbor 192.168.1.226 send-community

neighbor 192.168.1.226 route-map community out

no auto-summary

!

!

no ip http server

no ip http secure-server

!

!

access-list 110 permit ip host 192.168.192.0 host 255.255.248.0

!

route-map community permit 10

match ip address 110

set community none

!

route-map community permit 20

set community no-export

!

使用一些常用命令来查看其状态信息,如下所示:

R2#sh ip bgp

BGP table version is 18, local router ID is 6.6.6.6

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

*>i192.168.1.200/30 3.3.3.3 0 100 0 400 i

*> 192.168.1.212/30 5.5.5.5 0 0 300 i

*> 192.168.1.216/30 192.168.1.225 0 0 200 i

*>i192.168.50.0 3.3.3.3 0 100 0 400 i

*>i192.168.75.0 3.3.3.3 0 100 0 400 i

*> 192.168.100.0 192.168.1.225 0 0 200 i

*> 192.168.192.0 192.168.1.225 0 0 200 i

*> 192.168.192.0/21 192.168.1.225 0 0 200 i

*> 192.168.193.0 192.168.1.225 0 0 200 i

*> 192.168.194.0 192.168.1.225 0 0 200 i

*> 192.168.195.0 192.168.1.225 0 0 200 i

*> 192.168.196.0 192.168.1.225 0 0 200 i

*> 192.168.197.0 192.168.1.225 0 0 200 i

*> 192.168.198.0 192.168.1.225 0 0 200 i

*> 192.168.199.0 192.168.1.225 0 0 200 i

*> 192.168.200.0 192.168.1.225 0 0 200 i

*> 192.168.250.0 5.5.5.5 0 0 300 i

R2#sh ip bgp summary

BGP router identifier 6.6.6.6, local AS number 100

BGP table version is 18, main routing table version 18

17 network entries using 1989 bytes of memory

17 path entries using 884 bytes of memory

5/4 BGP path/bestpath attribute entries using 620 bytes of memory

3 BGP AS-PATH entries using 72 bytes of memory

1 BGP community entries using 24 bytes of memory

0 BGP route-map cache entries using 0 bytes of memory

0 BGP filter-list cache entries using 0 bytes of memory

BGP using 3589 total bytes of memory

BGP activity 17/0 prefixes, 17/0 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd

2.2.2.2 4 100 15 18 18 0 0 00:12:09 0

3.3.3.3 4 100 16 18 18 0 0 00:12:17 3

5.5.5.5 4 300 16 18 18 0 0 00:12:49 2

192.168.1.225 4 200 17 18 18 0 0 00:12:03 12

R4#sh ip bgp

BGP table version is 18, local router ID is 3.3.3.3

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

*> 192.168.1.200/30 192.168.1.205 0 0 400 i

*>i192.168.1.212/30 1.1.1.1 0 100 0 300 i

*>i192.168.1.216/30 1.1.1.1 0 100 0 200 i

*> 192.168.50.0 192.168.1.205 0 0 400 i

*> 192.168.75.0 192.168.1.205 0 0 400 i

*>i192.168.100.0 1.1.1.1 0 100 0 200 i

*>i192.168.192.0 1.1.1.1 0 100 0 200 i

*>i192.168.192.0/21 1.1.1.1 0 100 0 200 i

*>i192.168.193.0 1.1.1.1 0 100 0 200 i

*>i192.168.194.0 1.1.1.1 0 100 0 200 i

*>i192.168.195.0 1.1.1.1 0 100 0 200 i

*>i192.168.196.0 1.1.1.1 0 100 0 200 i

*>i192.168.197.0 1.1.1.1 0 100 0 200 i

*>i192.168.198.0 1.1.1.1 0 100 0 200 i

*>i192.168.199.0 1.1.1.1 0 100 0 200 i

*>i192.168.200.0 1.1.1.1 0 100 0 200 i

*>i192.168.250.0 1.1.1.1 0 100 0 300 i

R4#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 192.168.192.0/24 [200/0] via 1.1.1.1, 00:12:47

1.0.0.0/32 is subnetted, 1 subnets

O 1.1.1.1 [110/11] via 192.168.1.193, 00:13:28, Ethernet1/0

B 192.168.193.0/24 [200/0] via 1.1.1.1, 00:12:47

2.0.0.0/32 is subnetted, 1 subnets

O 2.2.2.2 [110/21] via 192.168.1.193, 00:13:28, Ethernet1/0

B 192.168.194.0/24 [200/0] via 1.1.1.1, 00:12:47

B 192.168.75.0/24 [20/0] via 192.168.1.205, 00:12:49

3.0.0.0/32 is subnetted, 1 subnets

C 3.3.3.3 is directly connected, Loopback5

B 192.168.195.0/24 [200/0] via 1.1.1.1, 00:12:47

B 192.168.196.0/24 [200/0] via 1.1.1.1, 00:12:47

B 192.168.197.0/24 [200/0] via 1.1.1.1, 00:12:47

B 192.168.198.0/24 [200/0] via 1.1.1.1, 00:12:48

B 192.168.199.0/24 [200/0] via 1.1.1.1, 00:12:48

B 192.168.200.0/24 [200/0] via 1.1.1.1, 00:12:48

B 192.168.250.0/24 [200/0] via 1.1.1.1, 00:12:49

B 192.168.50.0/24 [20/0] via 192.168.1.205, 00:12:51

192.168.1.0/30 is subnetted, 7 subnets

B 192.168.1.200 [20/0] via 192.168.1.205, 00:12:51

C 192.168.1.204 is directly connected, Ethernet1/2

C 192.168.1.192 is directly connected, Ethernet1/0

C 192.168.1.196 is directly connected, Ethernet1/1

B 192.168.1.216 [200/0] via 1.1.1.1, 00:12:48

O 192.168.1.220 [110/20] via 192.168.1.193, 00:13:30, Ethernet1/0

B 192.168.1.212 [200/0] via 1.1.1.1, 00:12:49

B 192.168.100.0/24 [200/0] via 1.1.1.1, 00:12:48

B 192.168.192.0/21 [200/0] via 1.1.1.1, 00:12:48

R4#sh ip bgp summary

BGP router identifier 3.3.3.3, local AS number 100

BGP table version is 18, main routing table version 18

17 network entries using 1989 bytes of memory

17 path entries using 884 bytes of memory

5/4 BGP path/bestpath attribute entries using 620 bytes of memory

3 BGP AS-PATH entries using 72 bytes of memory

0 BGP route-map cache entries using 0 bytes of memory

0 BGP filter-list cache entries using 0 bytes of memory

BGP using 3565 total bytes of memory

BGP activity 17/0 prefixes, 17/0 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd

1.1.1.1 4 100 19 17 18 0 0 00:13:37 14

2.2.2.2 4 100 16 17 18 0 0 00:13:25 0

192.168.1.205 4 400 17 19 18 0 0 00:13:30 3

R5#sh ip bgp

BGP table version is 18, local router ID is 192.168.75.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

*> 192.168.1.200/30 0.0.0.0 0 32768 i

*> 192.168.1.212/30 192.168.1.206 0 100 300 i

*> 192.168.1.216/30 192.168.1.206 0 100 200 i

*> 192.168.50.0 0.0.0.0 0 32768 i

*> 192.168.75.0 0.0.0.0 0 32768 i

*> 192.168.100.0 192.168.1.206 0 100 200 i

*> 192.168.192.0 192.168.1.206 0 100 200 i

*> 192.168.192.0/21 192.168.1.206 0 100 200 i

*> 192.168.193.0 192.168.1.206 0 100 200 i

*> 192.168.194.0 192.168.1.206 0 100 200 i

*> 192.168.195.0 192.168.1.206 0 100 200 i

*> 192.168.196.0 192.168.1.206 0 100 200 i

*> 192.168.197.0 192.168.1.206 0 100 200 i

*> 192.168.198.0 192.168.1.206 0 100 200 i

*> 192.168.199.0 192.168.1.206 0 100 200 i

*> 192.168.200.0 192.168.1.206 0 100 200 i

*> 192.168.250.0 192.168.1.206 0 100 300 i

R5#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 192.168.192.0/24 [20/0] via 192.168.1.206, 00:13:03

B 192.168.193.0/24 [20/0] via 192.168.1.206, 00:13:03

B 192.168.194.0/24 [20/0] via 192.168.1.206, 00:13:03

C 192.168.75.0/24 is directly connected, Loopback1

B 192.168.195.0/24 [20/0] via 192.168.1.206, 00:13:03

B 192.168.196.0/24 [20/0] via 192.168.1.206, 00:13:03

B 192.168.197.0/24 [20/0] via 192.168.1.206, 00:13:03

B 192.168.198.0/24 [20/0] via 192.168.1.206, 00:13:03

B 192.168.199.0/24 [20/0] via 192.168.1.206, 00:13:03

B 192.168.200.0/24 [20/0] via 192.168.1.206, 00:13:03

B 192.168.250.0/24 [20/0] via 192.168.1.206, 00:13:34

C 192.168.50.0/24 is directly connected, Loopback0

192.168.1.0/30 is subnetted, 4 subnets

C 192.168.1.200 is directly connected, Loopback3

C 192.168.1.204 is directly connected, Ethernet1/0

B 192.168.1.216 [20/0] via 192.168.1.206, 00:13:04

B 192.168.1.212 [20/0] via 192.168.1.206, 00:13:35

B 192.168.100.0/24 [20/0] via 192.168.1.206, 00:13:04

B 192.168.192.0/21 [20/0] via 192.168.1.206, 00:13:04


你可能感兴趣的:(接口,知识点,interface,Address,router)