注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 IB客座主编(四)美国西蒙公..
 帮助

BGP 注入过滤


2007-02-13 13:02:20
 标签:BGP   [推送到技术圈]

版权声明:原创作品,如需转载,请与作者联系。否则将追究法律责任。

 

r1 配置

router>en
router#conf t
router(config)#host r1
r1(config)#no ip domain-lookup
r1(config)#ban mot #Welcome to r1#
r1(config)#ena sec 123
r1(config)#line vty 0 4
r1(config-line)#no login
r1(config-line)#int f 0/0
r1(config-if)#des link to r2
r1(config-if)#ip add 3.3.3.2 255.255.255.252
r1(config-if)#no shut
r1(config-if)#router bgp 200
r1(config-if)#neighbor 3.3.3.1 remote-as 100
r1(config-if)#end
r1#

r2 配置

router>en
router#conf t
router(config)#host r2
r2(config)#no ip domain-lookup
r2(config)#ban mot #Welcome to r2#
r2(config)#ena sec 123
r2(config)#line vty 0 4
r2(config-line)#no login
r2(config-line)#int f 0/0
r2(config-if)#des link to r3
r2(config-if)#ip add 192.168.3.6 255.255.255.252
r2(config-if)#no shut
r2(config-if)#int f 1/0
r2(config-if)#des link to r1
r2(config-if)#ip add 3.3.3.1 255.255.255.252
r2(config-if)#no shut
r2(config-if)#router ospf 1
r2(config-route)#network 192.168.3.4 0.0.0.3 area 1
r2(config-route)#router bgp 100
r2(config-route)#neighbor 3.3.3.2 remote-as 200
r2(config-route)#redistribution ospf 1 match external 1 external 2
r2(config-route)#end
r2#


r3 配置

router>en
router#conf t
router(config)#host r3
r3(config)#no ip domain-lookup
r3(config)#ban mot #Welcome to r3#
r3(config)#ena sec 123
r3(config)#line vty 0 4
r3(config-line)#no login
r3(config-line)#int f 0/0
r3(config-if)#des link to r4
r3(config-if)#ip add 192.168.3.2 255.255.255.252
r3(config-if)#no shut
r3(config-if)#int f 1/0
r3(config-if)#des link to r2
r3(config-if)#ip add 192.168.3.5 255.255.255.252
r3(config-if)#no shut
r3(config-if)#router ospf 1
r3(config-route)#network 192.168.3.4 0.0.0.3 area 1
r3(config-route)#network 192.168.3.0 0.0.0.3 area 0
r3(config-route)#end
r3#


r4 配置

router>en
router#conf t
router(config)#host r4
r4(config)#no ip domain-lookup
r4(config)#ban mot #Welcome to r4#
r4(config)#ena sec 123
r4(config)#line vty 0 4
r4(config-line)#no login
r4(config-line)#int f 0/0
r4(config-if)#des link to r3
r4(config-if)#ip add 192.168.3.1 255.255.255.252
r4(config-if)#no shut
r4(config-if)#int f 1/0
r4(config-if)#des link to r6
r4(config-if)#ip add 192.168.2.2 255.255.255.252
r4(config-if)#no shut
r4(config-if)#router ospf 1
r4(config-route)#network 192.168.3.0 0.0.0.3 area 0
r4(config-route)#redistribution rip metric 10 match-type 1 subnets
r4(config-route)#redistribution igrp metirc 10 match-type 2 subnets
r4(config-route)#router rip
r4(config-route)#network 192.168.2.0
r4(config-route)#redistribution ospf 1 metric 5
r4(config-route)#router igrp 10
r4(config-route)#network 192.168.1.0 0.0.0.255
r4(config-route)#redistribution ospf 1 metric 10000 100 255 1 1500
r4(config-route)#end
r4#

r5 配置

router>en
router#conf t
router(config)#host r5
r5(config)#no ip domain-lookup
r5(config)#ban mot #Welcome to r5#
r5(config)#ena sec 123
r5(config)#line vty 0 4
r5(config-line)#no login
r5(config-line)#int f 0/0
r5(config-if)#des link to r4
r5(config-if)#ip add 192.168.1.1 255.255.255.252
r5(config-if)#no shut
r5(config-if)#router igrp 10
r5(config-route)#network 192.168.1.0 0.0.0.255
r5(config-route)#end
r5#

