zoukankan      html  css  js  c++  java
  • OSPF 虚链路

    GNS3图标

    通过配置OSPF虚链路连接到骨干区域。


    实验拓扑

    OSPF虚链路

    如图所示连接,地址规划如下:

    名称 接口 IP地址
    R1 f0/0 192.168.10.1/24
    R1 f0/1 192.168.20.1/24
    R2 f0/0 192.168.20.2/24
    R2 f0/1 192.168.30.1/24
    R3 f0/0 192.168.30.2/24
    R3 f0/1 192.168.40.1/24
    R4 f0/0 192.168.40.2/24
    R4 f0/1 192.168.50.1/24
    PC1 e0 192.168.10.2/24
    PC2 e0 192.168.50.2/24

    配置方法

    R2(config)#router ospf 1
    R2(config-router)#area 1 virtual-link 3.3.3.3
    R2(config-router)#ex
    

    配置过程

    R1

    R1#conf t
    Enter configuration commands, one per line.  End with CNTL/Z.
    R1(config)#int f0/0
    R1(config-if)#ip add 192.168.10.1 255.255.255.0
    R1(config-if)#no sh
    R1(config-if)#ex
    R1(config)#int f0/1
    R1(config-if)#ip add 192.168.20.1 255.255.255.0
    R1(config-if)#no sh
    R1(config-if)#ex
    R1(config)#int loopback 0
    R1(config-if)#ip add 1.1.1.1 255.255.255.255
    R1(config-if)#no sh
    R1(config-if)#ex
    R1(config)#router ospf 1
    R1(config-router)#router-id 1.1.1.1
    R1(config-router)#network 192.168.10.0 0.0.0.255 area 2
    R1(config-router)#network 192.168.20.0 0.0.0.255 area 2
    R1(config-router)#ex
    

    R2

    R2#conf t
    Enter configuration commands, one per line.  End with CNTL/Z.
    R2(config)#int f0/0
    R2(config-if)#ip add 192.168.20.2 255.255.255.0
    R2(config-if)#no sh
    R2(config-if)#ex
    R2(config)#int f0/1
    R2(config-if)#ip add 192.168.30.1 255.255.255.0
    R2(config-if)#no sh
    R2(config-if)#ex
    R2(config)#int loopback 0
    R2(config-if)#ip add 2.2.2.2 255.255.255.255
    R2(config-if)#no sh
    R2(config-if)#ex
    R2(config)#router ospf 1
    R2(config-router)#router-id 2.2.2.2
    R2(config-router)#network 192.168.20.0 0.0.0.255 area 2
    R2(config-router)#network 192.168.30.0 0.0.0.255 area 1
    R2(config-router)#ex
    

    R3

    R3#conf t
    Enter configuration commands, one per line.  End with CNTL/Z.
    R3(config)#int f0/0
    R3(config-if)#ip add 192.168.30.2 255.255.255.0
    R3(config-if)#no sh
    R3(config-if)#ex
    R3(config)#int f0/1
    R3(config-if)#ip add 192.168.40.1 255.255.255.0
    R3(config-if)#no sh
    R3(config-if)#ex
    R3(config)#int loopback 0
    R3(config-if)#ip add 3.3.3.3 255.255.255.255
    R3(config-if)#no sh
    R3(config-if)#ex
    R3(config)#router ospf 1
    R3(config-router)#router-id 3.3.3.3
    R3(config-router)#network 192.168.30.0 0.0.0.255 area 1
    R3(config-router)#network 192.168.40.0 0.0.0.255 area 0
    R3(config-router)#ex
    

    R4

    R4#conf t
    Enter configuration commands, one per line.  End with CNTL/Z.
    R4(config)#int f0/0
    R4(config-if)#ip add 192.168.40.2 255.255.255.0
    R4(config-if)#no sh
    R4(config-if)#ex
    R4(config)#int f0/1
    R4(config-if)#ip add 192.168.50.1 255.255.255.0
    R4(config-if)#no sh
    R4(config-if)#ex
    R4(config)#int loopback 0
    R4(config-if)#ip add 4.4.4.4 255.255.255.255
    R4(config-if)#no sh
    R4(config-if)#ex
    R4(config)#router ospf 1
    R4(config-router)#router-id 4.4.4.4
    R4(config-router)#network 192.168.40.0 0.0.0.255 area 0
    R4(config-router)#network 192.168.50.0 0.0.0.255 area 0
    R4(config-router)#ex
    

    第一次查看路由表

    • R1
    R1(config)#do 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 not set
    
         1.0.0.0/32 is subnetted, 1 subnets
    C       1.1.1.1 is directly connected, Loopback0
    C    192.168.10.0/24 is directly connected, FastEthernet0/0
    C    192.168.20.0/24 is directly connected, FastEthernet0/1
    
    • R2
    R2(config)#do 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 not set
    
         2.0.0.0/32 is subnetted, 1 subnets
    C       2.2.2.2 is directly connected, Loopback0
    C    192.168.30.0/24 is directly connected, FastEthernet0/1
    O    192.168.10.0/24 [110/20] via 192.168.20.1, 00:09:52, FastEthernet0/0
    O IA 192.168.40.0/24 [110/20] via 192.168.30.2, 00:05:59, FastEthernet0/1
    C    192.168.20.0/24 is directly connected, FastEthernet0/0
    O IA 192.168.50.0/24 [110/30] via 192.168.30.2, 00:01:42, FastEthernet0/1
    
    • R3
    R3(config)#do 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 not set
    
         3.0.0.0/32 is subnetted, 1 subnets
    C       3.3.3.3 is directly connected, Loopback0
    C    192.168.30.0/24 is directly connected, FastEthernet0/0
    C    192.168.40.0/24 is directly connected, FastEthernet0/1
    O    192.168.50.0/24 [110/20] via 192.168.40.2, 00:02:01, FastEthernet0/1
    
    • R4
    R4(config)#do 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 not set
    
    O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:02:27, FastEthernet0/0
         4.0.0.0/32 is subnetted, 1 subnets
    C       4.4.4.4 is directly connected, Loopback0
    C    192.168.40.0/24 is directly connected, FastEthernet0/0
    C    192.168.50.0/24 is directly connected, FastEthernet0/1
    

    配置虚链路

    R2(config)#router ospf 1
    R2(config-router)#area 1 virtual-link 3.3.3.3
    R2(config-router)#ex
    
    R3(config)#router ospf 1
    R3(config-router)#area 1 virtual-link 2.2.2.2
    R3(config-router)#ex
    

    第二次查看路由表

    R1(config)#do 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 not set
    
         1.0.0.0/32 is subnetted, 1 subnets
    C       1.1.1.1 is directly connected, Loopback0
    O IA 192.168.30.0/24 [110/20] via 192.168.20.2, 00:02:08, FastEthernet0/1
    C    192.168.10.0/24 is directly connected, FastEthernet0/0
    O IA 192.168.40.0/24 [110/30] via 192.168.20.2, 00:01:27, FastEthernet0/1
    C    192.168.20.0/24 is directly connected, FastEthernet0/1
    O IA 192.168.50.0/24 [110/40] via 192.168.20.2, 00:01:27, FastEthernet0/1
    
    R2(config)#do 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 not set
    
         2.0.0.0/32 is subnetted, 1 subnets
    C       2.2.2.2 is directly connected, Loopback0
    C    192.168.30.0/24 is directly connected, FastEthernet0/1
    O    192.168.10.0/24 [110/20] via 192.168.20.1, 00:02:19, FastEthernet0/0
    O    192.168.40.0/24 [110/20] via 192.168.30.2, 00:01:33, FastEthernet0/1
    C    192.168.20.0/24 is directly connected, FastEthernet0/0
    O    192.168.50.0/24 [110/30] via 192.168.30.2, 00:01:33, FastEthernet0/1
    
    R3(config)#do 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 not set
    
         3.0.0.0/32 is subnetted, 1 subnets
    C       3.3.3.3 is directly connected, Loopback0
    C    192.168.30.0/24 is directly connected, FastEthernet0/0
    O IA 192.168.10.0/24 [110/30] via 192.168.30.1, 00:01:39, FastEthernet0/0
    C    192.168.40.0/24 is directly connected, FastEthernet0/1
    O IA 192.168.20.0/24 [110/20] via 192.168.30.1, 00:01:39, FastEthernet0/0
    O    192.168.50.0/24 [110/20] via 192.168.40.2, 00:08:17, FastEthernet0/1
    
    R4(config)#do 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 not set
    
    O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:08:32, FastEthernet0/0
         4.0.0.0/32 is subnetted, 1 subnets
    C       4.4.4.4 is directly connected, Loopback0
    O IA 192.168.10.0/24 [110/40] via 192.168.40.1, 00:01:34, FastEthernet0/0
    C    192.168.40.0/24 is directly connected, FastEthernet0/0
    O IA 192.168.20.0/24 [110/30] via 192.168.40.1, 00:01:34, FastEthernet0/0
    C    192.168.50.0/24 is directly connected, FastEthernet0/1
    

    验证结果

    配置 IP 地址

    PC1> ip 192.168.10.2 192.168.10.1
    Checking for duplicate address...
    PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1
    
    PC2> ip 192.168.50.2 192.168.50.1
    Checking for duplicate address...
    PC1 : 192.168.50.2 255.255.255.0 gateway 192.168.50.1
    

    ping 测试

    PC1> ping 192.168.50.2
    192.168.50.2 icmp_seq=1 timeout
    84 bytes from 192.168.50.2 icmp_seq=2 ttl=60 time=85.890 ms
    84 bytes from 192.168.50.2 icmp_seq=3 ttl=60 time=80.743 ms
    84 bytes from 192.168.50.2 icmp_seq=4 ttl=60 time=83.772 ms
    84 bytes from 192.168.50.2 icmp_seq=5 ttl=60 time=85.761 ms
    
    PC2> ping 192.168.10.2
    84 bytes from 192.168.10.2 icmp_seq=1 ttl=60 time=76.961 ms
    84 bytes from 192.168.10.2 icmp_seq=2 ttl=60 time=84.788 ms
    84 bytes from 192.168.10.2 icmp_seq=3 ttl=60 time=79.753 ms
    84 bytes from 192.168.10.2 icmp_seq=4 ttl=60 time=77.792 ms
    84 bytes from 192.168.10.2 icmp_seq=5 ttl=60 time=83.964 ms
    
  • 相关阅读:
    互联网预言大神:凯文·凯利——预测未来的12个趋势
    仅有算法远远不够:AI突破下一站,需要对硬件重新审视
    软件开发中经常使用的5种设计模式
    强化学习到底是什么,它如何运作?
    2020年网络安全的六大经验教训
    选择困难终结者:不同问题之下的机器学习算法
    为什么物联网如此重要?
    Pku3080 Blue Jeans
    pku1734 Musical Theme
    [Usaco2006 Dec]Milk Patterns
  • 原文地址:https://www.cnblogs.com/llife/p/11633006.html
Copyright © 2011-2022 走看看