路由更新
拓扑说明:通过在R2是做策略让R1学不到R3中192.168.1.0这个网段的地址。

R1 配置:
interface FastEthernet0/0
ip address 192.168.2.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 10.10.10.2 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 192.168.2.0 0.0.0.255 area 0
!
router bgp 1
no synchronization
bgp log-neighbor-changes
network 10.10.10.0
network 10.10.10.0 mask 255.255.255.0
network 192.168.2.0
aggregate-address 192.168.2.0 255.255.255.0
neighbor 10.10.10.1 remote-as 2
no auto-summary
ip address 192.168.2.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 10.10.10.2 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 192.168.2.0 0.0.0.255 area 0
!
router bgp 1
no synchronization
bgp log-neighbor-changes
network 10.10.10.0
network 10.10.10.0 mask 255.255.255.0
network 192.168.2.0
aggregate-address 192.168.2.0 255.255.255.0
neighbor 10.10.10.1 remote-as 2
no auto-summary
R2配置:
interface FastEthernet0/0
ip address 10.10.20.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 10.10.10.1 255.255.255.0
duplex auto
speed auto
!
router ospf 2
log-adjacency-changes
network 10.10.10.0 0.0.0.255 area 1
network 10.10.20.0 0.0.0.255 area 1
ip address 10.10.20.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 10.10.10.1 255.255.255.0
duplex auto
speed auto
!
router ospf 2
log-adjacency-changes
network 10.10.10.0 0.0.0.255 area 1
network 10.10.20.0 0.0.0.255 area 1
router bgp 2
no synchronization
bgp log-neighbor-changes
network 10.10.10.0
network 10.10.20.0
neighbor 10.10.10.2 remote-as 1
neighbor 10.10.20.2 remote-as 3
no auto-summary
no synchronization
bgp log-neighbor-changes
network 10.10.10.0
network 10.10.20.0
neighbor 10.10.10.2 remote-as 1
neighbor 10.10.20.2 remote-as 3
no auto-summary
R3配置:
interface FastEthernet0/0
ip address 10.10.20.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
router ospf 2
log-adjacency-changes
network 172.30.0.0 0.0.0.255 area 2
!
router bgp 3
no synchronization
bgp log-neighbor-changes
network 10.10.20.0 mask 255.255.255.0
network 192.168.1.0
neighbor 10.10.20.1 remote-as 2
no auto-summary
ip address 10.10.20.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
router ospf 2
log-adjacency-changes
network 172.30.0.0 0.0.0.255 area 2
!
router bgp 3
no synchronization
bgp log-neighbor-changes
network 10.10.20.0 mask 255.255.255.0
network 192.168.1.0
neighbor 10.10.20.1 remote-as 2
no auto-summary
此时我还没有做策略,大家看下R1路由表:

我们可以看到路由表全部学到,让我看下如何设置策略!
R2:neighbor 10.10.10.2 prefix-list jin out
ip prefix-list jin seq 5 deny 192.168.1.0/24
加入以上两条命令让我们看下结果如图:

我们可以看到R1上学到的两个路由表消失了。这是通过用前缀列表的方式做的。
分发列表的命令如下:
首先定义一个ACL :r2(config)#access-list 1 deny 192.168.1.0
定义分发列表:r2(config-router)#neighbor 10.10.10.2 distribute-list 1 out
前缀列表,分发列表功能都很强大,至于不同之处,我就不在此详述。大家可以看下文档!在BGP中策略路由,包括router-map应用是比用的,所以要好好学习!
实验完毕!!!







发表评论 评论 (4 个评论)