r6 配置

router>en
router#conf t
router(config)#host r6
r6(config)#no ip domain-lookup
r6(config)#ban mot #Welcome to r6#
r6(config)#ena sec 123
r6(config)#line vty 0 4
r6(config-line)#no login
r6(config-line)#int f 0/0
r6(config-if)#des link to r4
r6(config-if)#ip add 192.168.2.1 255.255.255.252
r6(config-if)#no shut
r6(config-if)#router rip
r6(config-route)#network 192.168.2.0
r6(config-route)#end
r6#

 

 

Welcome to r1
r1>en
Password:
r1#show run
Building configuration...

Current configuration : 699 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r1
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$BdFh$5ssHv4Xv8nlCSq3yFpdsL0
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 description link to r2
 ip address 3.3.3.2 255.255.255.252
 duplex half
!
router bgp 200
 no synchronization
 bgp log-neighbor-changes
 neighbor 3.3.3.1 remote-as 100
 no auto-summary
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
!
gatekeeper
 shutdown
!
banner motd ^CWelcome to r1^C
!
line con 0
 stopbits 1
line aux 0
line vty 0 4
 no login
!
!
end

r1#show ip bgp
BGP table version is 3, local router ID is 3.3.3.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
*> 192.168.1.0      3.3.3.1                 10             0 100 ?
*> 192.168.2.0      3.3.3.1                 12             0 100 ?
r1#show 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

     3.0.0.0/30 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, FastEthernet0/0
B    192.168.1.0/24 [20/10] via 3.3.3.1, 00:01:11
B    192.168.2.0/24 [20/12] via 3.3.3.1, 00:01:11

r1#3.3.3.1
Trying 3.3.3.1 ... Open
Welcome to r2
r2>en
Password:
r2#show run
Building configuration...

Current configuration : 928 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r2
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$s7ta$xi2uURPm1AWsUfiB4BYyp.
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 description link to r3
 ip address 192.168.3.6 255.255.255.252
 duplex half
!
interface FastEthernet1/0
 description link to r1
 ip address 3.3.3.1 255.255.255.252
 duplex half
!
router ospf 1
 log-adjacency-changes
 network 192.168.3.4 0.0.0.3 area 1
!
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 redistribute ospf 1 match external 1 external 2
 neighbor 3.3.3.2 remote-as 200
 no auto-summary
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
!
 gatekeeper
 shutdown
!
banner motd ^CWelcome to r2^C
!
line con 0
 stopbits 1
line aux 0
line vty 0 4
 no login
!
!
end

r2#show ip bgp
BGP table version is 5, local router ID is 192.168.3.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
*> 192.168.1.0      192.168.3.5             10         32768 ?
*> 192.168.2.0      192.168.3.5             12         32768 ?
r2#show 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

     3.0.0.0/30 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, FastEthernet1/0
O E2 192.168.1.0/24 [110/10] via 192.168.3.5, 00:06:43, FastEthernet0/0
O E1 192.168.2.0/24 [110/12] via 192.168.3.5, 00:06:10, FastEthernet0/0
     192.168.3.0/30 is subnetted, 2 subnets
O IA    192.168.3.0 [110/2] via 192.168.3.5, 00:11:25, FastEthernet0/0
C       192.168.3.4 is directly connected, FastEthernet0/0

r2#192.168.3.5
Trying 192.168.3.5 ... Open
Welcome to r3
r3>en
Password:
r3#show run
Building configuration...

Current configuration : 807 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r3
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$4qU7$Idtowr7cS0LnrN4o4SILQ/
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 description link to r4
 ip address 192.168.3.2 255.255.255.252
 duplex half
!
interface FastEthernet1/0
 description link to r2
 ip address 192.168.3.5 255.255.255.252
 duplex half
!
router ospf 1
 log-adjacency-changes
 network 192.168.3.0 0.0.0.3 area 0
 network 192.168.3.4 0.0.0.3 area 1
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
!
gatekeeper
 shutdown
