实验使用的工具:小凡模拟器
一、配置各个路由器接口 IP ,宣告网段,查看。
R1
Router>
Router>enable
Router#config terminal
Router(config)#hostname R1-jin
R1-jin(config)#interface loopback 0
R1-jin(config-if)#ip address 1.1.1.1 255.255.255.255
R1-jin(config-if)#interface f0/0
R1-jin(config-if)#ip address 192.168.1.1 255.255.255.224
R1-jin(config-if)#no shutdown
R1-jin(config-if)#interface f1/0
R1-jin(config-if)#ip address 192.168.1.34 255.255.255.224
R1-jin(config-if)#no shutdown
R1-jin(config-if)#exit
R1-jin(config)#router ospf 1
R1-jin(config-router)#network 192.168.1.1 0.0.0.0 area 1
R1-jin(config-router)#network 192.168.1.34 0.0.0.0 area 1
R1-jin(config-router)#end
R1-jin#
R1-jin#show ip route
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
O IA 10.0.0.0/8 [110/2] via 192.168.1.33, 00:02:02, FastEthernet1/0
192.168.1.0/27 is subnetted, 2 subnets
C 192.168.1.32 is directly connected, FastEthernet1/0
C 192.168.1.0 is directly connected, FastEthernet0/0
192.168.2.0/27 is subnetted, 2 subnets
O IA 192.168.2.32 [110/3] via 192.168.1.33, 00:00:01, FastEthernet1/0
O IA 192.168.2.0 [110/4] via 192.168.1.33, 00:00:01, FastEthernet1/0
R1-jin#
R2Router>
Router>enable
Router#config terminal
Router(config)#hostname R2-jin
R2-jin(config)#interface loopback 0
R2-jin(config-if)#ip address 2.2.2.2 255.255.255.255
R2-jin(config-if)#interface f1/0
R2-jin(config-if)#ip address 192.168.1.33 255.255.255.224
R2-jin(config-if)#no shutdown
R2-jin(config-if)#interface f0/0
R2-jin(config-if)#ip address 10.0.0.1 255.0.0.0
R2-jin(config-if)#no shutdown
R2-jin(config-if)#exit
R2-jin(config)#router ospf 1
R2-jin(config-router)#network 192.168.1.33 0.0.0.0 area 1
R2-jin(config-router)#network 10.0.0.1 0.0.0.0 area 0
R2-jin(config-router)#end
R2-jin#
R2-jin#show ip route
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
C 10.0.0.0/8 is directly connected, FastEthernet0/0
192.168.1.0/27 is subnetted, 2 subnets
C 192.168.1.32 is directly connected, FastEthernet1/0
O 192.168.1.0 [110/2] via 192.168.1.34, 00:04:19, FastEthernet1/0
192.168.2.0/27 is subnetted, 2 subnets
O IA 192.168.2.32 [110/2] via 10.0.0.2, 00:00:13, FastEthernet0/0
O IA 192.168.2.0 [110/3] via 10.0.0.2, 00:00:08, FastEthernet0/0
R2-jin#
R3
Router>
Router>enable
Router#config terminal
Router(config)#hostname R3-jin
R3-jin(config)#interface loopback 0
R3-jin(config-if)#ip address 3.3.3.3 255.255.255.255
R3-jin(config-if)#interface f0/0
R3-jin(config-if)#ip address 10.0.0.2 255.0.0.0
R3-jin(config-if)#no shutdown
R3-jin(config-if)#interface f1/0
R3-jin(config-if)#ip address 192.168.2.33 255.255.255.224
R3-jin(config-if)#no shutdown
R3-jin(config-if)#exit
R3-jin(config)#router ospf 1
R3-jin(config-router)#network 192.168.2.33 0.0.0.0 area 2
R3-jin(config-router)#network 10.0.0.2 0.0.0.0 area 0
R3-jin(config-router)#end
R3-jin#
R3-jin#show ip route
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
C 10.0.0.0/8 is directly connected, FastEthernet0/0
192.168.1.0/27 is subnetted, 2 subnets
O IA 192.168.1.32 [110/2] via 10.0.0.1, 00:00:16, FastEthernet0/0
O IA 192.168.1.0 [110/3] via 10.0.0.1, 00:00:16, FastEthernet0/0
192.168.2.0/27 is subnetted, 2 subnets
C 192.168.2.32 is directly connected, FastEthernet1/0
O 192.168.2.0 [110/2] via 192.168.2.34, 00:00:16, FastEthernet1/0
R3-jin#
R4
Router>
Router>enable
Router#config terminal
Router(config)#hostname R4-jin
R4-jin(config)#interface loopback 0
R4-jin(config-if)#ip address 4.4.4.4 255.255.255.255
R4-jin(config-if)#interface f1/0
R4-jin(config-if)#ip address 192.168.2.34 255.255.255.224
R4-jin(config-if)#no shutdown
R4-jin(config-if)#interface f0/0
R4-jin(config-if)#ip address 192.168.2.1 255.255.255.224
R4-jin(config-if)#no shutdown
R4-jin(config-if)#exit
R4-jin(config)#router ospf 1
R4-jin(config-router)#network 192.168.2.34 0.0.0.0 area 2
R4-jin(config-router)#network 192.168.2.1 0.0.0.0 area 2
R4-jin(config-router)#end
R4-jin#
R4-jin#show ip route
4.0.0.0/32 is subnetted, 1 subnets
C 4.4.4.4 is directly connected, Loopback0
O IA 10.0.0.0/8 [110/2] via 192.168.2.33, 00:00:24, FastEthernet1/0
192.168.1.0/27 is subnetted, 2 subnets
O IA 192.168.1.32 [110/3] via 192.168.2.33, 00:00:24, FastEthernet1/0
O IA 192.168.1.0 [110/4] via 192.168.2.33, 00:00:24, FastEthernet1/0
192.168.2.0/27 is subnetted, 2 subnets
C 192.168.2.32 is directly connected, FastEthernet1/0
C 192.168.2.0 is directly connected, FastEthernet0/0
R4-jin#
二、在R2和R3上配置路由汇总,并查看路由表的变化
R2
R2-jin#
R2-jin#config terminal
R2-jin(config)#router ospf 1
R2-jin(config-router)#area 1 range 192.168.1.0 255.255.255.0
R2-jin(config-router)#end
R2-jin#
R2-jin#show ip route
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
C 10.0.0.0/8 is directly connected, FastEthernet0/0
192.168.1.0/24 is variably subnetted, 3 subnets, 2 masks
C 192.168.1.32/27 is directly connected, FastEthernet1/0
O 192.168.1.0/27 [110/2] via 192.168.1.34, 00:00:52, FastEthernet1/0
O 192.168.1.0/24 is a summary, 00:00:52, Null0
O IA 192.168.2.0/24 [110/2] via 10.0.0.2, 00:00:19, FastEthernet0/0
R2-jin#
R3
R3-jin#
R3-jin#config terminal
R3-jin(config)#router ospf 1
R3-jin(config-router)#area 2 range 192.168.2.0 255.255.255.0
R3-jin(config-router)#end
R3-jin#
R3-jin#show ip route
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
C 10.0.0.0/8 is directly connected, FastEthernet0/0
O IA 192.168.1.0/24 [110/2] via 10.0.0.1, 00:00:31, FastEthernet0/0
192.168.2.0/24 is variably subnetted, 3 subnets, 2 masks
C 192.168.2.32/27 is directly connected, FastEthernet1/0
O 192.168.2.0/27 [110/2] via 192.168.2.34, 00:00:31, FastEthernet1/0
O 192.168.2.0/24 is a summary, 00:00:31, Null0
R3-jin#
R1
R1-jin#
R1-jin#show ip route
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
O IA 10.0.0.0/8 [110/2] via 192.168.1.33, 00:03:43, FastEthernet1/0
192.168.1.0/27 is subnetted, 2 subnets
C 192.168.1.32 is directly connected, FastEthernet1/0
C 192.168.1.0 is directly connected, FastEthernet0/0
O IA 192.168.2.0/24 [110/3] via 192.168.1.33, 00:00:07, FastEthernet1/0 ――区域2中各子网汇总成一条2.0主网段
R1-jin#
R4
R4-jin#
R4-jin#show ip route
4.0.0.0/32 is subnetted, 1 subnets
C 4.4.4.4 is directly connected, Loopback0
O IA 10.0.0.0/8 [110/2] via 192.168.2.33, 00:02:11, FastEthernet1/0
O IA 192.168.1.0/24 [110/3] via 192.168.2.33, 00:01:07, FastEthernet1/0 ――区域1中各子网汇总成一条1.0主网段
192.168.2.0/27 is subnetted, 2 subnets
C 192.168.2.32 is directly connected, FastEthernet1/0
C 192.168.2.0 is directly connected, FastEthernet0/0
R4-jin#
三、配置PC,实现全网通信
VPCS 1 >
VPCS 1 >show
VPCS 1 >ip 192.168.1.2 192.168.1.1 27
VPCS 1 >2
VPCS 2 >ip 192.168.2.2 192.168.2.1 27
VPCS 2 >show
NAME IP/CIDR GATEWAY LPORT RPORT
PC1 192.168.1.2/27 192.168.1.1 10001 11100
PC2 192.168.2.2/27 192.168.2.1 10002 11400
PC3 0.0.0.0/0 0.0.0.0 10003 30002
PC4 0.0.0.0/0 0.0.0.0 10004 30003
PC5 0.0.0.0/0 0.0.0.0 10005 30004
PC6 0.0.0.0/0 0.0.0.0 10006 30005
PC7 0.0.0.0/0 0.0.0.0 10007 30006
PC8 0.0.0.0/0 0.0.0.0 10008 30007
PC9 0.0.0.0/0 0.0.0.0 10009 30008
VPCS 2 >ping 192.168.1.2
192.168.1.2 icmp_seq=1 timeout
192.168.1.2 icmp_seq=2 time=203.000 ms
192.168.1.2 icmp_seq=3 time=156.000 ms
192.168.1.2 icmp_seq=4 time=172.000 ms
192.168.1.2 icmp_seq=5 time=219.000 ms