双向双点重分发
                                   作者:骄
                                        QQ40309630
 
R1#sh run
Building configuration...
 
Current configuration : 1823 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
ip cef
!
!
no ip dhcp use vrf connected
ip dhcp excluded-address 192.168.1.254
ip dhcp excluded-address 192.168.2.1
!
ip dhcp pool VLAN10
   network 192.168.1.0 255.255.255.0
   dns-server 218.1.1.1
   default-router 192.168.1.254
!
ip dhcp pool VLAN20
   network 192.168.2.0 255.255.255.0
   dns-server 218.1.1.1
   default-router 192.168.2.1
!
!
no ip domain lookup
!
multilink bundle-name authenticated
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet0/0.1
 encapsulation dot1Q 10
 ip address 192.168.1.254 255.255.255.0
!
interface FastEthernet0/0.2
 encapsulation dot1Q 20
 ip address 192.168.2.1 255.255.255.0
!
interface Serial1/0
 ip address 192.1.12.1 255.255.255.0
 serial restart-delay 0
 clock rate 64000
!
interface Serial1/1
 ip address 192.1.13.1 255.255.255.0
 serial restart-delay 0
 clock rate 64000
!
!
router ospf 100
 router-id 1.1.1.1
 log-adjacency-changes
 redistribute connected subnets
 network 192.1.12.0 0.0.0.255 area 0
 network 192.1.13.0 0.0.0.255 area 0
!
no ip http server
no ip http secure-server
!
End
 
 
 
R2#sh run
Building configuration...
 
Current configuration : 1862 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
!
hostname R2
!
no ip domain lookup
!
multilink bundle-name authenticated
!
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
 ip address 193.1.1.1 255.255.255.0
 duplex full
 vrrp 10 ip 193.1.1.253
 vrrp 10 priority 120
 vrrp 10 authentication md5 key-string cisco
 vrrp 20 ip 193.1.1.254
 vrrp 20 authentication md5 key-string cisco2
!
interface Serial1/0
 ip address 192.1.12.2 255.255.255.0
 ip policy route-map red
 serial restart-delay 0
!
!
router eigrp 90
 redistribute ospf 100 metric 1000 100 255 1 1500
 network 193.1.1.0
 no auto-summary
!
router ospf 100
 router-id 2.2.2.2
 log-adjacency-changes
 redistribute eigrp 90 subnets route-map red
 network 192.1.12.0 0.0.0.255 area 0
 distance 180 3.3.3.3 0.0.0.0
!
no ip http server
no ip http secure-server
!
!
!
logging alarm informational
access-list 10 permit 10.1.1.0
access-list 20 permit 10.1.2.0
access-list 30 permit 10.1.3.0
!
!
route-map red permit 10
 match ip address 10
 set metric 1500
 set metric-type type-1
!
route-map red deny 20
 match ip address 20
!
route-map red permit 30
 set metric 5000
 set metric-type type-2
!
  
end
 
 
 
R3#sh run
Building configuration...
 
Current configuration : 1862 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
no ip domain lookup
!
multilink bundle-name authenticated
!
!
interface Loopback0
 ip address 3.3.3.3 255.255.255.0
!        
interface FastEthernet0/0
 ip address 193.1.1.2 255.255.255.0
 duplex full
 vrrp 10 ip 193.1.1.253
 vrrp 10 authentication md5 key-string cisco
 vrrp 20 ip 193.1.1.254
 vrrp 20 priority 120
 vrrp 20 authentication md5 key-string cisco2
!
interface Serial1/1
 ip address 192.1.13.2 255.255.255.0
 serial restart-delay 0
!!
router eigrp 90
 redistribute ospf 100 metric 1000 100 255 1 1500
 network 193.1.1.0
 no auto-summary
!        
router ospf 100
 router-id 3.3.3.3
 log-adjacency-changes
 redistribute eigrp 90 subnets route-map red
 network 192.1.13.0 0.0.0.255 area 0
 distance 180 2.2.2.2 0.0.0.0
!
no ip http server
no ip http secure-server
!
!
!
logging alarm informational
access-list 10 permit 10.1.1.0
access-list 20 permit 10.1.2.0
access-list 30 permit 10.1.3.0
!
!
route-map red permit 10
 match ip address 10
 set metric 1500
 set metric-type type-1
!        
route-map red deny 20
 match ip address 20
!
route-map red permit 30
 set metric 5000
 set metric-type type-2
