春风十里不如你 —— Taozi - 协议 2023-05-22T19:07:26+08:00 Typecho https://www.xiongan.host/index.php/feed/atom/tag/%E5%8D%8F%E8%AE%AE/ <![CDATA[【ENSP】GRE协议基础配置]]> https://www.xiongan.host/index.php/archives/210/ 2023-05-22T19:07:26+08:00 2023-05-22T19:07:26+08:00 admin https://www.xiongan.host GRE协议基础配置

本实验模拟企业网络场景,R1为企业总部的网关设备,并且内部有一台服务器,R3连接着企业分公司网关设备,R2为公网ISP设备。一般情况下,运营商只会维护自身的公网路由信息,而不会维护企业内部私网的路由信息,即运营商设备上的路由表中不会出现任何企业内部私网的路由条目。通过配置GRE实现公司总部和分部间私网路由信息的透传及数据通信。

拓扑实验

1684725003897

1684724964839

实验步骤

配置接口端口地址,根据上图信息进行配置

检测R1、R3直连链路的连通性

1684725679943

1684725739113

配置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的连通性

1684726077765

可以观察到,跨越了互联网的两个私网网段之间默认是无法直接通信的。此时可以通过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地址,注意要在同一网段。

1684726463543

1684726570311

测试R1与目的地址的连通性

1684726676501

检查R1、R3隧道接口状态

1684726763561

1684726845074

检查R1、R3路由表

1684726889733

1684726908531

配置基于GRE接口的动态路由协议

测试PC1与Server1的连通性,发现还不能联通

1684727035010

配置R1、R3 RIPv2协议

1684727119110

1684727171142

检查R1、R3的RIP邻居

1684727223382

1684727242742

检查R1、R3路由表

1684727283255

1684727309531

测试PC1和Server1的连通性,可以看到已经联通

1684727349281

查看R2的路由表

1684727393881

]]>
<![CDATA[【ENSP】RSTP和MSTP基础配置]]> https://www.xiongan.host/index.php/archives/209/ 2023-05-22T19:00:23+08:00 2023-05-22T19:00:23+08:00 admin https://www.xiongan.host RSTP、MSTP基础配置

实验组网

1684719281673

任务步骤

设备开启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

1684720282267

查看STP的状态和统计信息摘要

1684720489701

1684720513926

1684720543670

1684720568088

在S1上查看STP的状态和统计信息(S1为根桥交换机)

1684720917704

根桥选举控制

配置S1为主根桥,S2为备份根桥

[S1]stp priority 4096
[S2]stp priority 8192

在另外两台交换机保持默认桥优先级(32768)的情况下,S1拥有最小的桥优先级,S2次之。

再次查看S1上的状态信息(此时S1的桥优先级为4096,并且此时仍然是根桥)

1684721119496

取消S1、S2上手动调整桥优先级的配置,使用stp root命令指定根桥和备份根桥

[S1]undo stp priority
[S1]stp root primary
[S2]undo stp priority
[S2]stp root secondary

查看S1和S2的stp状态信息

1684721311217

1684721329737

S1的桥优先级为0,而S2的桥优先级为4096,此时S1为根桥,S2为备份根桥。

修改接口开销控制根端口选举

在S4上查看stp状态和统计信息

1684721474502

S4上0/0/2拥有更小的RPC(根路径开销),从而成为根端口

查看S4的0/0/2的STP状态和统计信息

1684721623276

此时路径开销计算方法为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状态信息

1684721879063

此时0/0/1的RPC为40000,小鱼0/0/2的RPC 40001 S4的0/0/1接口成为根端口

修改接口优先级控制根端口选举

查看S2的STP状态信息

1684722038120

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 brief

1684722179609

S2的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 64

STP接口优先级为128,数值越小越优。

再次查看S2的stp状态信息

1684722305430

此时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接口,放通所有的(接口端口)Vlan

interface 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的映射关系

1684722873417

//配置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状态信息

1684724119504

S1上所有接口都是指定接口,S1为MSTI1的根桥

1684724164486

S2上所有接口都是指定接口,S2为MSTI2的根桥。

]]>