您的位置:首页 > 其它

OSPF点到点多区域的基本配置

2007-11-24 11:10 459 查看
自制系统中所有的路由器标示(RID)都不能相同.
1.给路由配置RID:R1(config-router)#router-id 1.2.3.4 如不配置则默认情况下会按先后顺序自动选择:loopback口IP, Enternet口IP ,Serial口IP作为其RID.

将一个自制系统网络分为三个区域,area 0,area 1,area 2如下图示:
R1(s1/0: 1.0.0.1/24)<----------->R2(s1/0: 1.0.0.2/24)
R1(s1/1: 2.0.0.1/24)<----------->R3(s1/0: 2.0.0.2/24)
R1(e0/0: 192.168.1.1/24)<------->switch1: 192.168.1.0:/24
R2(s1/1: 3.0.0.1/24)<----------->R4(s1/0: 3.0.0.2/24)
R2(e0/0: 192.168.2.1/24)<------->switch2: 192.168.2.0:/24
R3(e0/0: 192.168.2.1/24)<------->switch3: 192.168.3.0:/24



配置步骤:
R1(config)#int e2/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int s1/0
R1(config-if)#ip add 1.0.0.1 255.255.255.0
R1(config-if)#clock rate 6400
R1(config-if)#no sh
R1(config-if)#int s1/1
R1(config-if)#ip add 2.0.0.1 255.255.255.0
R1(config-if)#clock rate 6400
R1(config-if)#no sh
R1(config-if)#int loopback0
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R1(config-router)#network 1.0.0.0 0.0.0.255 area 0
R1(config-router)#network 2.0.0.0 0.0.0.255 area 1
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0
R1(config-router)#end
R1#show ip ospf

R2(config)#int loopback0
R2(config-if)#ip add 2.2.2.2 255.255.255.255
R2(config-if)#int e2/0
R2(config-if)#ip add 192.168.2.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int s1/0
R2(config-if)#ip add 1.0.0.2 255.255.255.0
R2(config-if)#clock rate 6400
%Clockrate bestfitted (rounded) to 6420
R2(config-if)#no sh
R2(config-if)#int s1/1
R2(config-if)#ip add 3.0.0.1 255.255.255.0
R2(config-if)#clock rate 6400
R2(config-if)#no sh
R2(config)#router ospf 1
R2(config-router)#network 1.0.0.0 0.0.0.255 area 0
R2(config-router)#network 3.0.0.0 0.0.0.255 area 2
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0
R2(config-router)#network 192.168.2.0 0.0.0.255 area 0
R2(config-router)#end
R3(config)#int loopback0
R3(config-if)#ip add 3.3.3.3 255.255.255.255
R3(config-if)#int e2/0
R3(config-if)#ip add 192.168.3.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int s1/0
R3(config-if)#ip add 2.0.0.2 255.255.255.0
R3(config-if)#clock rate 6400
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#network 2.0.0.0 0.0.0.255 area 1
R3(config-router)#network 192.168.3.0 0.0.0.255 area 1
R3(config-router)#network 3.3.3.3 0.0.0.0 area 1
R3(config-router)#end

R4(config)#int loopback0
R4(config-if)#ip add 4.4.4.4 255.255.255.255
R4(config-if)#int s1/0
R4(config-if)#ip add 3.0.0.2 255.255.255.0
R4(config-if)#clock rate 6400
%Clockrate bestfitted (rounded) to 6420
R4(config-if)#no sh
R4(config-if)#exit
R4(config)#router ospf 1
R4(config-router)#network 3.0.0.0 0.0.0.255 area 2
R4(config-router)#network 4.4.4.4 0.0.0.0 area 2
R4(config-router)#end

若要给路由间配置安全认证和MD5认证则在路由器的接口下运行
: ip ospf authentication-key password
: ip ospf message-digest-key key-id md5 password

