您的位置:首页 > 其它

思科OSPF地址汇总

2017-11-01 10:49 232 查看
实验环境:4台路由器



R1路由器的配置

R1#
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int e0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config)#int loopback0
R1(config-if)#ip address 200.0.63.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int loopback1
R1(config-if)#ip address 200.0.64.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int loopback2
R1(config-if)#ip address 200.0.65.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int loopback3
R1(config-if)#ip address 200.0.66.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#router rip

R1(config-router)#version 2
R1(config-router)#network 192.168.1.0
R1(config-router)#network 200.0.63.0
R1(config-router)#network 200.0.64.0
R1(config-router)#network 200.0.65.0
R1(config-router)#network 200.0.66.0
R1(config-router)#exit
R1(config)#exit
R1#sh ip int br
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.1.1 YES manual up up
Ethernet0/1 unassigned YES unset administratively down down
Ethernet0/2 unassigned YES unset administratively down down
Ethernet0/3 unassigned YES unset administratively down down
Loopback0 200.0.63.1 YES manual up up
Loopback1 200.0.64.1 YES manual up up
Loopback2 200.0.65.1 YES manual up up
Loopback3 200.0.66.1 YES manual up up
R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C 200.0.64.0/24 is directly connected, Loopback1
C 200.0.65.0/24 is directly connected, Loopback2
C 200.0.66.0/24 is directly connected, Loopback3
172.16.0.0/21 is subnetted, 1 subnets
R 172.16.0.0 [120/1] via 192.168.1.2, 00:00:10, Ethernet0/0
C 200.0.63.0/24 is directly connected, Loopback0
C 192.168.1.0/24 is directly connected, Ethernet0/0
R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:10, Ethernet0/0
R 192.168.3.0/24 [120/1] via 192.168.1.2, 00:00:10, Ethernet0/0
R 200.0.0.0/17 [120/1] via 192.168.1.2, 00:00:11, Ethernet0/0
R1(config)#do sh ip route rip
172.16.0.0/21 is subnetted, 1 subnets
R 172.16.0.0 [120/1] via 192.168.1.2, 00:00:16, Ethernet0/0
R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:16, Ethernet0/0
R 192.168.3.0/24 [120/1] via 192.168.1.2, 00:00:16, Ethernet0/0
R 200.0.0.0/17 [120/1] via 192.168.1.2, 00:00:16, Ethernet0/0

R2路由器的配置
R2#
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int e0/0
R2(config-if)#ip address 192.168.1.2 255.255.255.0

R2(config-if)#no sh
R2(config-if)#int e0/1

R2(config-if)#ip address 192.168.2.1 255.255.255.0

R2(config-if)#no sh
R2(config-if)#exit
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#redistribute ospf 1 metric 1
R2(config-router)#router ospf 1
R2(config-router)#network 192.168.2.0 0.0.0.255 area 0
R2(config-router)#redistribute rip subnets
R2(config-router)#summary-address 200.0.0.0 255.255.128.0
R2(config-router)#exit
R2(config)#do sh ip int br
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.1.2 YES manual up up
Ethernet0/1 192.168.2.1 YES manual up up
Ethernet0/2 unassigned YES unset administratively down down
Ethernet0/3 unassigned YES unset administratively down down
R2(config)#do sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

R 200.0.64.0/24 [120/1] via 192.168.1.1, 00:00:26, Ethernet0/0
R 200.0.65.0/24 [120/1] via 192.168.1.1, 00:00:26, Ethernet0/0
R 200.0.66.0/24 [120/1] via 192.168.1.1, 00:00:26, Ethernet0/0
172.16.0.0/21 is subnetted, 1 subnets
O IA 172.16.0.0 [110/21] via 192.168.2.2, 00:18:50, Ethernet0/1
R 200.0.63.0/24 [120/1] via 192.168.1.1, 00:00:26, Ethernet0/0
C 192.168.1.0/24 is directly connected, Ethernet0/0
C 192.168.2.0/24 is directly connected, Ethernet0/1
O IA 192.168.3.0/24 [110/20] via 192.168.2.2, 00:23:31, Ethernet0/1
O 200.0.0.0/17 is a summary, 00:31:11, Null0
R2(config)#do sh ip route ospf
172.16.0.0/21 is subnetted, 1 subnets
O IA 172.16.0.0 [110/21] via 192.168.2.2, 00:20:00, Ethernet0/1
O IA 192.168.3.0/24 [110/20] via 192.168.2.2, 00:24:40, Ethernet0/1
O 200.0.0.0/17 is a summary, 00:32:20, Null0

R3路由器的配置
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#int e0/0
R3(config-if)#ip address 192.168.2.2 255.255.255.0

R3(config-if)#no sh
R3(config-if)#int e0/1

R3(config-if)#ip address 192.168.3.1 255.255.255.0

