OSPF综合实验 (三)

文章目录

        • 一.实验目的:练习OSPF配置,以及NAT服务
        • 二.实验拓扑
        • 三.实验过程
          • 3.1配置AR5
            • 3.1.1配置接口地址
            • 3.1.2配置Rip
          • 3.2配置AR4
            • 3.2.1 配置接口
            • 3.2.2配置单臂路由
            • 3.2.3配置RIP
          • 3.3配置AR3
            • 3.3.1配置接口
            • 3.3.2配置OSPF
            • 3.3.3配置RIP
          • 3.4配置AR2
            • 3.4.1配置接口
            • 3.4.2配置OSPF
            • 3.4.3配置NAT地址转换服务
          • 3.5配置AR1
          • 3.6配置SW1
            • 3.6.1 配置接口
            • 3.6.2配置eth-trunk1
            • 3.6.3配置三层交换机vlanif
            • 3.6.4配置ospf
          • 3.7配置SW2
            • 3.7.1配置接口地址
            • 3.7.2配置eth-trunk
            • 3.7.3配置vlanif
            • 3.7.4配置ospf
          • 3.8配置SW3
          • 3.9配置SW4
          • 3.10配置SW5
          • 3.11配置SW6
          • 3.12配置SW7
        • 四.测试

OSPF综合实验

一.实验目的:练习OSPF配置,以及NAT服务

二.实验拓扑

OSPF综合实验 (三)_第1张图片

三.实验过程

3.1配置AR5
3.1.1配置接口地址
[AR5]int g0/0/0
[AR5-GigabitEthernet0/0/0]ip add 10.1.100.1 24
[AR5-GigabitEthernet0/0/0]un sh
[AR5-GigabitEthernet0/0/0]int g0/0/2
[AR5-GigabitEthernet0/0/2]ip add 10.1.135.2 24
[AR5-GigabitEthernet0/0/2]un sh
[AR5]int loo0
[AR5-LoopBack0]ip add 5.5.5.5 32
[AR5-LoopBack0]q
3.1.2配置Rip
[AR5]rip 1
[AR5-rip-1]v 2
[AR5-rip-1]net 10.0.0.0
[AR5-rip-1]net 5.0.0.0
3.2配置AR4
3.2.1 配置接口
[AR4]int g0/0/2
[AR4-GigabitEthernet0/0/2]ip add 10.1.135.1 24
[AR4-GigabitEthernet0/0/2]un sh
[AR4-GigabitEthernet0/0/2]int g0/0/1
[AR4-GigabitEthernet0/0/1]ip add 10.1.134.2 24

[AR4-GigabitEthernet0/0/2]un sh

[AR4-GigabitEthernet0/0/1]int loo0
[AR4-LoopBack0]ip add 4.4.4.4 32
[AR4-LoopBack0]q
3.2.2配置单臂路由
[AR4]int g0/0/0.21
[AR4-GigabitEthernet0/0/0.21]d t v 21
[AR4-GigabitEthernet0/0/0.21]ip add 10.1.21.1 24
[AR4-GigabitEthernet0/0/0.21]a b e
[AR4-GigabitEthernet0/0/0.21]un  sh
[AR4-GigabitEthernet0/0/0.21]int g0/0/0.22
[AR4-GigabitEthernet0/0/0.22]d t v 22
[AR4-GigabitEthernet0/0/0.22]ip add 10.1.22.1 24
[AR4-GigabitEthernet0/0/0.22]a b e
[AR4-GigabitEthernet0/0/0.22]un sh
3.2.3配置RIP
[AR4]rip 1
[AR4-rip-1]v 2
[AR4-rip-1]net 10.0.0.0 
[AR4-rip-1]net 4.0.0.0
[AR4-rip-1]dis this 
rip 1
 version 2
 network 10.0.0.0
 network 4.0.0.0