!
banner motd ^CWelcome to r3^C
!
line con 0
stopbits 1
line aux 0
line vty 0 4
 no login
!
!
end

r3#show 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

O E2 192.168.1.0/24 [110/10] via 192.168.3.1, 00:06:53, FastEthernet0/0
O E1 192.168.2.0/24 [110/11] via 192.168.3.1, 00:06:20, FastEthernet0/0
     192.168.3.0/30 is subnetted, 2 subnets
C       192.168.3.0 is directly connected, FastEthernet0/0
C       192.168.3.4 is directly connected, FastEthernet1/0
r3#192.168.3.1
Trying 192.168.3.1 ... Open
Welcome to r4
r4>en
Password:
r4#show run
Building configuration...

Current configuration : 1207 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r4
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$2jnL$QRGwXwQFvxwjNz301WQqg/
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 description link to r3
 ip address 192.168.3.1 255.255.255.252
 duplex half
!
interface FastEthernet1/0
 description link to r6
 ip address 192.168.2.2 255.255.255.0
 duplex half
!
interface FastEthernet2/0
 description link to r5
 ip address 192.168.1.2 255.255.255.0
 duplex half
!
router eigrp 10
 redistribute ospf 1 metric 10000 100 255 1 1500
 redistribute rip metric 10000 100 255 1 1500
 network 192.168.1.0
 auto-summary
!
router ospf 1
 log-adjacency-changes
 redistribute rip metric 10 metric-type 1 subnets
 redistribute eigrp 10 metric 10 subnets
 network 192.168.3.0 0.0.0.3 area 0
!
router rip
 redistribute ospf 1 metric 5
 redistribute eigrp 10 metric 5
 network 192.168.2.0
!

r4#show 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    192.168.1.0/24 is directly connected, FastEthernet2/0
C    192.168.2.0/24 is directly connected, FastEthernet1/0
     192.168.3.0/30 is subnetted, 2 subnets
C       192.168.3.0 is directly connected, FastEthernet0/0
O IA    192.168.3.4 [110/2] via 192.168.3.2, 00:24:40, FastEthernet0/0

r4#192.168.1.1
Trying 192.168.1.1 ... Open
Welcome to r5
r5>en
Password:
r5#show run
Building configuration...

Current configuration : 642 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r5
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$T/G2$FFcia3Fg.ewN4ABV72XYw1
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 description link to r4
 ip address 192.168.1.1 255.255.255.0
 duplex half
!
router eigrp 10
 network 192.168.1.0
 auto-summary
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
!
gatekeeper
 shutdown
!
banner motd ^CWelcome to r5^C
!
line con 0
 stopbits 1
line aux 0
line vty 0 4
 no login
!
!
end

r5#show 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    192.168.1.0/24 is directly connected, FastEthernet0/0
D EX 192.168.2.0/24 [170/284160] via 192.168.1.2, 00:06:27, FastEthernet0/0
     192.168.3.0/30 is subnetted, 2 subnets
D EX    192.168.3.0 [170/284160] via 192.168.1.2, 00:11:51, FastEthernet0/0
D EX    192.168.3.4 [170/284160] via 192.168.1.2, 00:11:51, FastEthernet0/0

r5#192.168.2.1
Trying 192.168.2.1 ... Open
Welcome to r6
r6>en
Password:
r6#show run
Building configuration...

Current configuration : 623 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r6
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$W83G$ZrglCoZGxIdfSjMQQ9qw9.
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 description link to r4
 ip address 192.168.2.1 255.255.255.0
 duplex half
!
router rip
 network 192.168.2.0
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
!
gatekeeper
 shutdown
!
banner motd ^CWelcome to r6^C
!
line con 0
 stopbits 1
line aux 0
line vty 0 4
 no login
!
!
end

r6#show 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

R    192.168.1.0/24 [120/5] via 192.168.2.2, 00:00:12, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/0
R    192.168.3.0/24 [120/5] via 192.168.2.2, 00:00:12, FastEthernet0/0
r6#

本文出自 “人类一思考,上帝都发笑” 博客,转载请与作者联系!



上一篇 EIGRP 非等价负载均衡  下一篇 cisco ODR



    文章评论
 
 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: