基本配置
R1:
interface FastEthernet0/0
 ip address 12.12.12.1 255.255.255.0
 duplex auto
 speed auto

interface FastEthernet0/1
 ip address 13.13.13.1 255.255.255.0
 duplex auto
 speed auto

router eigrp 123
 network 12.12.12.1 0.0.0.0
 network 13.13.13.1 0.0.0.0
 no auto-summary
 
-------------------------------------------------
 
R2:
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
 ip ospf network point-to-point

interface FastEthernet0/0
 ip address 12.12.12.2 255.255.255.0
 duplex auto
 speed auto

interface FastEthernet0/1
 ip address 23.23.23.2 255.255.255.0
 duplex auto
 speed auto

router eigrp 123
 network 2.2.2.2 0.0.0.0
 network 12.12.12.2 0.0.0.0
 no auto-summary

router ospf 1
 log-adjacency-changes
 network 2.2.2.2 0.0.0.0 area 0
 network 23.23.23.2 0.0.0.0 area 0
 
------------------------------------------------

R3:
interface Loopback0
 ip address 3.3.3.3 255.255.255.0
 ip ospf network point-to-point

interface FastEthernet0/0
 ip address 13.13.13.3 255.255.255.0
 duplex auto
 speed auto

interface FastEthernet0/1
 ip address 23.23.23.3 255.255.255.0
 duplex auto
 speed auto

router eigrp 123
 network 3.3.3.3 0.0.0.0
 network 13.13.13.3 0.0.0.0
 no auto-summary

router ospf 1
 log-adjacency-changes
 network 3.3.3.3 0.0.0.0 area 0
 network 23.23.23.3 0.0.0.0 area 0
 
配完后,我们看R2的路由表:
R2#sh ip route | in 3.3.3.0
D       3.3.3.0 [90/435200] via 12.12.12.1, 00:05:04, FastEthernet0/0
同样的,R3上:
R3#sh ip route | in 2.2.2.0
D       2.2.2.0 [90/435200] via 13.13.13.1, 00:05:20, FastEthernet0/0
可以很明显地看到两条次优:
R2到达R3的loopback0口选择了EIGRP路由,从R1绕,R3到R2loopback0口也是一样,原因很好分析, 因为EIGRP的内部管理距离90优于OSPF的110
因此解决方案就是改变管理距离:
这里可能有人会过滤,但是过滤了EIGRP的路由就不冗余了。

R2
ip access-list standard R3LOOPBACK
 permit 3.3.3.0 0.0.0.255
router ospf 1
 distance 89 3.3.3.3 0.0.0.0 R3LOOPBACK
 
R3
ip access-list standard R2LOOPBACK
 permit 2.2.2.0 0.0.0.255
router ospf 1
 distance 89 2.2.2.2 0.0.0.0 R2LOOPBACK


配置结束后再看路由表
R2#sh ip route | in 3.3.3.0
O       3.3.3.0 [89/11] via 23.23.23.3, 00:10:24, FastEthernet0/1
R3#sh ip route | in 2.2.2.0
O       2.2.2.0 [89/11] via 23.23.23.2, 00:03:19, FastEthernet0/1