3.3配置AR3
3.3.1配置接口
[AR3]int g0/0/1
[AR3-GigabitEthernet0/0/1]ip add 10.1.134.1 24
[AR3-GigabitEthernet0/0/1]un sh
[AR3-GigabitEthernet0/0/1]int g0/0/0
[AR3-GigabitEthernet0/0/0]ip add 10.1.113.2 24
[AR3-GigabitEthernet0/0/0]un sh
[AR3-GigabitEthernet0/0/0]int loo0
[AR3-LoopBack0]ip add 3.3.3.3 32
[AR3-LoopBack0]q
3.3.2配置OSPF
[AR3]ospf 1 router-id 3.3.3.3

[AR3-ospf-1]a 0
[AR3-ospf-1-area-0.0.0.0]network 10.1.113.0 0.0.0.255
[AR3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[AR3-ospf-1-area-0.0.0.0]q
[AR3-ospf-1]import-route rip type 1 cost 5
3.3.3配置RIP
[AR3-rip-1]v 2
[AR3-rip-1]net 10.0.0.0

[AR3-rip-1]import-route ospf 

[AR3-rip-1]default-route originate
3.4配置AR2
3.4.1配置接口
[AR2]int g4/0/0
[AR2-GigabitEthernet4/0/0]ip add 202.2.12.2 24
[AR2-GigabitEthernet4/0/0]un sh
[AR2-GigabitEthernet4/0/0]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip add 10.1.113.1 24
[AR2-GigabitEthernet0/0/0]un sh
[AR2-GigabitEthernet0/0/0]int g0/0/2
[AR2-GigabitEthernet0/0/2]ip add 10.1.112.1 24
[AR2-GigabitEthernet0/0/2]un sh
[AR2-GigabitEthernet0/0/2]int g0/0/1
[AR2-GigabitEthernet0/0/1]ip add 10.1.111.1 24
[AR2-GigabitEthernet0/0/1]un sh

[AR2]int loo0
[AR2-LoopBack0]ip add 2.2.2.2 32  
3.4.2配置OSPF
[AR2]ospf 1 router-id 2.2.2.2
[AR2-ospf-1]a 0
[AR2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[AR2-ospf-1-area-0.0.0.0]net 10.1.112.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.0]net 10.1.113.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.0]net 10.1.111.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.0]dis this
 area 0.0.0.0 
  network 2.2.2.2 0.0.0.0 #32位的掩码是0.0.0.0 网络号是2.2.2.2 不能设2.2.2.0
  network 10.1.111.0 0.0.0.255 
  network 10.1.112.0 0.0.0.255 
  network 10.1.113.0 0.0.0.255

[AR2]ip route-static 0.0.0.0 0.0.0.0 202.2.12.1
[AR2]ospf 1
[AR2-ospf-1]default-route-advertise
3.4.3配置NAT地址转换服务
[AR2]ac 2000
[AR2-acl-basic-2000]rule permit source 10.1.0.0 0.0.255.255
[AR2-acl-basic-2000]q
[AR2]int g4/0/0
[AR2-GigabitEthernet4/0/0]nat outbound 2000
[AR2-GigabitEthernet4/0/0]nat server protocol tcp global 202.2.12.3 www inside 
10.1.100.100 www

[AR2-GigabitEthernet4/0/0]dis this
 ip address 202.2.12.2 255.255.255.0 
 nat server protocol tcp global 202.2.12.3 www inside 10.1.100.100 www
 nat outbound 2000
