实验:
为了增加网络带宽以及网络流量的监控 ,本公司设置了俩台专门负责办公和业务的路由器。
要求:
1、全网可达
2、分部办公网络只能走办公路由器,分部业务网络智能走分部路由器。
3、路由器之间采取OSPF的方式进行联通
配置思路:首先我们想,流量要分开走,必须要上策略,前缀列表必须在重发布上完成,所以我们需要俩个进程。在办公路由器和业务路由器上进行重分布的配置。
配置:
R1:
interface LoopBack0
ip address 10.1.1.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 10.1.2.1 255.255.255.0
ospf network-type broadcast
interface GigabitEthernet0/0/0
ip address 10.1.12.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.13.1 255.255.255.0
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
R2:
interface LoopBack0
ip address 10.1.3.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 10.1.4.1 255.255.255.0
ospf network-type broadcast
#
interface GigabitEthernet0/0/0
ip address 10.1.12.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.24.1 255.255.255.0
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 0.0.0.0 255.255.255.255
R3:
interface GigabitEthernet0/0/0
ip address 10.1.13.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.34.1 255.255.255.0
ospf cost 5
#
interface GigabitEthernet0/0/2
ip address 10.1.35.1 255.255.255.0
#
interface GigabitEthernet3/0/0
ip address 10.1.36.1 255.255.255.0
ospf 1 router-id 3.3.3.3
import-route ospf 2 type 1 route-policy f2yw
area 0.0.0.0
network 10.1.13.0 0.0.0.255
network 10.1.34.0 0.0.0.255
#
ospf 2 router-id 3.3.3.3
import-route ospf 1 type 1 route-policy zyw
area 0.0.0.1
network 10.1.35.0 0.0.0.255
network 10.1.36.0 0.0.0.255
ip ip-prefix f2yw index 10 permit 10.2.2.0 24
ip ip-prefix zyw index 10 permit 10.1.2.0 24
ip ip-prefix zyw index 20 permit 10.1.4.0 24
ip ip-prefix f3yw index 10 permit 10.3.1.0 24
#
route-policy zyw permit node 10
if-match ip-prefix zyw
apply cost 5
apply cost-type type-1
route-policy zyw permit node 20
#
route-policy f2yw permit node 10
if-match ip-prefix f2yw
apply cost 5
apply cost-type type-1
route-policy f2yw permit node 20
#
route-policy f3yw permit node 10
if-match ip-prefix f3yw
apply cost 5
apply cost-type type-1
route-policy f3yw permit node 20
R4:
interface GigabitEthernet0/0/0
ip address 10.1.24.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.34.2 255.255.255.0
ospf cost 5
#
interface GigabitEthernet0/0/2
ip address 10.1.45.1 255.255.255.0
#
interface GigabitEthernet4/0/0
ip address 10.1.47.1 255.255.255.0
ospf 1 router-id 4.4.4.4
import-route ospf 2 type 1 route-policy f2bg
area 0.0.0.0
network 10.1.24.0 0.0.0.255
network 10.1.34.0 0.0.0.255
#
ospf 2 router-id 4.4.4.4
import-route ospf 1 type 1 route-policy zbg
area 0.0.0.0
area 0.0.0.1
network 10.1.45.0 0.0.0.255
network 10.1.47.0 0.0.0.255
#
ip ip-prefix zbg index 10 permit 10.1.3.0 24
ip ip-prefix zbg index 20 permit 10.1.1.0 24
ip ip-prefix f2bg index 10 permit 10.2.2.0 24
ip ip-prefix f3bg index 10 permit 10.3.1.0 24
route-policy zbg permit node 10
if-match ip-prefix zbg
apply cost 5
apply cost-type type-1
route-policy zbg permit node 20
#
route-policy f2bg permit node 10
if-match ip-prefix f2bg
apply cost 5
apply cost-type type-1
route-policy f2bg permit node 20
#
route-policy f3bg permit node 10
if-match ip-prefix f3bg
apply cost 5
apply cost-type type-1
route-policy f3bg permit node 20
R5:
interface LoopBack0
ip address 10.2.1.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 10.2.2.1 255.255.255.0
ospf network-type broadcast
interface GigabitEthernet0/0/0
ip address 10.1.35.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.45.2 255.255.255.0
#
ospf 2 router-id 5.5.5.5
area 0.0.0.1
network 0.0.0.0 255.255.255.255
R6:
interface LoopBack0
ip address 10.3.1.1 255.255.255.0
ospf network-type broadcast
#
interface GigabitEthernet0/0/0
ip address 10.1.36.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.67.1 255.255.255.0
#
ospf 2 router-id 6.6.6.6
area 0.0.0.1
network 0.0.0.0 255.255.255.255
R7:
interface LoopBack0
ip address 10.3.2.1 255.255.255.0
ospf network-type broadcast
#
interface GigabitEthernet0/0/0
ip address 10.1.47.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.67.2 255.255.255.0
#
ospf 2 router-id 7.7.7.7
area 0.0.0.1
network 0.0.0.0 255.255.255.255
配置完成我们测试 先看R5 R6 R7 的路由表:
下一跳都没有问题我们在追踪一下流量
在R5上:
R6:
R7:
注:如果分部之间不相互通信的话 我们再起一个进程 来完成!