春风十里不如你 —— Taozi - 组网 https://www.xiongan.host/index.php/tag/%E7%BB%84%E7%BD%91/ 【ENSP】GRE协议基础配置 https://www.xiongan.host/index.php/archives/210/ 2023-05-22T19:07:26+08:00 GRE协议基础配置本实验模拟企业网络场景,R1为企业总部的网关设备,并且内部有一台服务器,R3连接着企业分公司网关设备,R2为公网ISP设备。一般情况下,运营商只会维护自身的公网路由信息,而不会维护企业内部私网的路由信息,即运营商设备上的路由表中不会出现任何企业内部私网的路由条目。通过配置GRE实现公司总部和分部间私网路由信息的透传及数据通信。拓扑实验实验步骤配置接口端口地址,根据上图信息进行配置检测R1、R3直连链路的连通性配置R1、R3默认路由[R1]ip route-static 0.0.0.0 0.0.0.0 10.1.12.2 [R3]ip route-static 0.0.0.0 0.0.0.0 10.1.23.2测试PC1和Server1的连通性可以观察到,跨越了互联网的两个私网网段之间默认是无法直接通信的。此时可以通过GRE协议来实现跨越了互联网的两个私网网段之间的通信。配置GRE Tunnel配置R1、R3的GRE tunnel在路由器R1、R3上配置GRE Tunnel,使用命令interface tunnel创建隧道接口,指定隧道模式为GRE。配置R1、R3 Tunnel接口的源地址为其S 1/0/0接口IP地址,目的地址为R1/R3的S 1/0/0接口IP地址。还要使用命令ip address配置Tunnel接口的IP地址,注意要在同一网段。 测试R1与目的地址的连通性检查R1、R3隧道接口状态检查R1、R3路由表配置基于GRE接口的动态路由协议测试PC1与Server1的连通性,发现还不能联通配置R1、R3 RIPv2协议检查R1、R3的RIP邻居检查R1、R3路由表测试PC1和Server1的连通性,可以看到已经联通查看R2的路由表 【ENSP】RSTP和MSTP基础配置 https://www.xiongan.host/index.php/archives/209/ 2023-05-22T19:00:23+08:00 RSTP、MSTP基础配置实验组网任务步骤设备开启STP,并将STP模式切换为RSTP[S1]stp enable [S1]stp mode rstp [S2]stp enable [S2]stp mode rstp [S3]stp enable [S3]stp mode rstp [S4]stp enable [S4]stp mode rstp查看STP的状态和统计信息摘要在S1上查看STP的状态和统计信息(S1为根桥交换机)根桥选举控制配置S1为主根桥,S2为备份根桥[S1]stp priority 4096 [S2]stp priority 8192在另外两台交换机保持默认桥优先级(32768)的情况下,S1拥有最小的桥优先级,S2次之。再次查看S1上的状态信息(此时S1的桥优先级为4096,并且此时仍然是根桥)取消S1、S2上手动调整桥优先级的配置,使用stp root命令指定根桥和备份根桥[S1]undo stp priority [S1]stp root primary [S2]undo stp priority [S2]stp root secondary查看S1和S2的stp状态信息S1的桥优先级为0,而S2的桥优先级为4096,此时S1为根桥,S2为备份根桥。修改接口开销控制根端口选举在S4上查看stp状态和统计信息S4上0/0/2拥有更小的RPC(根路径开销),从而成为根端口查看S4的0/0/2的STP状态和统计信息此时路径开销计算方法为Dotlt,接口的STP cost的值为20000修改S4的0/0/2的STP cost值为40001[S4]interface g0/0/2 [S4-GigabitEthernet0/0/2]stp cost 40001 [S4-GigabitEthernet0/0/2]查看s4的STP状态信息此时0/0/1的RPC为40000,小鱼0/0/2的RPC 40001 S4的0/0/1接口成为根端口修改接口优先级控制根端口选举查看S2的STP状态信息S2上GE0/0/10、GE0/0/11接口收到的BPDU拥有相同的RPC、网桥ID、接口优先级,此时将会比较接收到的BPDU接口ID中的接口编号。在S1、S2上开启LLDP,查看接口的互联关系[S1]lldp enable [S2]lldp enable [S2]display lldp neighbor briefS2的GE0/0/10接口对端为S1的GE0/0/10接口,S2的GE0/0/11接口对端为S1的GE0/0/11接口,S2的GE0/0/10接口接收到的BPDU拥有更小的接口编号,这是GE0/0/10成为根端口的原因在S1上修改GE0/0/11的STP接口优先级,使其发送的BPDU优于 GE0/0/10发送的BPDU[S1]interface GigabitEthernet 0/0/11 [S1-GigabitEthernet0/0/11] stp port priority 64STP接口优先级为128,数值越小越优。再次查看S2的stp状态信息此时S2的GE0/0/10接口成为根端口。MSTP基础配置在所有交换机上创建VLAN10、20、30、40、50、60、70、80,配置MSTP域hcip,并创建两个新的实例:Instance 1、Instance 2,将VLAN10、30、50、70映射到Instance 1,将VLAN20、40、60、80映射到Instance 2,同时将SW1规划为MSTI1的主根桥、MSTI2的备份根桥,将SW2规划为MSTI2的主根桥、MSTI1的备份根桥。[S1]vlan batch 10 20 30 40 50 60 70 80 [S2]vlan batch 10 20 30 40 50 60 70 80 [S3]vlan batch 10 20 30 40 50 60 70 80 [S4]vlan batch 10 20 30 40 50 60 70 80将所有的互联接口(S1、S2、S3、S4)配置为Trunk接口,放通所有的(接口端口)Vlaninterface GigabitEthernet0/0/10 port link-type trunk port trunk allow-pass vlan 10 20 30 40 50 60 70 80 # interface GigabitEthernet0/0/11 port link-type trunk port trunk allow-pass vlan 10 20 30 40 50 60 70 80 stp instance 0 port priority 64 # interface GigabitEthernet0/0/12 port link-type trunk port trunk allow-pass vlan 10 20 30 40 50 60 70 80 # interface GigabitEthernet0/0/13 port link-type trunk port trunk allow-pass vlan 10 20 30 40 50 60 70 80修改STP模式为MSTP[S1]stp mode mstp [S2]stp mode mstp [S3]stp mode mstp [S4]stp mode mstp配置MSTP[S1]stp region-configuration [S1-mst-region] region-name hcip [S1-mst-region] revision-level 1 [S1-mst-region] instance 1 vlan 10 30 50 70 [S1-mst-region] instance 2 vlan 20 40 60 80 [S1-mst-region] active region-configuration Info: This operation may take a few seconds. Please wait for a moment...done. [S1-mst-region] quit / [S2]stp region-configuration [S2-mst-region] region-name hcip [S2-mst-region] revision-level 1 [S2-mst-region] instance 1 vlan 10 30 50 70 [S2-mst-region] instance 2 vlan 20 40 60 80 [S2-mst-region] active region-configuration Info: This operation may take a few seconds. Please wait for a moment...done. [S2-mst-region] quit / [S3]stp region-configuration [S3-mst-region] region-name hcip [S3-mst-region] revision-level 1 [S3-mst-region] instance 1 vlan 10 30 50 70 [S3-mst-region] instance 2 vlan 20 40 60 80 [S3-mst-region] active region-configuration Info: This operation may take a few seconds. Please wait for a moment...done. [S3-mst-region] quit / [S4]stp region-configuration [S4-mst-region] region-name hcip [S4-mst-region] revision-level 1 [S4-mst-region] instance 1 vlan 10 30 50 70 [S4-mst-region] instance 2 vlan 20 40 60 80 [S4-mst-region] active region-configuration Info: This operation may take a few seconds. Please wait for a moment...done. [S4-mst-region] quit在S1上检查MSTP实例和Vlan的映射关系//配置SW1为MSTI1的根桥、MSTI2的备份根桥 [S1]stp instance 1 root primary [S1]stp instance 2 root secondary //配置SW2为MSTI2的根桥、MSTI1的备份根桥 [S2]stp instance 1 root secondary [S2]stp instance 2 root primary在S1上查看MST1状态信息S1上所有接口都是指定接口,S1为MSTI1的根桥S2上所有接口都是指定接口,S2为MSTI2的根桥。 【HCIP】路由策略与路由控制 https://www.xiongan.host/index.php/archives/203/ 2023-05-06T20:24:50+08:00 路由策略与路由控制实验组网每台设备都创建了Loopback0,地址为10.123.x.x/32(x为设备号)在R2、R4上测试ip连通性配置OSPF、IS-ISR1、R2、R3使用Loopback0接口地址作为Router ID,在互联接口、Loopback0接口上激活OSPF。//R1 [R1]ospf 1 router-id 10.123.1.1 [R1-ospf-1] area 0 [R1-ospf-1-area-0.0.0.0] network 10.123.1.1 0.0.0.0 [R1-ospf-1-area-0.0.0.0] network 10.123.12.1 0.0.0.0 [R1-ospf-1-area-0.0.0.0] quit [R1-ospf-1] quit//R2 [R2]ospf 1 router-id 10.123.2.2 [R2-ospf-1] area 0.0.0.0 [R2-ospf-1-area-0.0.0.0] network 10.123.2.2 0.0.0.0 [R2-ospf-1-area-0.0.0.0] network 10.123.12.2 0.0.0.0 [R2-ospf-1-area-0.0.0.0] network 10.123.23.2 0.0.0.0 [R2-ospf-1-area-0.0.0.0] quit [R2-ospf-1] quit//R3 [R3]ospf 1 router-id 10.123.3.3 [R3-ospf-1] area 0.0.0.0 [R3-ospf-1-area-0.0.0.0] network 10.123.3.3 0.0.0.0 [R3-ospf-1-area-0.0.0.0] network 10.123.23.3 0.0.0.0 [R3-ospf-1-area-0.0.0.0] quit [R3-ospf-1] quit在R2上检查OSPF邻居概要信息R3、R4上配置IS-IS,区域为49.0001,系统ID采用0000.0000.000x格式(x为设备编号),两台设备都为Level-1路由器,在互联接口、R4的Loopback0接口上激活IS-IS。//R3 [R3]isis 1 [R3-isis-1] is-level level-1 [R3-isis-1] network-entity 49.0001.0000.0000.0003.00 [R3-isis-1] quit [R3]interface GigabitEthernet0/0/1 [R3-GigabitEthernet0/0/1] isis enable 1 [R3-GigabitEthernet0/0/1] quit//R4 [R4]isis 1 [R4-isis-1] is-level level-1 [R4-isis-1] network-entity 49.0001.0000.0000.0004.00 [R4-isis-1] quit [R4]interface GigabitEthernet0/0/0 [R4-GigabitEthernet0/0/0] isis enable 1 [R4-GigabitEthernet0/0/0] quit [R4]interface LoopBack 0 [R4-LoopBack0] isis enable 1 [R4-LoopBack0] quit在R3上检查IS-IS邻居状态在R1上引入直连路由创建IP前缀列表1,匹配Loopback1接口路由(A业务网段)[R1]ip ip-prefix 1 index 10 permit 172.16.1.0 24 greater-equal 24 less-equal 24创建IP前缀列表2,匹配Loopback2接口路由(B业务网段)[R1]ip ip-prefix 2 index 10 permit 172.16.2.0 24 greater-equal 24 less-equal 24创建Route-Policy hcip,并创建节点10、20,分别调用IP前缀列表1、2,打上路由标记[R1]route-policy hcip permit node 10 [R1-route-policy] if-match ip-prefix 1 [R1-route-policy] apply tag 10 [R1-route-policy] quit [R1]route-policy hcip permit node 20 [R1-route-policy] if-match ip-prefix 2 [R1-route-policy] apply tag 20 [R1-route-policy] quit在R1的OSPF中引入直连路由,调用Route-Policy hcip[R1]ospf 1 [R1-ospf-1] import-route direct route-policy hcip在R1上查看OSPF LSDBLoopback1、2接口路由已经被成功引入OSPF中在R1上查看OSPF LSDB中AS-external LSA 172.16.1.0、172.16.2.0的相关信息在R2上配置过滤策略在R2上配置Filter-Policy对接收的OSPF路由进行过滤,只接收B业务网段的路由。查看配置Filter-Policy前的OSPF路由表查看配置Filter-Policy前的IP路由表中的OSPF路由配置基础ACL[R2]acl number 2000 [R2-acl-basic-2000] rule 5 deny source 172.16.1.0 0.0.0.255 [R2-acl-basic-2000] rule 10 permit在OSPF中部署入方向的Filter-Policy,调用ACL 2000[R2]ospf 1 [R2-ospf-1] filter-policy 2000 import查看配置Filter-Policy后的OSPF路由表查看配置Filter-Policy后的IP路由表中的OSPF路由在IP路由表中路由172.16.2.0/24已经不存在,但是在OSPF路由表中依旧存在。这验证了对于OSPF,Filter-Policy只是限制路由加入IP路由表,不影响本地的LSDB以及LSA的传递。在R3上查看IP路由表中的OSPF路由R3的IP路由表中OSPF外部路由172.16.1.0/24、172.16.2.0/24依旧存在在R3上将OSPF路由引入到IS-IS在R3上将OSPF路由引入到IS-IS中,通过Route-Policy匹配路由标记,只引入A业务网段的OSPF外部路由。创建Route-Policy hcip[R3]route-policy hcip permit node 10 [R3-route-policy] if-match tag 10 [R3-route-policy] quit在IS-IS中引入OSPF路由,调用Route-Policy hcip只引入A业务网段的OSPF外部路由[R3]isis 1 [R3-isis-1] import-route ospf 1 level-1 route-policy hcip查看R3的IS-IS路由表Level-1的路由重分发表中只有172.16.1.0/24。