3.5配置AR1
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 202.2.12.1 24
[Huawei-GigabitEthernet0/0/1]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 202.2.2.1 24
[Huawei-GigabitEthernet0/0/0]un sh
3.6配置SW1
3.6.1 配置接口
[SW1]v b 11 12 1001 1000	
[SW1]interface g0/0/1
[SW1-GigabitEthernet0/0/1]p l a
[SW1-GigabitEthernet0/0/1]p d v 1001
[SW1-GigabitEthernet0/0/1]un sh
[SW1-GigabitEthernet0/0/1]interface g0/0/21
[SW1-GigabitEthernet0/0/21]p l a 	
[SW1-GigabitEthernet0/0/21]p d v 11
[SW1-GigabitEthernet0/0/21]un sh	
[SW1-GigabitEthernet0/0/21]interface g0/0/22
[SW1-GigabitEthernet0/0/22]p l a
[SW1-GigabitEthernet0/0/22]p d v 12
[SW1-GigabitEthernet0/0/22]un sh
[SW1-GigabitEthernet0/0/22]q
3.6.2配置eth-trunk1
[SW1]int eth-trunk1
[SW1-Eth-Trunk1]trunkport g 0/0/11 to 0/0/12	
[SW1-Eth-Trunk1]p l a
[SW1-Eth-Trunk1]p d v 1000
[SW1-Eth-Trunk1]un sh
[SW1-Eth-Trunk1]q
3.6.3配置三层交换机vlanif
[SW1]int vlanif11
[SW1-Vlanif11]ip add 10.1.11.1 24
[SW1-Vlanif11]int vlanif12	
[SW1-Vlanif12]ip add 10.1.12.1 24	
[SW1-Vlanif12]int vlanif1000	
[SW1-Vlanif1000]ip add 10.1.122.11 24	
[SW1-Vlanif1000]int vlanif1001	
[SW1-Vlanif1001]ip add 10.1.111.12 24	
[SW1-Vlanif1001]int loo0
[SW1-LoopBack0]ip add 11.11.11.11 32
3.6.4配置ospf
[SW1-ospf-1]ospf 1 router-id 11.11.11.11	
[SW1-ospf-1]a 0
[SW1-ospf-1-area-0.0.0.0]network 11.11.11.11 0.0.0.0
[SW1-ospf-1-area-0.0.0.0]network 10.1.122.0 0.0.0.255
[SW1-ospf-1-area-0.0.0.0]network 10.1.111.0 0.0.0.255	
[SW1-ospf-1-area-0.0.0.0]net 10.1.11.0 0.0.0.255	
[SW1-ospf-1-area-0.0.0.0]net 10.1.12.0 0.0.0.255
[SW1-ospf-1-area-0.0.0.0]dis this
  network 11.11.11.11 0.0.0.0
  network 10.1.122.0 0.0.0.255
  network 10.1.111.0 0.0.0.255
  network 10.1.11.0 0.0.0.255
  network 10.1.12.0 0.0.0.255
3.7配置SW2
3.7.1配置接口地址
[SW2]v b 13 14 1000 1002	
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]p l a
[SW2-GigabitEthernet0/0/2]p d v 1002	
[SW2-GigabitEthernet0/0/2]un sh
[SW2-GigabitEthernet0/0/2]int g0/0/23
[SW2-GigabitEthernet0/0/23]p l  a	
[SW2-GigabitEthernet0/0/23]p d v 13
[SW2-GigabitEthernet0/0/23]un sh	
[SW2-GigabitEthernet0/0/23]int g0/0/24
[SW2-GigabitEthernet0/0/24]p l a
[SW2-GigabitEthernet0/0/24]p d v 14
[SW2-GigabitEthernet0/0/24]un sh
[SW2-GigabitEthernet0/0/24]q
3.7.2配置eth-trunk
[SW2]int eth-trunk1
[SW2-Eth-Trunk1]trunkport g 0/0/11 to 0/0/12
[SW2-Eth-Trunk1]p l a	
[SW2-Eth-Trunk1]p d v 1000
[SW2-Eth-Trunk1]un sh
[SW2-Eth-Trunk1]q
3.7.3配置vlanif
[SW2]int vlanif 13
[SW2-Vlanif13]ip add 10.1.13.1 24

[SW2-Vlanif13]int vlanif 14	
[SW2-Vlanif14]ip add 10.1.14.1 24

[SW2-Vlanif14]int vlanif 1000	
[SW2-Vlanif1000]ip add 10.1.122.12 24

[SW2]int vlanif 1002
[SW2-Vlanif1002]ip add 10.1.112.12 24

