Dynamic routing protocol OSPF advanced configuration
Route Redistribution Configuration
A route redistribution configuration commands:
Router(config-router)#redistribute protocol metric metric-value metric-type type-value subnets
Second re-routing distributed configuration example:
RIP and OSPF protocol agreement
router rip //在rip协议中注入ospf协议
redistribute ospf metric 10 //metric为度量值,这里标准为跳数
router ospf 1 //在ospf协议中注入rip协议
redistribute rip metric 200 subnets //度量值为带宽
OSPF redistribution of static routes
router ospf 1
redistribute static metric 100 subnets metric-type2
OSPF default route redistribution
router ospf 1
network 192.168.0.0 0.0.0.255 area 0
default-information originate metric 10 netric-type 1
ip route 0.0.0.0 0.0.0.0 10.0.1.1
Establishment of experimental topology and complete the advance preparation
Test environment preparation: GNS3 6 router, four PC,
Open GNS3
1, to complete the connection between the topology of FIG route (note: R3 right click and select routes need configure, add two NM-1FE-TX Slots in the working board.)
2, the route R6 cloud cloud modify the icon style pattern, where the route R6 analog mobile ISP.
3, the respective device is connected and turned on.
The official start of the experiment
Step: configure the routing device according to the port topology
R1
R1#configure terminal //进入全局模式
R1(config)#interface fastEthernet 0/0 //进入f0/0接口
R1(config-if)#ip address 192.168.10.1 255.255.255.0 //设置IP地址与子网掩码
R1(config-if)#no shut
R1(config-if)#interface fastEthernet 0/1
R1(config-if)#ip address 128.10.0.10 255.255.0.0
R1(config-if)#no shut
R1(config-if)#exit //退回全局模式
R1(config)#ip route 0.0.0.0 0.0.0.0 128.10.0.20 //创建默认路由(128.10.0.20为下一跳地址)
R2
R2#configure terminal //进入全局模式
R2(config)#interface fastEthernet 0/0 //进入f0/0接口
R2(config-if)#ip address 128.10.0.20 255.255.0.0 //设置IP地址与子网掩码
R2(config-if)#no shut
R2(config-if)#interface fastEthernet 0/1
R2(config-if)#ip address 128.20.0.10 255.255.0.0
R2(config-if)#no shut
R2(config-if)#exit //退回全局模式
R2(config)#ip route 192.168.10.0 255.255.255.0 128.10.0.10 //创建静态路由
R2(config)#router ospf 1 //进入OSPF协议1号进程
R2(config-router)#router-id 2.2.2.2 //指定Router ID
R2(config-router)#network 128.20.0.0 0.0.255.255 area 1 //宣告自身网段
R2(config-router)#redistribute connected subnets //将直连网段注入OSPF中
R2(config-router)#redistribute static subnets //将非直连网段注入OSPF中
R2(config-router)#ex
R3
R3#configure terminal //进入全局模式
R3(config)#interface fastEthernet 0/0 //进入f0/0接口
R3(config-if)#ip address 128.20.0.20 255.255.0.0 //设置IP地址与子网掩码
R3(config-if)#no shut
R3(config-if)#interface fastEthernet 0/1
R3(config-if)#ip address 128.30.0.10 255.255.0.0
R3(config-if)#no shut
R3(config-if)#interface fastEthernet 1/0
R3(config-if)#ip address 12.0.0.2 255.0.0.0
R3(config-if)#no shut
R3(config-if)#interface fastEthernet 2/0
R3(config-if)#ip address 192.168.20.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit //退回全局模式
R3(config)#ip route 192.168.30.0 255.255.255.0 12.0.0.10 //创建静态路由
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 128.20.0.0 0.0.255.255 area 1 //在area1中宣告自身网段
R3(config-router)#network 128.30.0.0 0.0.255.255 area 0 //在area0中宣告自身网段
R3(config-router)#network 192.168.20.0 0.0.0.255 area 1 //在area1中宣告自身网段
R3(config-router)#redi con sub //将直连网段注入OSPF中
R3(config-router)#redi static sub //将非直连网段注入OSPF中
R3(config-router)#ex
R4
R4#configure terminal //进入全局模式
R4(config)#int f 0/1 //进入f0/0接口
R4(config-if)#ip add 128.30.0.20 255.255.0.0 //设置IP地址与子网掩码
R4(config-if)#no shut
R4(config-if)#int f0/0
R4(config-if)#ip add 128.40.0.10 255.255.0.0
R4(config-if)#no shut
R4(config-if)#ex
R4(config)#router rip //建立RIP协议
R4(config-router)#version 2 //选择版本2
R4(config-router)#no auto-summary //关闭子网汇总功能
R4(config-router)#network 128.40.0.0 //宣告自身网段
R4(config-router)#redi ospf 1 metric 5 //将ospf进行注入
R4(config-router)#ex
R4(config)#router ospf 1
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 128.30.0.0 0.0.255.255 area 0
R4(config-router)#redi rip sub //将rip进行注入
R4(config-router)#ex
R5
R5#conf t
R5(config)#int f 0/1
R5(config-if)#ip add 128.40.0.20 255.255.0.0
R5(config-if)#no shut
R5(config-if)#int f 0/0
R5(config-if)#ip add 192.168.40.1 255.255.255.0
R5(config-if)#no shut
R5(config-if)#ex
R5(config)#router rip
R5(config-router)#ver 2
R5(config-router)#no auto-summ
R5(config-router)#network 128.40.0.0
R5(config-router)#network 192.168.40.0
R5(config-router)#ex
R6
R6#conf t
R6(config)#int f 0/0
R6(config-if)#ip add 12.0.0.10 255.0.0.0
R6(config-if)#no shut
R6(config-if)#int f 0/1
R6(config-if)#iP add 192.168.30.1 255.255.255.0
R6(config-if)#no shut
R6(config-if)#ex
R6(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2
R6(config)#end
The above is all routes of the setup process. Here if we set up an IP address for the PC, you can complete the whole network interoperability.
Step two: Add the IP for the PC
Embodiment the steps of:
PC1
PC1>
PC1> ip 192.168.20.3 192.168.20.1
Checking for duplicate address...
PC1 : 192.168.20.3 255.255.255.0 gateway 192.168.20.1
PC1>
PC2
PC2>
PC2> ip 192.168.10.10 192.168.10.1
Checking for duplicate address...
PC1 : 192.168.10.10 255.255.255.0 gateway 192.168.10.1
PC2>
PC3
PC3>
PC3> ip 192.168.40.10 192.168.40.1
Checking for duplicate address...
PC1 : 192.168.40.10 255.255.255.0 gateway 192.168.40.1
PC3>
No. 4 PC machine
4号PC机>
4号PC机> ip 192.168.30.10 192.168.30.1
Checking for duplicate address...
PC1 : 192.168.30.10 255.255.255.0 gateway 192.168.30.1
4号PC>
Step 3: Check each learning dynamic routing
View command: Rn (n = 2 ~ 5) #show ip route
Note: Only run dynamic routing protocols available for learning! ! Thus, R1, and R6 two routes in the routing table is not possible to include other network segments
Step 4: Check the whole network interoperability
Check command (PC machine): ping IP address