R1#show ip route

Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.1/32 is directly connected, Loopback0
C 1.0.0.0/24 is directly connected, Serial1/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O 2.2.2.2/32 [110/65] via 1.0.0.2, 00:01:26, Serial1/0
C 2.0.0.0/24 is directly connected, Serial1/1
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O 3.3.3.3/32 [110/65] via 2.0.0.2, 00:00:27, Serial1/1
O IA 3.0.0.0/24 [110/128] via 1.0.0.2, 00:00:27, Serial1/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/129] via 1.0.0.2, 00:00:27, Serial1/0
C 192.168.1.0/24 is directly connected, Ethernet2/0
O 192.168.2.0/24 [110/74] via 1.0.0.2, 00:02:47, Serial1/0
O 192.168.3.0/24 [110/74] via 2.0.0.2, 00:00:27, Serial1/1

R2#show ip route

Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O 1.1.1.1/32 [110/65] via 1.0.0.1, 00:04:26, Serial1/0
C 1.0.0.0/24 is directly connected, Serial1/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.2/32 is directly connected, Loopback0
O IA 2.0.0.0/24 [110/128] via 1.0.0.1, 00:03:54, Serial1/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O IA 3.3.3.3/32 [110/129] via 1.0.0.1, 00:01:59, Serial1/0
C 3.0.0.0/24 is directly connected, Serial1/1
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/65] via 3.0.0.2, 00:03:54, Serial1/1
O 192.168.1.0/24 [110/74] via 1.0.0.1, 00:04:26, Serial1/0
C 192.168.2.0/24 is directly connected, Ethernet2/0
R3#show ip route

Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O IA 1.1.1.1/32 [110/65] via 2.0.0.1, 00:02:50, Serial1/0
O IA 1.0.0.0/24 [110/128] via 2.0.0.1, 00:02:50, Serial1/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O IA 2.2.2.2/32 [110/129] via 2.0.0.1, 00:02:50, Serial1/0
C 2.0.0.0/24 is directly connected, Serial1/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.3/32 is directly connected, Loopback0
O IA 3.0.0.0/24 [110/192] via 2.0.0.1, 00:02:50, Serial1/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/193] via 2.0.0.1, 00:02:50, Serial1/0
O IA 192.168.1.0/24 [110/74] via 2.0.0.1, 00:02:51, Serial1/0
C 192.168.3.0/24 is directly connected, Ethernet2/0

R4#show ip route

Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O IA 1.1.1.1/32 [110/129] via 3.0.0.1, 00:05:15, Serial1/0
O IA 1.0.0.0/24 [110/128] via 3.0.0.1, 00:05:15, Serial1/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O IA 2.2.2.2/32 [110/65] via 3.0.0.1, 00:05:15, Serial1/0
O IA 2.0.0.0/24 [110/192] via 3.0.0.1, 00:05:15, Serial1/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O IA 3.3.3.3/32 [110/193] via 3.0.0.1, 00:03:15, Serial1/0
C 3.0.0.0/24 is directly connected, Serial1/0
4.0.0.0/32 is subnetted, 1 subnets
C 4.4.4.4 is directly connected, Loopback0
O IA 192.168.1.0/24 [110/138] via 3.0.0.1, 00:05:16, Serial1/0
O IA 192.168.2.0/24 [110/74] via 3.0.0.1, 00:01:31, Serial1/0
O IA 192.168.3.0/24 [110/202] via 3.0.0.1, 00:05:16, Serial1/0

短秃区域(stub area)不能与外区域通信(如:area 2)但可以与主区域(如:area 0)通信.
当将AREA 1设置成stub(短秃)区域:
R3(config-router)#area 1 stub
R3(config-router)#end
R3#show ip route

Gateway of last resort is not set
2.0.0.0/24 is subnetted, 1 subnets
C 2.0.0.0 is directly connected, Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
C 192.168.3.0/24 is directly connected, Ethernet2/0
R3#ping 2.0.0.1
Sending 5, 100-byte ICMP Echos to 2.0.0.1, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/227/572 ms
R3#ping 2.0.0.2
Sending 5, 100-byte ICMP Echos to 2.0.0.2, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 88/110/160 ms
R3#ping 3.0.0.1
Sending 5, 100-byte ICMP Echos to 3.0.0.1, timeout is 2 seconds:
Success rate is 0 percent (0/5)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息