用ensp,有五个路由器,左边有两个用于实现rip,右边有两个是ospf的area1, 中间路由器是ospf的area0,并且路由器相连的用192.168.10.0/24划分网段,实现路由的重分布,实现全网通讯写出命令
时间: 2024-03-09 22:50:46 浏览: 86
以下是在eNSP中配置实现全网通信的命令:
1. 配置左边两个路由器的RIP协议:
```
<R1> system-view
[R1] ospf 1 router-id 1.1.1.1
[R1-ospf-1] area 0
[R1-ospf-1-area-0.0.0.0] network 192.168.10.0 0.0.0.127
[R1-ospf-1-area-0.0.0.0] quit
[R1] rip 1
[R1-rip-1] network 192.168.10.0
[R1-rip-1] network 192.168.10.128
[R1-rip-1] quit
<R2> system-view
[R2] ospf 1 router-id 2.2.2.2
[R2-ospf-1] area 0
[R2-ospf-1-area-0.0.0.0] network 192.168.10.0 0.0.0.127
[R2-ospf-1-area-0.0.0.0] quit
[R2] rip 1
[R2-rip-1] network 192.168.10.0
[R2-rip-1] network 192.168.10.128
[R2-rip-1] quit
```
2. 配置右边两个路由器的OSPF协议:
```
<R4> system-view
[R4] ospf 1 router-id 4.4.4.4
[R4-ospf-1] area 1
[R4-ospf-1-area-1.0.0.0] network 192.168.10.128 0.0.0.127
[R4-ospf-1-area-1.0.0.0] quit
<R5> system-view
[R5] ospf 1 router-id 5.5.5.5
[R5-ospf-1] area 1
[R5-ospf-1-area-1.0.0.0] network 192.168.10.128 0.0.0.127
[R5-ospf-1-area-1.0.0.0] quit
```
3. 配置中间路由器的OSPF协议,并将左右两边的网络地址进行区分:
```
<R3> system-view
[R3] ospf 1 router-id 3.3.3.3
[R3-ospf-1] area 0
[R3-ospf-1-area-0.0.0.0] network 192.168.10.0 0.0.0.127
[R3-ospf-1-area-0.0.0.0] quit
[R3-ospf-1] area 1
[R3-ospf-1-area-1.0.0.0] network 192.168.10.128 0.0.0.127
[R3-ospf-1-area-1.0.0.0] quit
[R3] redistribute rip to ospf 1
[R3] route-policy RIP-TO-OSPF permit node
[R3-route-policy-RIP-TO-OSPF] if-match ip-prefix 1
[R3-route-policy-RIP-TO-OSPF] apply cost 10
[R3-route-policy-RIP-TO-OSPF] quit
[R3] route-policy OSPF-TO-RIP permit node
[R3-route-policy-OSPF-TO-RIP] if-match ip-prefix 2
[R3-route-policy-OSPF-TO-RIP] apply cost 10
[R3-route-policy-OSPF-TO-RIP] quit
[R3] ip ip-prefix 1 permit 192.168.10.128 25
[R3] ip ip-prefix 2 permit 192.168.10.0 25
```
4. 配置左右两边的路由器的路由策略,使得左右两边的路由器可以相互访问对方的网络:
左边路由器配置策略:
```
<R1> system-view
[R1] route-policy RIP-TO-OSPF permit node
[R1-route-policy-RIP-TO-OSPF] if-match ip-prefix 2
[R1-route-policy-RIP-TO-OSPF] apply cost 10
[R1-route-policy-RIP-TO-OSPF] quit
[R1] ip ip-prefix 2 permit 192.168.10.0 25
<R2> system-view
[R2] route-policy RIP-TO-OSPF permit node
[R2-route-policy-RIP-TO-OSPF] if-match ip-prefix 2
[R2-route-policy-RIP-TO-OSPF] apply cost 10
[R2-route-policy-RIP-TO-OSPF] quit
[R2] ip ip-prefix 2 permit 192.168.10.0 25
```
右边路由器配置策略:
```
<R4> system-view
[R4] route-policy OSPF-TO-RIP permit node
[R4-route-policy-OSPF-TO-RIP] if-match ip-prefix 1
[R4-route-policy-OSPF-TO-RIP] apply cost 10
[R4-route-policy-OSPF-TO-RIP] quit
[R4] ip ip-prefix 1 permit 192.168.10.128 25
<R5> system-view
[R5] route-policy OSPF-TO-RIP permit node
[R5-route-policy-OSPF-TO-RIP] if-match ip-prefix 1
[R5-route-policy-OSPF-TO-RIP] apply cost 10
[R5-route-policy-OSPF-TO-RIP] quit
[R5] ip ip-prefix 1 permit 192.168.10.128 25
```
通过以上配置,五个路由器之间的网络可以相互通信。
阅读全文