实验拓扑图:
ospf综合案例解析_路由器
实验使用命令
1int e0/0
Ip add
No sh   …………配置接口的IP地址
2router ospf jinchenghao
Network …………配置OSPF路由协议
Redistribute  rip metric 116777241 metric-type 1/2 subnets …………发布RIP路由信息到OSPF
Redistribute  static  metric 116777214 subnets 发布静态路由信息到OSPF
Default-information  originate ……发布默认路由信息
3.地址汇总:
 ABR上: area  区域号  range   ip-add mask
 ASBR:summary-add  ip-add mssk
4.设置NSSA区域:
Area  区域号  nssa(no-summary)
Area  区域号  stub(no-summary)
5.设置辅助地址:
Ip add ip-add mask secondary
6.设置虚链路:必须在两个ABR
Area  区域号(穿越区)  virtual-link 对方routeID
实验步骤
SH1的配置:
ena
conf  t
hostname  sh1
int s1/0
ip add 192.168.224.2 255.255.255.252
no sh
exit
int e0/0
ip add 192.168.248.1 255.255.255.0
no sh
exit
int Loop 1
ip add 100.65.0.1 255.255.0.0
ip add 100.66.0.1 255.255.0.0 secondary
ip add 100.67.0.1 255.255.0.0 secondary
ip add 100.68.0.1 255.255.0.0 secondary
exit
router ospf 1
network 192.168.248.0 0.0.0.255 are 2
network 192.168.224.0 0.0.0.3 are 2
network 100.65.0.0 0.0.255.255 area 2
network 100.66.0.0 0.0.255.255 area 2
network 100.67.0.0 0.0.255.255 area 2
network 100.68.0.0 0.0.255.255 area 2
exit
exit
wri
****************************************************
BJ2的配置:
ena
conf  t
hostname  BJ2
int s1/0
ip ospf priority 0
ip add 192.168.224.1 255.255.255.252
no sh
exit
int e0/0
ip add 192.168.1.3 255.255.255.0
no sh
exit
router ospf 1
network 192.168.1.0 0.0.0.255 are 0
network 192.168.224.0 0.0.0.3 are 2
area 2 rang 100.64.0.0 255.248.0.0
exit
exit
wri
************************************************
BJ1的配置:
ena
conf t
hostname BJ1
int e0/0
ip add 192.168.1.2 255.255.255.0
no sh
exit
int s1/0
ip add 192.168.64.1 255.255.255.252
no sh
exit
int s1/1
ip add 172.16.0.6 255.255.255.252
no sh
exit
router ospf 1
network 192.168.1.0 0.0.0.255 are 0
network 192.168.64.0 0.0.0.3 are 1
are 1 stub no-summary
redistribute static metric 200 metric-type 1 subnets
ip route 172.16.1.0 255.255.255.0 172.16.0.5
exit
wri
*********************************************************
GZ1的配置:
ena
conf t
hostname GZ1
int s1/0
ip add 192.168.64.2 255.255.255.252
no sh
exit
int e0/0
ip add 192.168.72.1 255.255.255.0
no sh
exit
router ospf 1
network 192.168.64.0 0.0.0.3 are 1
network 192.168.72.0 0.0.0.255 are 1
are 1 stub
exit
exit
wri
*******************************************************
ISP配置:
ena
conf t
hostname isp
int s0/0
ip add 172.16.0.5 255.255.255.252
no sh
exit
int loopback 0
ip add 172.16.1.1 255.255.255.0
exit
ip route 192.168.0.0 255.255.0.0 172.16.0.6
exit
wri
**********************************************************
因为是用小凡模拟做的实验,所以PC配置如下:
PC1的配置:
ena
conf t
hostname pc1
int e0/0
ip add 192.168.248.2 255.255.255.0
no sh
exit
no ip routing
ip default-gateway 192.168.248.1
exit
wri
***************************************************
PC2的配置:
ena
conf t
hostname pc2
int e0/0
ip add 192.168.72.2 255.255.255.0
no sh
exit
no ip routing
ip default-gateway 192.168.72.1
exit
wri
**********************************************************
实验验证:(请注意一下重点标记的,这可是关键哦)
pc1#ping 192.168.72.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.72.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 284/345/400 ms
pc1#ping 172.16.1.1 
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 144/220/280 ms
********************************************************
pc2#ping 172.16.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 116/160/200 ms
pc2#ping 192.168.248.2
 Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.248.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 236/327/436 ms
