OSPF-hub and spoke配置(一)

实验拓扑图

 

实验过程

1.帧中继交换机的预配置

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-if)#exit

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 ciscoFRSW(config-if)#frame

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

FRSW(config-if)#exit

FRSW(config)#interface s0/2

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 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)#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)#ip add 192.168.0.1 255.255.255.0

R1(config-if)#frame-relay map ip 192.168.0.2 102 broadcast

R1(config-if)#frame-relay map ip 192.168.0.3 103 broadcast

R1(config-if)#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

R2(config)#interface lo0

R2(config-if)#ip add 2.2.2.2 255.255.255.0

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 192.168.0.2 255.255.255.0

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

R2(config-if)#frame-relay map ip 192.168.0.3 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-if)#ip add 3.3.3.3 255.255.255.0

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)#frame-relay map ip 192.168.0.2 301 broadcast

R3(config-if)#end

5.测试R1R2R3的连通性

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 = 16/40/88 ms

R1#ping 192.168.0.3

 

Type escape sequence to abort.

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

!!!!!

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

R2#ping 192.168.0.1

 

Type escape sequence to abort.

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

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 8/55/92 ms

R2#ping 192.168.0.3

 

Type escape sequence to abort.

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

!!!!!

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

 

6.配置R1OSPF

R1(config)#router ospf 1

R1(config-router)#network 1.1.1.1 0.0.0.0 area 0  //宣告直连的网段

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

R1(config-router)#neighbor 192.168.0.2  //NBMA网络需要手动指定邻居

R1(config-router)#neighbor 192.168.0.3

R1(config-router)#end

7.配置R2OSPF

R2(config)#interface s0/1

R2(config-if)#ip ospf priority 0  //s0/1接口优先级改为0,使接口不参与DRBDR选举

R2(config-if)#exit

R2(config)#router ospf 1

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

R2(config-router)#network 192.168.0.2 0.0.0.0 area 0

R2(config-router)#end

8.配置R3OSPF

R3(config)#interface s0/2

R3(config-if)#ip ospf priority 0

R3(config-if)#exit

R3(config)#router ospf 1

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

R3(config-router)#network 192.168.0.3 0.0.0.0 area 0

R3(config-router)#end

9.查看OSPF邻居表

R1#show ip ospf nei

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

2.2.2.2           0   FULL/DROTHER    00:01:47    192.168.0.2     Serial0/0

3.3.3.3           0   FULL/DROTHER    00:01:59    192.168.0.3     Serial0/0

说明:由于R2R3的接口优先级都是0,不参与DR选举,因此R1自然成为DR

R2#show ip ospf nei

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

192.168.0.1       1   FULL/DR         00:01:30    192.168.0.1     Serial0/1

R3#show ip ospf nei

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

192.168.0.1       1   FULL/DR         00:01:36    192.168.0.1     Serial0/2

 

10.查看OSPF协议信息

R1#show ip ospf interface

Serial0/0 is up, line protocol is up

  Internet Address 192.168.0.1/24, Area 0

  Process ID 1, Router ID 192.168.0.1, Network Type NON_BROADCAST, Cost: 64

  Transmit Delay is 1 sec, State DR, Priority 1

  Designated Router (ID) 192.168.0.1, Interface address 192.168.0.1

  No backup designated router on this network  //没有BDR

  Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5

    oob-resync timeout 120

    Hello due in 00:00:28

  Supports Link-local Signaling (LLS)

  Index 2/2, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 1, maximum is 1

  Last flood scan time is 0 msec, maximum is 4 msec

  Neighbor Count is 2, Adjacent neighbor count is 2

    Adjacent with neighbor 2.2.2.2

    Adjacent with neighbor 3.3.3.3

  Suppress hello for 0 neighbor(s)

Loopback0 is up, line protocol is up

  Internet Address 1.1.1.1/24, Area 0

  Process ID 1, Router ID 192.168.0.1, Network Type LOOPBACK, Cost: 1

11.查看R1OSPF路由表

R1#show ip route ospf

     2.0.0.0/32 is subnetted, 1 subnets

O       2.2.2.2 [110/65] via 192.168.0.2, 00:10:26, Serial0/0

     3.0.0.0/32 is subnetted, 1 subnets

O       3.3.3.3 [110/65] via 192.168.0.3, 00:10:26, Serial0/0

R2#show ip route ospf

     1.0.0.0/32 is subnetted, 1 subnets

O       1.1.1.1 [110/65] via 192.168.0.1, 00:09:51, Serial0/1

     3.0.0.0/32 is subnetted, 1 subnets

O       3.3.3.3 [110/65] via 192.168.0.3, 00:09:51, Serial0/1

12.测试连通性

R1#ping 2.2.2.2 source lo0

 

Type escape sequence to abort.

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

Packet sent with a source address of 1.1.1.1

!!!!!

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

R1#ping 3.3.3.3 source lo0

 

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 1.1.1.1

!!!!!

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

R2#ping 1.1.1.1 source lo0

 

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 = 20/50/72 ms

R2#ping 3.3.3.3 source lo0

 

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 = 40/109/180 ms

说明:在NBMA类型的网络中配置OSPF必须手动指定邻居,但是前提是必须保证每个路由器都互通。

你可能感兴趣的:(职场,休闲,hub,ospf,spoke)