!
End
 
 
 
R5>en
R5#
R5#
R5#sh run
Building configuration...
 
Current configuration : 1324 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R5
!
multilink bundle-name authenticated
!
!        
!
!
interface Loopback0
 ip address 5.5.5.5 255.255.255.0
!
interface Loopback1
 ip address 10.1.1.1 255.255.255.0
!
interface Loopback2
 ip address 10.1.2.1 255.255.255.0
!
interface Loopback3
 ip address 10.1.3.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 193.1.1.5 255.255.255.0
 duplex full
!
!
router eigrp 90
 redistribute connected
 network 193.1.1.0
 no auto-summary
!        
no ip http server
no ip http secure-server
end
 
实验总结:
双向路由重分发提供了 冗余、备份还可进行负载。实验时需要在R1R5 上面redistribute connected subnet,因为network中没有匹配到接口上面。这个实验存在着管理距离的问题!
1、          相同协议之间,度量值越小越优先;
2、          不同协议之间,管理距离越小越优先。
 
起初未采用distance,当我们采用show ip route 的时候,我们会发现R2或者R3上面哪个先配置redistribute哪个就是R1或者R51.1.1.1或者5.5.5.5下一跳经过的路由器,而并没有负载均衡。
这里以R2先配置redistribute为例:
因为EIGRP的外部汇总路由管理距离为170,当外部汇总路由 redistributeR1时,在R1路由表中就将添加O E2的路由条目;OSPF再通过LSA讲该条目通告给R3,此时R3也接收到外部汇总路由,通告比较,R3会选择不同协议之间 管理距离小的加入到路由表当中。这样,在查看R1的路由表时,将看到5.5.5.5目的网络的下一跳是R2S1/0,并不会负载均衡。
因此,我们需要解决这个问题有两种方法:
1、          减小外部汇总路由的管理距离;
2、          增多OSPF协议的管理距离。
这时需要在R1R4上用到distance命令。然而,对于双向重分发而言。我们会发现这两种方法都行不通!原因同上!
 
因此,我们需要另谋良策!及在R2R3上面控制外部汇总路由distance。同样以R2先配置为例:
R2 redistribute外部汇总路由进来的时候,产生O E2路由,管理距离为110,同理,当R1收到这个路由条目的时候,他将发送LSAR3。这时我们在R3上面运用distance  180  3.3.3.3   0.0.0.0OSPF下面)的命令,将来自R2的外部路由管理距离更改为180(及修改O E2管理距离为180)。这时外部汇总路由也redistribute外部汇总路由(管理距离170)进来。通过比较发现,外部汇总路由优先,将被放进路由表。这样在R1上面show ip route 的时候,我们就会发现到达目的主机5.5.5.5有两个下一跳,及负载均衡了。
同理,R4端,当R2 redistribute路由信息进来时,将被加入到路由表,R4将发送更新包(LSU)到R3R3接收到外部汇总路由和D EX路由信息,将比较他们的管理距离。Redistribute 路由信息管理距离为110,而外部汇总路由为170,将管理距离小的路由条目加入到路由表。同样负载均衡。同时,你还可以试试在EIGRP下面修改distance小于110,可以先分析一下。看可不可行?
此外,还可以通过做单向重发布和打tag的方式来解决此类问题!
大家不妨一试。
 
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    192.1.12.0/24 is directly connected, Serial1/0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
C    192.1.13.0/24 is directly connected, Serial1/1
     5.0.0.0/24 is subnetted, 1 subnets
O E2    5.5.5.0 [110/5000] via 192.1.13.2, 00:00:09, Serial1/1
                [110/5000] via 192.1.12.2, 00:00:09, Serial1/0
     10.0.0.0/24 is subnetted, 2 subnets
O E2    10.1.3.0 [110/5000] via 192.1.13.2, 00:00:09, Serial1/1
                [110/5000] via 192.1.12.2, 00:00:09, Serial1/0
O E1    10.1.1.0 [110/1564] via 192.1.13.2, 00:00:09, Serial1/1
                [110/1564] via 192.1.12.2, 00:00:09, Serial1/0
O E2 193.1.1.0/24 [110/5000] via 192.1.13.2, 00:00:09, Serial1/1
                [110/5000] via 192.1.12.2, 00:00:09, Serial1/0
 
这里面还加入了VRRPDHCPRoute-map等知识。希望对大家有所帮助!