ospf 默認路由綜合配置

             Cisco ospf 默認路由綜合實驗

一、實驗拓撲:

R1R2模擬內部網絡路由器,運行OSPF協議,R3模擬互聯網路由器,現需要通過R2上配置默認路由,讓R1能學習到R33.3.3.3路由條目。

二、實驗步驟:

R1:

interface Loopback0

 ip address 1.1.1.1 255.255.255.0

interface FastEthernet0/0

 ip address 192.168.1.1 255.255.255.0

 duplex auto

 speed auto

router ospf 10

 router-id 1.1.1.1

 log-adjacency-changes

 network 1.1.1.0 0.0.0.255 area 0

 network 192.168.1.0 0.0.0.255 area 0

 

R2:

interface FastEthernet0/0

 ip address 192.168.1.2 255.255.255.0

 duplex auto

interface Serial1/0

 ip address 221.16.1.1 255.255.255.252

 serial restart-delay 0

router ospf 10

 router-id 2.2.2.2

 log-adjacency-changes

 network 192.168.1.0 0.0.0.255 area 0

 default-information originate always

 

R3:

interface Loopback0

 ip address 3.3.3.3 255.255.255.0

interface Serial0/0

 ip address 221.16.1.2 255.255.255.252

 serial restart-delay 0

ip route 0.0.0.0 0.0.0.0 Serial0/0

 

查看R1R2的鄰接關係和路由表:

R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface

2.2.2.2           1   FULL/BDR        00:00:35    192.168.1.2     FastEthernet0/0

R1#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

 

Gateway of last resort is 192.168.1.2 to network 0.0.0.0

 

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

C    192.168.1.0/24 is directly connected, FastEthernet0/0

O*E2 0.0.0.0/0 [110/1] via 192.168.1.2, 00:02:07, FastEthernet0/0

 

R2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface

1.1.1.1           1   FULL/DR         00:00:35    192.168.1.1     FastEthernet0/0

R2#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

 

Gateway of last resort is 0.0.0.0 to network 0.0.0.0

 

     1.0.0.0/32 is subnetted, 1 subnets

O       1.1.1.1 [110/2] via 192.168.1.1, 00:01:53, FastEthernet0/0

     221.16.1.0/30 is subnetted, 1 subnets

C       221.16.1.0 is directly connected, Serial1/0

C    192.168.1.0/24 is directly connected, FastEthernet0/0

S*   0.0.0.0/0 is directly connected, Serial1/0

 

測試從R13.3.3.3的網絡連通性:

R1#ping 3.3.3.3

Type escape sequence to abort.

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

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 408/508/640 ms

 

2、通過上個實驗觀察到R1學到O*E2的度量值爲1,現在擴大度量值:

R2上配置:

R2(config)#router ospf 10

R2(config-router)#default-information originate always metric 30

測試R1路由表:

R1#show ip route ospf

O*E2 0.0.0.0/0 [110/30] via 192.168.1.2, 00:00:13, FastEthernet0/0  //度量值變成30了,當然R1 PING 3.3.3.3肯定還是通的。

 

3、通過上個實驗觀察到R1OE2度量值變成30,現在需要把OE2變成OE1,配置:

R2(config)#router ospf 10

R2(config-router)#default-information originate always metric-type 1 metric 30

查看R1路由表:

R1#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

Gateway of last resort is 192.168.1.2 to network 0.0.0.0

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

C    192.168.1.0/24 is directly connected, FastEthernet0/0

O*E1 0.0.0.0/0 [110/31] via 192.168.1.2, 00:00:11, FastEthernet0/0

//31的度量值的算法:宣告外部路由進來爲30,從R2192.168.1.1METRIC=1,根據OE1的度量值算法爲:內部到ASBR+外部路徑度量值=31

R2#show ip ospf database router

LS age: 1356

  Options: (No TOS-capability, DC)

  LS Type: Router Links

  Link State ID: 1.1.1.1

  Advertising Router: 1.1.1.1

  LS Seq Number: 80000003

  Checksum: 0x64D8

  Length: 48

  Number of Links: 2

 

  Link connected to: a Transit Network

     (Link ID) Designated Router address: 192.168.1.1

     (Link Data) Router Interface address: 192.168.1.1

      Number of TOS metrics: 0

      TOS 0 Metrics: 1

 

4、現在R3上增加網段4.4.4.0/24R1 PING 3.3.3.0/24,4.4.4.0/24情況:

R1#ping 3.3.3.3

Type escape sequence to abort.

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

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 364/471/568 ms

R1#ping 4.4.4.4

Type escape sequence to abort.

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

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 284/417/620 ms

 

R2上配置路由策略過濾掉3.3.3.0/24網段:

R2(config)#access-list 1 permit 3.3.3.0 0.0.0.255

R2(config)#route-map ccna permit 10

R2(config-route-map)#match ip address 1

R2(config-route-map)#set metr

R2(config-route-map)#set metric 30

R2(config-route-map)#end

R2(config)#router ospf 10

R2(config-router)#no default-information originate always route-map ccna

 

R1#ping 4.4.4.4

Type escape sequence to abort.

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

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 284/417/620 ms

R1#ping 3.3.3.3

Type escape sequence to abort.

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

.....

Success rate is 0 percent (0/5)

R1#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

Gateway of last resort is 192.168.1.2 to network 0.0.0.0

 

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

C    192.168.1.0/24 is directly connected, FastEthernet0/0

O*E1 0.0.0.0/0 [110/31] via 192.168.1.2, 00:02:51, FastEthernet0/0

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章