一.测试拓扑:

ip address 202.100.100.1 255.255.255.0
no shut
ip address 1.1.1.1 255.255.255.255
ip address 202.100.100.2 255.255.255.0
ip address 202.100.1.2 255.255.255.0
ip address 2.2.2.2 255.255.255.255
set interfaces em1 unit 0 family inet address 10.1.1.10/24
no shut
ip address 3.3.3.3 255.255.255.255
PING 1.1.1.1 (1.1.1.1): 56 data bytes
64 bytes from 1.1.1.1: icmp_seq=0 ttl=255 time=51.869 ms
^C
--- 1.1.1.1 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/stddev = 51.869/51.869/51.869/nan ms
set policy-options policy-statement advertis-routers-through-rip term 1 from protocol rip
set policy-options policy-statement advertis-routers-through-rip term 1 then accept
set protocols rip authentication-key cisco
set protocols rip group rip-group neighbor em1.0 authentication-key cisco
version 2
network 10.0.0.0
network 192.168.1.0
key 1
key-string cisco
interface Ethernet0/0
ip rip authentication mode md5
ip rip authentication key-chain rip
inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
3.0.0.0/8 *[RIP/100] 00:09:09, metric 2, tag 0
> to 10.1.1.3 via em1.0
10.1.1.0/24 *[Direct/0] 00:28:05
> via em1.0
10.1.1.10/32 *[Local/0] 00:28:05
Local via em1.0
13.0.0.0/8 *[RIP/100] 00:09:09, metric 2, tag 0
> to 10.1.1.3 via em1.0
202.100.1.0/24 *[Direct/0] 00:28:05
> via em0.0
202.100.1.10/32 *[Local/0] 00:28:05
Local via em0.0
224.0.0.9/32 *[RIP/100] 00:01:10, metric 1
MultiRecv
R 202.100.1.0/24 [120/1] via 10.1.1.10, 00:00:19, Ethernet0/0
五.OSPF动态路由配置:
router-id 1.1.1.1
network 202.100.100.1 0.0.0.0 area 0
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 cisco
router-id 2.2.2.2
area 0 authentication message-digest
network 202.100.1.2 0.0.0.0 area 0
network 202.100.100.2 0.0.0.0 area 0
ip ospf message-digest-key 1 md5 cisco
interface Ethernet0/1
ip ospf message-digest-key 1 md5 cisco
Address Interface State ID Pri Dead
202.100.1.2 em0.0 Full 2.2.2.2 1 32
inet.0: 10 destinations, 10 routes (10 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
1.1.1.1/32 *[OSPF/10] 00:00:04, metric 12
> to 202.100.1.2 via em0.0
202.100.100.0/24 *[OSPF/10] 04:48:10, metric 11
> to 202.100.1.2 via em0.0
224.0.0.5/32 *[OSPF/10] 04:48:22, metric 1
MultiRecv
set policy-options policy-statement into-ospf term rip-to-ospf from route-filter 3.0.0.0/8 exact
set policy-options policy-statement into-ospf term rip-to-ospf then accept
O E2 3.0.0.0/8 [110/2] via 202.100.100.2, 00:07:57, Ethernet0/0
O 202.100.1.0/24 [110/20] via 202.100.100.2, 00:10:49, Ethernet0/0
10.0.0.0/24 is subnetted, 1 subnets
O E2 10.1.1.0 [110/0] via 202.100.100.2, 00:00:04, Ethernet0/0
set policy-options policy-statement into-rip term ospf-to-rip from route-filter 202.100.100.0/24 exact
set policy-options policy-statement into-rip term ospf-to-rip from route-filter 1.1.1.1/32 exact
set policy-options policy-statement into-rip term ospf-to-rip then accept
set policy-options policy-statement into-rip term direct-to-rip from protocol direct
set policy-options policy-statement into-rip term direct-to-rip from route-filter 202.100.1.0/24 exact
set policy-options policy-statement into-rip term direct-to-rip then accept
set policy-options policy-statement into-rip then reject
1.0.0.0/32 is subnetted, 1 subnets
R 1.1.1.1 [120/1] via 10.1.1.10, 00:00:24, Ethernet0/0
R 202.100.100.0/24 [120/1] via 10.1.1.10, 00:00:24, Ethernet0/0
R 202.100.1.0/24 [120/1] via 10.1.1.10, 00:00:24, Ethernet0/0