***********************************************************sh1#sh ip route
Gateway of last resort is not set
O IA 192.168.72.0/24 [110/148] via 192.168.224.1, 00:05:16, Serial1/0
     100.0.0.0/16 is subnetted, 4 subnets
C       100.68.0.0 is directly connected, Loopback1
C       100.65.0.0 is directly connected, Loopback1
C       100.66.0.0 is directly connected, Loopback1
C       100.67.0.0 is directly connected, Loopback1
     192.168.224.0/30 is subnetted, 1 subnets
C       192.168.224.0 is directly connected, Serial1/0
     172.16.0.0/24 is subnetted, 1 subnets
O E1    172.16.1.0 [110/274] via 192.168.224.1, 00:05:58, Serial1/0
     192.168.64.0/30 is subnetted, 1 subnets
O IA    192.168.64.0 [110/138] via 192.168.224.1, 00:05:16, Serial1/0
C    192.168.248.0/24 is directly connected, Ethernet0/0
O IA 192.168.1.0/24 [110/74] via 192.168.224.1, 00:05:59, Serial1/0
**********************************************************
BJ2#sh ip route
Gateway of last resort is not set
O IA 192.168.72.0/24 [110/84] via 192.168.1.2, 00:06:21, Ethernet0/0
     100.0.0.0/8 is variably subnetted, 5 subnets, 3 masks
O       100.68.0.0/16 [110/65] via 192.168.224.2, 00:07:49, Serial1/0
O       100.64.0.0/13 is a summary, 00:07:49, Null0
O       100.65.0.1/32 [110/65] via 192.168.224.2, 00:07:49, Serial1/0
O       100.66.0.0/16 [110/65] via 192.168.224.2, 00:07:49, Serial1/0
O       100.67.0.0/16 [110/65] via 192.168.224.2, 00:07:49, Serial1/0
     192.168.224.0/30 is subnetted, 1 subnets
C       192.168.224.0 is directly connected, Serial1/0
     172.16.0.0/24 is subnetted, 1 subnets
O E1    172.16.1.0 [110/210] via 192.168.1.2, 00:06:25, Ethernet0/0
     192.168.64.0/30 is subnetted, 1 subnets
O IA    192.168.64.0 [110/74] via 192.168.1.2, 00:06:21, Ethernet0/0
O    192.168.248.0/24 [110/74] via 192.168.224.2, 00:07:50, Serial1/0
C    192.168.1.0/24 is directly connected, Ethernet0/0
***********************************************************BJ1#sh ip route
Gateway of last resort is not set
O    192.168.72.0/24 [110/74] via 192.168.64.2, 00:07:55, Serial1/0
     100.0.0.0/13 is subnetted, 1 subnets
O IA    100.64.0.0 [110/75] via 192.168.1.3, 00:07:55, Ethernet0/0
     192.168.224.0/30 is subnetted, 1 subnets
O IA    192.168.224.0 [110/74] via 192.168.1.3, 00:07:55, Ethernet0/0
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.0.4/30 is directly connected, Serial1/1
S       172.16.1.0/24 [1/0] via 172.16.0.5
     192.168.64.0/30 is subnetted, 1 subnets
C       192.168.64.0 is directly connected, Serial1/0
O IA 192.168.248.0/24 [110/84] via 192.168.1.3, 00:07:55, Ethernet0/0
C    192.168.1.0/24 is directly connected, Ethernet0/0
**********************************************************
GZ1#sh ip route
Gateway of last resort is 192.168.64.1 to network 0.0.0.0
C    192.168.72.0/24 is directly connected, Ethernet0/0
     192.168.64.0/30 is subnetted, 1 subnets
C       192.168.64.0 is directly connected, Serial1/0
O*IA 0.0.0.0/0 [110/65] via 192.168.64.1, 00:09:05, Serial1/0
*********************************************************
isp#sh ip route
Gateway of last resort is not set
      172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.0.4/30 is directly connected, Serial0/0
C       172.16.1.0/24 is directly connected, Loopback0
S    192.168.0.0/16 [1/0] via 172.16.0.6
***********************************************************