R3(config-if)#no sh
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#network 192.168.2.0 0.0.0.255 area 0
R3(config-router)#network 192.168.3.0 0.0.0.255 area 1
R3(config-router)#area 1 range 172.16.0.0 255.255.248.0
R3(config-router)#exit
R3(config)#do sh ip int br
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.2.2 YES manual up up
Ethernet0/1 192.168.3.1 YES manual up up
Ethernet0/2 unassigned YES unset administratively down down
Ethernet0/3 unassigned YES unset administratively down down
R3(config)#do sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
O 172.16.4.1/32 [110/11] via 192.168.3.2, 00:15:18, Ethernet0/1
O 172.16.1.1/32 [110/11] via 192.168.3.2, 00:15:18, Ethernet0/1
O 172.16.0.0/21 is a summary, 00:15:18, Null0
O 172.16.3.1/32 [110/11] via 192.168.3.2, 00:15:18, Ethernet0/1
O 172.16.2.1/32 [110/11] via 192.168.3.2, 00:15:18, Ethernet0/1
O E2 192.168.1.0/24 [110/20] via 192.168.2.1, 00:15:18, Ethernet0/0
C 192.168.2.0/24 is directly connected, Ethernet0/0
C 192.168.3.0/24 is directly connected, Ethernet0/1
O E2 200.0.0.0/17 [110/20] via 192.168.2.1, 00:15:20, Ethernet0/0
R3(config)#do sh ip route ospf
172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
O 172.16.4.1/32 [110/11] via 192.168.3.2, 00:15:30, Ethernet0/1
O 172.16.1.1/32 [110/11] via 192.168.3.2, 00:15:30, Ethernet0/1
O 172.16.0.0/21 is a summary, 00:15:30, Null0
O 172.16.3.1/32 [110/11] via 192.168.3.2, 00:15:30, Ethernet0/1
O 172.16.2.1/32 [110/11] via 192.168.3.2, 00:15:30, Ethernet0/1
O E2 192.168.1.0/24 [110/20] via 192.168.2.1, 00:15:30, Ethernet0/0
O E2 200.0.0.0/17 [110/20] via 192.168.2.1, 00:15:30, Ethernet0/0
R3(config)#

R4路由器的配置
R4#
R4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#int e0/0
R4(config-if)#ip address 192.168.3.2 255.255.255.0

R4(config-if)#no sh
R4(config-if)#int loopback0
R4(config-if)#ip address 172.16.1.1 255.255.255.0
R4(config-if)#no sh
R4(config-if)#int loopback1
R4(config-if)#ip address 172.16.2.1 255.255.255.0
R4(config-if)#no sh
R4(config-if)#int loopback2
R4(config-if)#ip address 172.16.3.1 255.255.255.0
R4(config-if)#no sh
R4(config-if)#int loopback3
R4(config-if)#ip address 172.16.4.1 255.255.255.0

R4(config-if)#no sh
R4(config-if)#exit
R4(config)#router ospf 1
R4(config-router)#network 192.168.3.0 0.0.0.255 area 1

R4(config-router)#network 172.16.1.0 0.0.0.255 area 1
R4(config-router)#network 172.16.2.0 0.0.0.255 area 1
R4(config-router)#network 172.16.3.0 0.0.0.255 area 1
R4(config-router)#network 172.16.4.0 0.0.0.255 area 1
R4(config-router)#exit
R4(config)#do sh ip int br
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.3.2 YES manual up up
Ethernet0/1 unassigned YES unset administratively down down
Ethernet0/2 unassigned YES unset administratively down down
Ethernet0/3 unassigned YES unset administratively down down
Loopback0 172.16.1.1 YES manual up up
Loopback1 172.16.2.1 YES manual up up
Loopback2 172.16.3.1 YES manual up up
Loopback3 172.16.4.1 YES manual up up
R4(config)#do sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 4 subnets
C 172.16.4.0 is directly connected, Loopback3
C 172.16.1.0 is directly connected, Loopback0
C 172.16.2.0 is directly connected, Loopback1
C 172.16.3.0 is directly connected, Loopback2
O E2 192.168.1.0/24 [110/20] via 192.168.3.1, 00:17:52, Ethernet0/0
O IA 192.168.2.0/24 [110/20] via 192.168.3.1, 00:17:52, Ethernet0/0
C 192.168.3.0/24 is directly connected, Ethernet0/0
O E2 200.0.0.0/17 [110/20] via 192.168.3.1, 00:17:52, Ethernet0/0
R4(config)#do sh ip route ospf
O E2 192.168.1.0/24 [110/20] via 192.168.3.1, 00:18:09, Ethernet0/0
O IA 192.168.2.0/24 [110/20] via 192.168.3.1, 00:18:09, Ethernet0/0
O E2 200.0.0.0/17 [110/20] via 192.168.3.1, 00:18:09, Ethernet0/0
R4(config)#
最后用路由器互相ping对方的路由器
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  DY