[SW2-Vlanif1002]int loo0
[SW2-LoopBack0]ip add 22.22.22.22 32
3.7.4配置ospf
[SW2]ospf 1 router-id 22.22.22.22
[SW2-ospf-1]a 0	
[SW2-ospf-1-area-0.0.0.0]network 10.1.13.0 0.0.0.255
[SW2-ospf-1-area-0.0.0.0]network 10.1.14.0 0.0.0.255	
[SW2-ospf-1-area-0.0.0.0]network 10.1.122.0 0.0.0.255

[SW2-ospf-1-area-0.0.0.0]network 10.1.112.0 0.0.0.255
[SW2-ospf-1-area-0.0.0.0]display this
  network 10.1.13.0 0.0.0.255
  network 10.1.14.0 0.0.0.255
  network 10.1.122.0 0.0.0.255
  network 10.1.112.0 0.0.0.255
3.8配置SW3
[SW3]v b 11	
[SW3]int g0/0/1
[SW3-GigabitEthernet0/0/1]p l a	
[SW3-GigabitEthernet0/0/1]p d v 11
[SW3-GigabitEthernet0/0/1]un sh

[SW3]int e0/0/1
[SW3-Ethernet0/0/1]p l a 	
[SW3-Ethernet0/0/1]p d v 11	
[SW3-Ethernet0/0/1]un sh
3.9配置SW4
[SW4]vlan b 12
[SW4]int e0/0/1
[SW4-Ethernet0/0/1]p l a	
[SW4-Ethernet0/0/1]p d v 12
[SW4-Ethernet0/0/1]un sh

[SW4]int g0/0/1
[SW4-GigabitEthernet0/0/1]p l a	
[SW4-GigabitEthernet0/0/1]p d v 12
[SW4-GigabitEthernet0/0/1]un sh
3.10配置SW5
[SW5]v b 13	
[SW5]int e0/0/1
[SW5-Ethernet0/0/1]p l a
[SW5-Ethernet0/0/1]p d v 13
[SW5-Ethernet0/0/1]un sh

[SW5]int g0/0/1
[SW5-GigabitEthernet0/0/1]p l a
[SW5-GigabitEthernet0/0/1]p d v 13
[SW5-GigabitEthernet0/0/1]un sh
3.11配置SW6
[SW6]v b 14
[SW6-Ethernet0/0/1]p l a
[SW6-Ethernet0/0/1]p d v 14
[SW6-Ethernet0/0/1]un sh

[SW6]int g0/0/1
[SW6-GigabitEthernet0/0/1]p l a
[SW6-GigabitEthernet0/0/1]p d v 14	
[SW6-GigabitEthernet0/0/1]un sh
3.12配置SW7
[SW7]v b 21 22
[SW7]int e0/0/10
[SW7-Ethernet0/0/10]p l t
[SW7-Ethernet0/0/10]p t a v 21 22
[SW7-Ethernet0/0/10]un sh

[SW7-Ethernet0/0/10]int e0/0/1
[SW7-Ethernet0/0/1]p l a
[SW7-Ethernet0/0/1]p d v 21
[SW7-Ethernet0/0/1]un sh

[SW7-Ethernet0/0/1]int e0/0/2
[SW7-Ethernet0/0/2]p l a
[SW7-Ethernet0/0/2]int e0/0/2	
[SW7-Ethernet0/0/2]p d v 22
[SW7-Ethernet0/0/2]un sh

四.测试

OSPF综合实验 (三)_第2张图片

OSPF综合实验 (三)_第3张图片

OSPF综合实验 (三)_第4张图片

OSPF综合实验 (三)_第5张图片

OSPF综合实验 (三)_第6张图片

OSPF综合实验 (三)_第7张图片

OSPF综合实验 (三)_第8张图片
OSPF综合实验 (三)_第9张图片
五.实验总结
OSPF下发默认路由:default-route-advertise命令的意思是本路由器发布一条0.0.0.0/0.0.0.0的路由到域内其他路由器。其他路由器学习到这条默认路由后,下一跳就是指向发布这条路由的路由器。
RIP下发默认路由:default-route originate

你可能感兴趣的:(网络基础)