实验拓扑图:

 

OSPF-hub and spoke配置(三)_第1张图片

实验过程

1.       FRSW的配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host FRSW

FRSW(config)#frame-relay switching

FRSW(config)#int s0/0

FRSW(config-if)#no shut

FRSW(config-if)#encapsulation frame-relay

FRSW(config-if)#frame-relay intf-type dce

FRSW(config-if)#frame-relay lmi-type cisco

FRSW(config-if)#frame-relay route 102 interface s0/1 201

FRSW(config-if)#frame-relay route 103 interface s0/2 301

FRSW(config)#interface s0/1

FRSW(config-if)#no shut

FRSW(config-if)#encapsulation frame-relay

FRSW(config-if)#frame-relay intf-type dce

FRSW(config-if)#frame-relay lmi-type cisco

FRSW(config-if)#frame-relay route 201 interface s0/0 102

FRSW(config-if)#exit

FRSW(config)#interface s0/2

FRSW(config-if)#no sh

FRSW(config-if)#encapsulation frame-relay

FRSW(config-if)#frame-relay intf-type dce

FRSW(config-if)#frame-relay lmi-type cisco

FRSW(config-if)#frame-relay route 301 interface s0/0 103

FRSW(config-if)#end

2.R1的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R1

R1(config)#interface lo0

R1(config-if)#ip add 1.1.1.1 255.255.255.0

R1(config)#exit

R1(config)#interface s0/0

R1(config-if)#no shut

R1(config-if)#encapsulation frame-relay

R1(config-if)#no frame-relay inverse-arp

R1(config-if)#exit

R1(config)#interface s0/0.1 point-to-point

R1(config-subif)#ip add 172.16.0.1 255.255.255.0

R1(config-subif)#frame-relay interface-dlci 102

R1(config-fr-dlci)#exit

R1(config-subif)#exit

R1(config)#interface s0/0.2 point-to-point

R1(config-subif)#ip add 192.168.0.1 255.255.255.0

R1(config-subif)#frame-relay interface-dlci 103

R1(config-fr-dlci)#exit

R1(config-subif)#end

 

3.R2的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R2

R1(config)#interface lo0

R1(config-if)#ip add 2.2.2.2  255.255.255.0

R1(config)#exit

R2(config)#interface s0/1

R2(config-if)#no shut

R2(config-if)#encapsulation frame-relay

R2(config-if)#no frame-relay inverse-arp

R2(config-if)#ip add 172.16.0.2 255.255.255.0

R2(config-if)#frame-relay map ip 172.16.0.1 201 broadcast

R2(config-if)#end

4.R3的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R3

R3(config)#interface lo0

R3(config-if)#ip add 3.3.3.3 255.255.255.0

R3(config-if)#exit

R3(config)#interface s0/2

R3(config-if)#no shut

R3(config-if)#encapsulation frame-relay

R3(config-if)#no frame-relay inverse-arp

R3(config-if)#ip add 192.168.0.3 255.255.255.0

R3(config-if)#frame-relay map ip 192.168.0.1 301 broadcast

R3(config-if)#end

5.查看帧中继map

R1#show frame-relay map

Serial0/0.2 (up): point-to-point dlci, dlci 103(0x67,0x1870), broadcast

          status defined, active

Serial0/0.1 (up): point-to-point dlci, dlci 102(0x66,0x1860), broadcast

          status defined, active

R2#show frame-relay map

Serial0/1 (up): ip 172.16.0.1 dlci 201(0xC9,0x3090), static,

              broadcast,

              CISCO, status defined, active

6.测试连通性

R1#ping 192.168.0.2

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.0.2, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 28/64/112 ms

R1#ping 172.16.0.2

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.16.0.2, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 12/41/100 ms

7.配置R1OSPF

R1#config t

Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)#router ospf 1

R1(config-router)#net 192.168.0.1 0.0.0.0 area 0

R1(config-router)#net 172.16.0.1 0.0.0.0 area 0

R1(config-router)#net 1.1.1.1 0.0.0.0 area 0

R1(config-router)#exit

R1(config)#int s0/0.1 //进入子接口

R1(config-subif)#ip ospf network point-to-point //指定接口网络类型为点到点

R1(config-subif)#exit

R1(config)#int s0/0.2

R1(config-subif)#ip ospf network point-to-point

R1(config-subif)#exit

8.配置R2OSPF

R2#config t

Enter configuration commands, one per line.  End with CNTL/Z.

R2(config)#router ospf 1

R2(config-router)#net 172.16.0.2 0.0.0.0 area 0

R2(config-router)#net 2.2.2.2 0.0.0.0 area 0

R2(config-router)#exit

R2(config)#int s0/1

R2(config-if)#ip ospf network point-to-point

R2(config-if)#end

9.配置R3OSPF

R3#config t

Enter configuration commands, one per line.  End with CNTL/Z.

R3(config)#router ospf 1

R3(config-router)#net 192.168.0.2 0.0.0.0 area 0

R3(config-router)#net 3.3.3.3 0.0.0.0 area 0

R3(config-router)#exit

R3(config)#int s0/2

R3(config-if)#ip ospf network point-to-point

R3(config-if)#end

10.查看OSPF的邻居表

R1#show ip ospf nei

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

2.2.2.2           0   FULL/  -        00:00:37    172.16.0.2      Serial0/0.1

3.3.3.3           0   FULL/  -        00:00:36    192.168.0.2     Serial0/0.2

R2#show ip ospf nei

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

1.1.1.1           0   FULL/  -        00:00:32    172.16.0.1      Serial0/1

说明:对于帧中继的点到点自接口网络类型,OSPF不需要选举DRBDR,同时点到点支持广播,不需要手动指定邻居。

 

11.查看路由表

R1#show ip route ospf

     2.0.0.0/32 is subnetted, 1 subnets

O       2.2.2.2 [110/65] via 172.16.0.2, 00:10:23, Serial0/0.1

     3.0.0.0/32 is subnetted, 1 subnets

O       3.3.3.3 [110/65] via 192.168.0.2, 00:10:23, Serial0/0.2

R2#show ip route ospf

     1.0.0.0/32 is subnetted, 1 subnets

O       1.1.1.1 [110/65] via 172.16.0.1, 00:11:02, Serial0/1

     3.0.0.0/32 is subnetted, 1 subnets

O       3.3.3.3 [110/129] via 172.16.0.1, 00:11:02, Serial0/1

O    192.168.0.0/24 [110/128] via 172.16.0.1, 00:11:02, Serial0/1

12.测试连通性

R2#ping 1.1.1.1 source 2.2.2.2

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:

Packet sent with a source address of 2.2.2.2

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 12/40/80 ms

R2#ping 3.3.3.3 source 2.2.2.2

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:

Packet sent with a source address of 2.2.2.2

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 32/96/172 ms