ospf实验
R1>en
R1#show running-config 查看配置文件
hostname R1
R1#show running-config 查看配置文件
hostname R1
interface Loopback0 环回口地址
ip address 172.16.0.1 255.255.255.0
!
interface Loopback1
ip address 172.16.1.1 255.255.255.0
!
interface Loopback2
ip address 172.16.2.1 255.255.255.0
!
interface Loopback3
ip address 172.16.3.1 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
ip address 172.16.0.1 255.255.255.0
!
interface Loopback1
ip address 172.16.1.1 255.255.255.0
!
interface Loopback2
ip address 172.16.2.1 255.255.255.0
!
interface Loopback3
ip address 172.16.3.1 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
router rip rip动态路由协议 以跳数为度量值
version 2 版本2
network 172.16.0.0 自己知道的网络号
network 192.168.12.0
no auto-summary 不自动汇总
version 2 版本2
network 172.16.0.0 自己知道的网络号
network 192.168.12.0
no auto-summary 不自动汇总
end
R2#show running-config
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.23.2 255.255.255.0
duplex auto
speed auto
!
router ospf 110 ospf动态路由协议 以 cost 为度量值
log-adjacency-changes
area 1 nssa no-summary NSSA区域
summary-address 172.16.0.0 255.255.252.0 汇总地址
redistribute rip subnets 把rip协议加入到 ospf里
network 2.2.2.2 0.0.0.0 area 1
network 192.168.12.0 0.0.0.255 area 1 网络号 后面跟反掩码 区域号
network 192.168.23.0 0.0.0.255 area 1
!
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.23.2 255.255.255.0
duplex auto
speed auto
!
router ospf 110 ospf动态路由协议 以 cost 为度量值
log-adjacency-changes
area 1 nssa no-summary NSSA区域
summary-address 172.16.0.0 255.255.252.0 汇总地址
redistribute rip subnets 把rip协议加入到 ospf里
network 2.2.2.2 0.0.0.0 area 1
network 192.168.12.0 0.0.0.255 area 1 网络号 后面跟反掩码 区域号
network 192.168.23.0 0.0.0.255 area 1
!
router rip rip协议
version 2
redistribute ospf 110 metric 3 把ospf 协议打入到 rip协议里 度量值3
network 2.0.0.0
network 192.168.12.0
network 192.168.23.0
no auto-summary
version 2
redistribute ospf 110 metric 3 把ospf 协议打入到 rip协议里 度量值3
network 2.0.0.0
network 192.168.12.0
network 192.168.23.0
no auto-summary
end
R3#show running-config
hostname R3
hostname R3
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.23.3 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.34.3 255.255.255.0
duplex auto
speed auto
!
router ospf 110
log-adjacency-changes
area 1 nssa no-summary
network 3.3.3.3 0.0.0.0 area 1
network 192.168.23.0 0.0.0.255 area 1
network 192.168.34.0 0.0.0.255 area 1
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.23.3 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.34.3 255.255.255.0
duplex auto
speed auto
!
router ospf 110
log-adjacency-changes
area 1 nssa no-summary
network 3.3.3.3 0.0.0.0 area 1
network 192.168.23.0 0.0.0.255 area 1
network 192.168.34.0 0.0.0.255 area 1
end
R4#show running-config
Building configuration...
hostname R4
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.34.4 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.45.4 255.255.255.0
duplex auto
speed auto
!
router ospf 110
log-adjacency-changes
area 1 nssa no-summary
network 4.4.4.4 0.0.0.0 area 0
network 192.168.34.0 0.0.0.255 area 1
network 192.168.45.0 0.0.0.255 area 0
end
R5:
hostname R5
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.45.5 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.56.5 255.255.255.0
duplex auto
speed auto
!
router ospf 110
log-adjacency-changes
network 5.5.5.5 0.0.0.0 area 0
network 192.168.45.0 0.0.0.255 area 0
network 192.168.56.0 0.0.0.255 area 2
!
end
ip address 5.5.5.5 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.45.5 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.56.5 255.255.255.0
duplex auto
speed auto
!
router ospf 110
log-adjacency-changes
network 5.5.5.5 0.0.0.0 area 0
network 192.168.45.0 0.0.0.255 area 0
network 192.168.56.0 0.0.0.255 area 2
!
end
R6#show running-config
Building configuration...
hostname R6
!
interface Loopback0
ip address 6.6.6.6 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.56.6 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.67.6 255.255.255.0
duplex auto
speed auto
!
router ospf 110
log-adjacency-changes
redistribute rip subnets
network 6.6.6.6 0.0.0.0 area 2
network 192.168.56.0 0.0.0.255 area 2
network 192.168.67.0 0.0.0.255 area 2
!
router rip
version 2
redistribute ospf 110 metric 3
network 6.0.0.0
network 192.168.56.0
network 192.168.67.0
no auto-summary
!
end
Building configuration...
hostname R6
!
interface Loopback0
ip address 6.6.6.6 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.56.6 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.67.6 255.255.255.0
duplex auto
speed auto
!
router ospf 110
log-adjacency-changes
redistribute rip subnets
network 6.6.6.6 0.0.0.0 area 2
network 192.168.56.0 0.0.0.255 area 2
network 192.168.67.0 0.0.0.255 area 2
!
router rip
version 2
redistribute ospf 110 metric 3
network 6.0.0.0
network 192.168.56.0
network 192.168.67.0
no auto-summary
!
end
R7#show running-config
hostname R7
!
interface Loopback0
ip address 7.7.7.7 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.67.7 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
router rip
version 2
network 7.0.0.0
network 192.168.67.0
no auto-summary
!
end
!
interface Loopback0
ip address 7.7.7.7 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.67.7 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
router rip
version 2
network 7.0.0.0
network 192.168.67.0
no auto-summary
!
end
R1>ping 7.7.7.7
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 7.7.7.7, timeout is 2 seconds:
!!!!!
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 7.7.7.7, timeout is 2 seconds:
!!!!!
R2的路由表
C 192.168.12.0/24 is directly connected, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/11] via 192.168.23.3, 00:19:33, FastEthernet0/1
172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
R 172.16.0.0/24 [120/1] via 192.168.12.1, 00:00:20, FastEthernet0/0
O 172.16.0.0/22 is a summary, 00:20:13, Null0
R 172.16.1.0/24 [120/1] via 192.168.12.1, 00:00:21, FastEthernet0/0
R 172.16.2.0/24 [120/1] via 192.168.12.1, 00:00:21, FastEthernet0/0
R 172.16.3.0/24 [120/1] via 192.168.12.1, 00:00:21, FastEthernet0/0
C 192.168.23.0/24 is directly connected, FastEthernet0/1
O 192.168.34.0/24 [110/20] via 192.168.23.3, 00:19:35, FastEthernet0/1
O*IA 0.0.0.0/0 [110/21] via 192.168.23.3, 00:19:36, FastEthernet0/1
C 192.168.12.0/24 is directly connected, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/11] via 192.168.23.3, 00:19:33, FastEthernet0/1
172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
R 172.16.0.0/24 [120/1] via 192.168.12.1, 00:00:20, FastEthernet0/0
O 172.16.0.0/22 is a summary, 00:20:13, Null0
R 172.16.1.0/24 [120/1] via 192.168.12.1, 00:00:21, FastEthernet0/0
R 172.16.2.0/24 [120/1] via 192.168.12.1, 00:00:21, FastEthernet0/0
R 172.16.3.0/24 [120/1] via 192.168.12.1, 00:00:21, FastEthernet0/0
C 192.168.23.0/24 is directly connected, FastEthernet0/1
O 192.168.34.0/24 [110/20] via 192.168.23.3, 00:19:35, FastEthernet0/1
O*IA 0.0.0.0/0 [110/21] via 192.168.23.3, 00:19:36, FastEthernet0/1
R6学习到汇总路由 我的拓扑图显示 是R7 show ip route 看到
R 192.168.12.0/24 [120/3] via 192.168.67.6, 00:00:07, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
R 2.2.2.2 [120/3] via 192.168.67.6, 00:00:07, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
R 3.3.3.3 [120/3] via 192.168.67.6, 00:00:07, FastEthernet0/0
R 192.168.45.0/24 [120/3] via 192.168.67.6, 00:00:07, FastEthernet0/0
4.0.0.0/32 is subnetted, 1 subnets
R 4.4.4.4 [120/3] via 192.168.67.6, 00:00:07, FastEthernet0/0
5.0.0.0/32 is subnetted, 1 subnets
R 5.5.5.5 [120/3] via 192.168.67.6, 00:00:08, FastEthernet0/0
6.0.0.0/32 is subnetted, 1 subnets
R 6.6.6.6 [120/1] via 192.168.67.6, 00:00:08, FastEthernet0/0
172.16.0.0/22 is subnetted, 1 subnets
R 172.16.0.0 [120/3] via 192.168.67.6, 00:00:10, FastEthernet0/0
R 192.168.56.0/24 [120/1] via 192.168.67.6, 00:00:10, FastEthernet0/0
7.0.0.0/32 is subnetted, 1 subnets
C 7.7.7.7 is directly connected, Loopback0
R 192.168.23.0/24 [120/3] via 192.168.67.6, 00:00:10, FastEthernet0/0
C 192.168.67.0/24 is directly connected, FastEthernet0/0
R 192.168.34.0/24 [120/3] via 192.168.67.6, 00:00:10, FastEthernet0/0
回答:发现有一条默认路由 做了NSSA 四类和五类都没了,三类就剩下一条默认路由 多了一条七类 看紫色表示 有七类LSA没有五类了
2.0.0.0/32 is subnetted, 1 subnets
R 2.2.2.2 [120/3] via 192.168.67.6, 00:00:07, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
R 3.3.3.3 [120/3] via 192.168.67.6, 00:00:07, FastEthernet0/0
R 192.168.45.0/24 [120/3] via 192.168.67.6, 00:00:07, FastEthernet0/0
4.0.0.0/32 is subnetted, 1 subnets
R 4.4.4.4 [120/3] via 192.168.67.6, 00:00:07, FastEthernet0/0
5.0.0.0/32 is subnetted, 1 subnets
R 5.5.5.5 [120/3] via 192.168.67.6, 00:00:08, FastEthernet0/0
6.0.0.0/32 is subnetted, 1 subnets
R 6.6.6.6 [120/1] via 192.168.67.6, 00:00:08, FastEthernet0/0
172.16.0.0/22 is subnetted, 1 subnets
R 172.16.0.0 [120/3] via 192.168.67.6, 00:00:10, FastEthernet0/0
R 192.168.56.0/24 [120/1] via 192.168.67.6, 00:00:10, FastEthernet0/0
7.0.0.0/32 is subnetted, 1 subnets
C 7.7.7.7 is directly connected, Loopback0
R 192.168.23.0/24 [120/3] via 192.168.67.6, 00:00:10, FastEthernet0/0
C 192.168.67.0/24 is directly connected, FastEthernet0/0
R 192.168.34.0/24 [120/3] via 192.168.67.6, 00:00:10, FastEthernet0/0
回答:发现有一条默认路由 做了NSSA 四类和五类都没了,三类就剩下一条默认路由 多了一条七类 看紫色表示 有七类LSA没有五类了
R3#show ip ospf database nssa-external
OSPF Router with ID (3.3.3.3) (Process ID 110)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA
LS age: 1938
Options: (No TOS-capability, Type 7/5 translation, DC)
LS Type: AS External Link
Link State ID: 172.16.0.0 (External Network Number )
Advertising Router: 2.2.2.2
LS Seq Number: 80000001
Checksum: 0xE6E5
Length: 36
Network Mask: /22
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 20
Forward Address: 2.2.2.2
External Route Tag: 0
LS age: 1938
Options: (No TOS-capability, Type 7/5 translation, DC)
LS Type: AS External Link
Link State ID: 172.16.0.0 (External Network Number )
Advertising Router: 2.2.2.2
LS Seq Number: 80000001
Checksum: 0xE6E5
Length: 36
Network Mask: /22
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 20
Forward Address: 2.2.2.2
External Route Tag: 0
R3#show ip ospf database external
OSPF Router with ID (3.3.3.3) (Process ID 110)
回答:R6上有 4.4.4.4 ASBR AR是5.5.5.5
R6#show ip ospf database asbr-summary
OSPF Router with ID (6.6.6.6) (Process ID 110)
Summary ASB Link States (Area 2)
Routing Bit Set on this LSA
LS age: 1488
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: 4.4.4.4 (AS Boundary Router address)
Advertising Router: 5.5.5.5
LS Seq Number: 80000001
Checksum: 0x907D
Length: 28
Network Mask: /0
TOS: 0 Metric: 10
因为做了NSSA后,R4即是ASBR也是ABR
LS age: 1488
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: 4.4.4.4 (AS Boundary Router address)
Advertising Router: 5.5.5.5
LS Seq Number: 80000001
Checksum: 0x907D
Length: 28
Network Mask: /0
TOS: 0 Metric: 10
因为做了NSSA后,R4即是ASBR也是ABR
本文转自 cs312779641 51CTO博客,原文链接:http://blog.51cto.com/chenhao6/1175488