OSPF的练习
由要求2可知,所有配置基于172.16.0.0 16去进行划分,为了减少资源浪费,将图中看为六个区域,IP地址划分为172.16.0.0 19、172.16.32.0 19、172.16.64.0 19、172.16.96.0 19、172.16.128.0 19、172.16.160.0 19,将六个区域对应六个划分后的地址。为了进一步减少资源浪费:
对区域0的172.16.0.0 19进一步划分为172.16.0.0 30(P2P骨干链路...172.16.0.4 30、172.16.0.8 30)
对区域1的172.16.32.0 19划分为172.16.32.0 24(P2P骨干链路...172.16.32.0 30、172.16.32.4 30、172.16.32.8 30等等)和172.16.33.0 24(MA链路...172.16.33.0 29、172.16.33.8 29、172.16.33.16 29等等)和172.16.34.0 24(用户网段...172.16.35.0 24等等)
对区域2的172.16.64.0 19划分为172.16.64.0 24(P2P骨干链路...172.16.64.0 30、172.16.64.4 30、172.16.64.8 30等等)和172.16.65.0 24(MA链路...172.16.65.0 29、172.16.65.8 29、172.16.65.16 29等等)和172.16.66.0 24(用户网段...172.16.67.0 24等等)
对区域3的172.16.96.0 19划分为172.16.96.0 24(P2P骨干链路...172.16.96.0 30、172.16.96.4 30、172.16.96.8 30等等)和172.16.97.0 24(MA链路...172.16.97.0 29、172.16.97.8 29、172.16.97.16 29等等)和172.16.98.0 24(用户网段...172.16.99.0 24等等)
对区域4的172.16.128.0 19划分为172.16.128.0 24(P2P骨干链路...172.16.128.0 30、172.16.128.4 30、172.16.128.8 30等等)和172.16.129.0 24(MA链路...172.16.33.0 29、172.16.129.8 29、172.16.129.16 29等等)和172.16.130.0 24(用户网段...172.16.131.0 24等等)
对区域5(rip)的172.16.160.0 19划分为172.16.160.0 24(P2P骨干链路...172.16.160.0 30、172.16.160.4 30、172.16.160.8 30等等)和172.16.161.0 24(MA链路...172.16.33.0 29、172.16.161.8 29、172.16.161.16 29等等)和172.16.162.0 24(用户网段...172.16.163.0 24等等)
接下来为配置代码:
R1:
[R1-GigabitEthernet0/0/0]ip address 172.16.33.1 29
[R1-LoopBack0]ip address 172.16.34.1 24
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.31.255
[R1]ospf 1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]stub(设置特殊区域)
R2:
[R2-GigabitEthernet0/0/0]ip address 172.16.33.2 29
[R2-LoopBack0]ip address 172.16.35.1 24
[R2-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.31.255
[R2]ospf 1
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]stub(设置特殊区域)
R3:
[R3-GigabitEthernet0/0/1]ip address 172.16.0.2 30
[R3-GigabitEthernet0/0/0]ip address 172.16.33.3 29
[R3-LoopBack0]ip address 172.16.36.1 24
[R3-ospf-1-area-0.0.0.1]network 172.16.33.3 0.0.0.0
[R3]ospf 1 router-id 3.3.3.3[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.31.255
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0(汇总)
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]stub(设置特殊区域)[R3-ospf-1-area-0.0.0.1]stub no-summary(进一步优化)
[R3-GigabitEthernet0/0/1]ospf network-type p2p(将R3中的0/0/1接口改为P2P类型,加快收敛)
[R3-GigabitEthernet0/0/1]ospf timer hello 2(hello时间改为两秒)
[R3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456(安全认证)
R4:
R4-GigabitEthernet0/0/1]ip address 172.16.0.1 30
[R4-GigabitEthernet0/0/2]ip address 172.16.0.5 30
[R4-GigabitEthernet0/0/0]ip address 172.16.0.13 30
[R4-Serial4/0/1]ip address 172.16.0.9 30
[R4-Serial4/0/1]ppp chap user huawei(进行认证)[R4-Serial4/0/1]ppp chap password cipher 123456
[R4]ospf 1 router-id 4.4.4.4[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.31.255
[R4-GigabitEthernet0/0/1]ospf network-type p2p(将R4中的0/0/1接口改为P2P类型,加快收敛)
[R4-GigabitEthernet0/0/2]ospf network-type p2p(将R4中的0/0/2接口改为P2P类型,加快收敛)
[R4-GigabitEthernet0/0/0]ospf network-type p2p(将R4中的0/0/0接口改为P2P类型,加快收敛)
[R4-GigabitEthernet0/0/1]ospf timer hello 2(hello时间改为两秒)
[R4-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456(安全认证)
[R4]ip route-static 0.0.0.0 0 172.16.0.10(设置缺省)
[R4-ospf-1]default-route-advertise (下发缺省)
[R4]acl 2000(抓取流量)
[R4-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255(把所有172.16.0.0的网段都抓取)
[R4-Serial4/0/1]nat outbound 2000(使用nat)
R5(ISP):
[ISP-Serial4/0/0]ip address 172.16.0.10 30
[ISP]aaa[ISP-aaa]local-user huawei password cipher 123456
[ISP-aaa]local-user huawei service-type ppp(用户服务于ppp)
[ISP-Serial4/0/0]link-protocol ppp[ISP-Serial4/0/0]ppp authentication-mode chap (从接口发出的ppp都要经过chap认证)
[ISP-Serial4/0/0]remote address 45.0.0.2(下发地址)
[ISP-LoopBack0]ip address 5.5.5.5 32
R6:
[R6-GigabitEthernet0/0/1]ip address 172.16.0.6 30
[R6-LoopBack0]ip address 172.16.2.1 24[R6-GigabitEthernet0/0/0]ip address 172.16.64.1 30
[R6]ospf 1 router-id 6.6.6.6[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]network 172.16.64.1 0.0.0.0
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0[R6-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.31.255
[R6]ospf 1
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0(汇总)
[R6]ospf 1
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary(设置特殊区域)[R6-GigabitEthernet0/0/1]ospf network-type p2p(将R6中的0/0/1接口改为P2P类型,加快收敛)
R7:
[R7-GigabitEthernet0/0/0]ip address 172.16.0.14 30
[R7-LoopBack0]ip address 172.16.3.1 24
[R7-GigabitEthernet0/0/1]ip address 172.16.96.1 30
[R7]ospf 1 router-id 7.7.7.7[R7-ospf-1]area 0
[R7-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.31.255
[R7-ospf-1]area 3[R7-ospf-1-area-0.0.0.3]network 172.16.96.0 0.0.31.255
[R7]ospf 1
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0(汇总)
[R7]ospf 1
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary(设置特殊区域)[R7-GigabitEthernet0/0/0]ospf network-type p2p(将R7中的0/0/0接口改为P2P类型,加快收敛)
R8:
[R8-GigabitEthernet0/0/0]ip address 172.16.96.2 30
[R8-GigabitEthernet0/0/1]ip address 172.16.96.5 30
[R8-LoopBack0]ip address 172.16.98.1 24[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]network 172.16.96.0 0.0.31.255
[R8]ospf 1
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]nssa(设置特殊区域)
R9:
[R9-GigabitEthernet0/0/0]ip address 172.16.96.6 30
[R9-GigabitEthernet0/0/1]ip address 172.16.128.1 30
[R9-LoopBack0]ip address 172.16.130.1 24
[R9]ospf 1 router-id 9.9.9.9[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]network 172.16.96.0 0.0.31.255
[R9]ospf 2 router-id 9.9.9.9[R9-ospf-2]area 0
[R9-ospf-2-area-0.0.0.0]network 172.16.128.0 0.0.31.255
[R9]ospf 1[R9-ospf-1]import-route ospf 2(引入ospf 2)
[R9]ospf 2
[R9-ospf-2]import-route ospf 1(引入ospf 1)
[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0(汇总)
[R9]ospf 1
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]nssa(设置特殊区域)[R9-ospf-2]default-route-advertise (下发缺省)
R10:
[R10-GigabitEthernet0/0/0]ip address 172.16.128.2 30
[R10-LoopBack0]ip address 172.16.131.1 24
[R10]ospf 1 router-id 10.10.10.10[R10-ospf-1]area 0
[R10-ospf-1-area-0.0.0.0]network 172.16.128.0 0.0.31.255
R11:
[R11-GigabitEthernet0/0/0]ip address 172.16.64.2 30
[R11-LoopBack0]ip address 172.16.66.1 24
[R11-GigabitEthernet0/0/1]ip address 172.16.64.5[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]network 172.16.0.0 0.0.255.255
[R11]ospf 1
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]nssa no-summary(设置特殊区域)
R12:
[R12-LoopBack0]ip address 172.16.162.1 24
[R12-LoopBack1]ip address 172.16.163.1 24[R12-GigabitEthernet0/0/0]ip address 172.16.64.6 30
[R12]ospf 1 router-id 12.12.12.12[R12-ospf-1-area-0.0.0.2]network 172.16.64.6 0.0.0.0
[R12]rip 1[R12-rip-1]version 2
[R12-rip-1]network 172.16.0.0
[R12]ospf 1
[R12-ospf-1]import-route rip(引入rip路由)
[R12]ospf 1
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0(汇总)
[R12]ospf 1
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]nssa(设置特殊区域)
到此为止全部网络已经做通!!!!!!
R1去访问ISP(运营商)
R1去访问rip网络
原文地址:https://blog.csdn.net/2301_81587137/article/details/143817852
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!