春风十里不如你 —— Taozi - 华为 2024-04-06T07:47:35+08:00 Typecho https://www.xiongan.host/index.php/feed/atom/tag/%E5%8D%8E%E4%B8%BA/ <![CDATA[华为S系列的交换机Telnet登录]]> https://www.xiongan.host/index.php/archives/230/ 2024-04-06T07:47:35+08:00 2024-04-06T07:47:35+08:00 admin https://www.xiongan.host telnet01.png

通过telent登录交换机

应用场景:两台物理交换机(同段)之间的telnet访问 SW2 可以 以AAA验证方式登录到SW1的VRP系统

已经配置好了交换机的vlanif 2端口ip (两台都在同段)

具体配置

  1. 配置Telnet登录所用的VTY用户界面的终端属性,指定VTY 0\~4这5条VTY虚拟通道可以用于登录

    [SW1]user-interface vty 0 4
    [SW1-ui-vty0-4]idle-timeout 20  //设置超时间为20分钟
    [SW1-ui-vty0-4]history-command max-size 20   //设置历史命令缓冲区的大小为20
  2. 配置Telnet登录VTY用户界面的AAA验证方式和用户类别

    [SW1-ui-vty0-4]authentication-mode aaa
    [SW1-ui-vty0-4]user privilege level 15
    [SW1-ui-vty0-4]q
  3. 配置控制通过Telnet访问交换机的用户ACL策略

    [SW1]user-interface maximum-vty 5  //设置VTY用户界面的最大个数
    [SW1]acl 2001
    [SW1-acl-basic-2001]rule permit source xxx  //配置仅允许IP地址xx的主机访问
    [SW1-acl-basic-2001]q
    [SW1]user-interface vty 0 4
    [SW1-ui-vty0-4]acl 2001 inbound //在VTY 0-4这5个用户界面中应用上面的ACL
  4. 创建用于Telnet登录AAA验证的用户名和密码

    [SW1]aaa
    [SW1-aaa]local-user huawei password cipher hello@123 //设置用户密码
    [SW1-aaa]local-user huawei service-type telnet //设置该用户的服务类型为telnet
    [SW1-aaa]local-user huawei privilege level 15 //生效级别设置的15
  5. 开启Telnet服务器功能,并设置端口

    [SW1]telnet server enable
    [SW1]telnet server port 1028

测试结果查看,在SW2测试telnet交换机SW1

image-20240406074230226.png

]]>
<![CDATA[【华为数通】MPLS-Vpn基础实验案例(企业级)]]> https://www.xiongan.host/index.php/archives/222/ 2023-09-25T16:08:29+08:00 2023-09-25T16:08:29+08:00 admin https://www.xiongan.host MPLS-VPN基础实验案例

整体拓扑

image-20230925140615634

要求:某公司在北京设有总部并且在重庆设置分部。公司希望两个区域的员工可以通过私网路由互相访问。在网络边缘设备上使用BGP协议将私网路由发送给运营商,同时需要保证网络信息的安全性。R1,R2,R3,R4属于AS100模拟运营商。运营商内部使用OSPF协议实现IGP互通。在R1,R4建立MP-IBGP邻居,使用MPLS VPN技术使两个区域通过私网路由互访。

环境配置

首先配置好各个路由器的接口地址以及路由器的环回口地址

在R1上创建实例:

在R1上创建VPN实例1,并将实例1和接口G0/0/0绑定。需注意,在接口上进行实例的绑定后,原配置IP地址会清空,需要重新配置IP地址。
VPN实例用于将VPN私网路由域公网路由隔离,不同VPN实例中的路由也是相互隔离的。
在实例中需要配置RD值和RT值,RD用于区分每个VPN实例的VPN路由,最好保证RD值全网唯一,保证路由在公网传递时不冲突;RT值用于控制VPN路由信息的接收和发布。

image-20230925142249408

image-20230925142323710

在R4上创建实例:

image-20230925142614878

部署OSPF

在R1上配置ospf:

image-20230925142910235

在R2上配置ospf:

image-20230925143058675

在R3上配置ospf:

image-20230925143216232

在R4上配置ospf:

image-20230925143522497

在R5上配置ospf:

image-20230925143707104

在R6上配置ospf:

image-20230925143959619

在R1上查看邻居关系:

image-20230925144159861

可以观察到,R1与R2,R5成功建立OSPF邻居关系。

配置MPLS

在R1上配置mpls:

image-20230925144826948

在R2上配置mpls:

image-20230925151331473

在R3上配置mpls:

image-20230925145206723

在R4上配置mpls:

image-20230925145334917

配置BGP

在R1上配置BGP:

在R1与R4之间使用环回口建立IBGP邻居关系。

image-20230925145539149

在R4上配置BGP:

image-20230925145731150

在R1上查看BGO vpnv4邻居关系:

image-20230925145834905

在R1上路由引入:

在R1上将实例中的路由引入进BGP中,通过Vpn4路由向外通告,并将BGP的路由引入进OSPF实例下。由于BGP协议可承载的路由条目更多,为了防止后期引入路由条目过多,设备的负载压力过大,使用路由控制,只引入重庆分公司的路由。

image-20230925150245557

在R4上路由引入:

在R4上将实例中的路由引入进BGP中,通过Vpn4路由向外通告,并将BGP的路由引入进OSPF实例下。由于BGP协议可承载的路由条目更多,为了防止后期引入路由条目过多,设备的负载压力过大,使用路由控制,只引入北京总公司的路由。

在R1上查看标签交换路径:

可以观察到,在R1上有AS100内所有的32位环回口地址的FEC,并且为北京总公司的网络生成Vpnv4标签

image-20230925151724185

在R5上查看路由:

image-20230925151925064

可以观察到,R5通过OSPF学习到重庆分公司的6.6.6.6/32的路由。
本路由在R4上通过Vpnv4路由传递给R1,并在R1的OSPF实例下引入BGP路由学习到。

在R5上ping测试:

image-20230925152016442

]]>
<![CDATA[【华为数通】MPLS的基础配置]]> https://www.xiongan.host/index.php/archives/221/ 2023-09-19T12:30:45+08:00 2023-09-19T12:30:45+08:00 admin https://www.xiongan.host MPLS的基础配置

整体拓扑

image-20230919102958463

首先配置各个路由器及接口ip地址

配置OSPF

R1:
[R1-ospf-1]dis this
[V200R003C00]
#
ospf 1 router-id 1.1.1.1 
 area 0.0.0.0 
  network 10.1.1.1 0.0.0.0 
  network 10.123.12.1 0.0.0.0 
#
return
R2:
[R2-ospf-1]dis this
[V200R003C00]
#
ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 10.123.12.2 0.0.0.0 
  network 10.123.23.2 0.0.0.0 
  network 20.1.1.1 0.0.0.0 
#
return
R3:
[R3-ospf-1]dis this
[V200R003C00]
#
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 10.123.23.3 0.0.0.0 
  network 10.123.34.3 0.0.0.0 
  network 30.1.1.1 0.0.0.0 
#
return
R4:
[R4-ospf-1]dis this
[V200R003C00]
#
ospf 1 router-id 4.4.4.4 
 area 0.0.0.0 
  network 10.123.34.4 0.0.0.0 
  network 10.123.45.4 0.0.0.0 
  network 40.1.1.1 0.0.0.0 
#
return
R5:
[R5-ospf-1]dis this
[V200R003C00]
#
ospf 1 router-id 5.5.5.5 
 area 0.0.0.0 
  network 10.123.45.5 0.0.0.0 
#
return

在R9上检查路由表

image-20230919105035307

配置MPLS

在R1上配置MPLS

image-20230919110025677

在R2上配置MPLS

image-20230919110212764

在R3上配置MPLS

image-20230919110314888

在R4上配置MPLS

image-20230919110424501

配置MPLS 静态LSP

在R1上配置静态LSP

R1作为ingress设备在去往40.1.1.1/32和 10.123.45.0/24网络时打上标签,同时作为egress设备,当收到标签为201或者205时弹出标签进行路由转发。

[R1]static-lsp ingress 1to4 destination 40.1.1.1 32 nexthop 10.123.12.2 out-labe
l 104
[R1]static-lsp ingress 1to45 destination 10.123.45.0 24 nexthop 10.123.12.2 out-
label 105
[R1]static-lsp egress 4to1 incoming-interface g0/0/0 in-label 201
[R1]static-lsp egress 45to1 incoming-interface g0/0/0 in-label 205

在R2上配置静态LSP

R2作为Transit设备进行标签的交换。

[R2]static-lsp transit 1to4 incoming-interface GigabitEthernet 0/0/0 in-label 10
4 nexthop 10.123.23.3 out-label 204
[R2]static-lsp transit 1to45 incoming-interface GigabitEthernet 0/0/0 in-label 1
05 nexthop 10.123.23.3 out-label 205
[R2]static-lsp transit 4to1 incoming-interface GigabitEthernet0/0/1 in-label 301
 nexthop 10.123.12.1 out-label 201
[R2]static-lsp transit 45to1 incoming-interface GigabitEthernet0/0/1 in-label 30
5  nexthop 10.123.12.1 out-label 205

在R3上配置静态LSP

R3作为Transit设备进行标签交换。

[R3]static-lsp transit 1to4 incoming-interface GigabitEthernet 0/0/0 in-label 20
4 nexthop 10.123.34.4 out-label 304
[R3]static-lsp transit 4to1 incoming-interface GigabitEthernet0/0/1 in-label 401
 nexthop 10.123.23.2 out-label 301
[R3]static-lsp transit 1to45 incoming-interface GigabitEthernet 0/0/0 in-label 2
05 nexthop 10.123.23.3 out-label 305
[R3]static-lsp transit 45to1 incoming-interface GigabitEthernet0/0/1 in-label 40
5 nexthop 10.123.23.2 out-label 305

在R4上配置静态LSP

R4与R1类似,同样既作为ingress设备又作为egress设备。作为ingress设备在去往40.1.1.1/32和 10.123.45.0/24网络时打上标签,同时作为egress设备,当收到标签为201或者205时弹出标签进行路由转发。

[R4]static-lsp egress 1to4 incoming-interface g0/0/0 in-label 304
[R4]static-lsp egress 1to45 incoming-interface g0/0/0 in-label 305
[R4]static-lsp ingress 4to1 destination 10.1.1.1 32 nexthop 10.123.34.3 out-labe
l 401

在R1上查看标签交换路径:

标签路径中有In/Out Label,在mpls中,Out Label为空时,表示该FEC是由本路由器向上游发布标签,该路由器一般是该FEC的egress设备。In Label是指本路由器为某个FEC分配给对端的Out Label标签,当In Label为空时,表示本路由器是该LSP的最上游路由器,一般是ingress设备。

image-20230919113901613

在R2上查看

image-20230919114005814

在R3上查看

image-20230919114040102

在R4上查看

image-20230919114103033

在R1上Ping测试

image-20230919114154599

右键点击R1设备,选择数据抓包中的G0/0/0接口进行抓包。在R1上带环回口ping测试R4的环回口地址。

进入抓包界面,点击源为10.1.1.1,目的地址为40.1.1.1的数据包查看。我们可以观察到,在数据包中存在MPLS的头部,由此,判断出10.1.1.1访问40.1.1.1走的是MPLS的路径。

image-20230919114844462

]]>
<![CDATA[华为ENSP配置一个静态路由【案例】]]> https://www.xiongan.host/index.php/archives/12/ 2022-09-27T19:23:00+08:00 2022-09-27T19:23:00+08:00 admin https://www.xiongan.host 静态路由AR配置

拓扑图
案例要求:需要不通网段的PC1与PC2、PC3主机分别ping通
准备:三台PC端主机、三台路由器(AR2220)
操作:

  1. 配置PC端网络信息
    PC1配置截图:
    PC1
    注意:配置静态路由无需选择DHCP分配,需要自己设置的,这里的网关即下列步骤中的AR1的GE0的串口端ip
    PC2、PC3的配置同理
  2. 配置路由器
    打开路由器AR1后配置:
    system-view #进入系统界面
    [Huawei]interface GigabitEthernet 0/0/0 # 进入G端口
    [Huawei-GigabitEthernet0/0/0]ip addr 10.123.1.1 24 # 配置G端口的IP地址和子网掩码
    [Huawei-GigabitEthernet0/0/0]quit # 返回上一界面
    [Huawei]interface GigabitEthernet 0/0/1
    [Huawei-GigabitEthernet0/0/1]ip addr 1.1.1.1 24
    [Huawei-GigabitEthernet0/0/1]quit
    [Huawei]ip route-static 20.123.1.0 24 1.1.1.2 # 配置添加静态路由信息,目标网络,掩码,下一跳
    [Huawei]interface GigabitEthernet 0/0/2 # 进入G端口
    [Huawei-GigabitEthernet0/0/2]ip addr 2.2.2.1 24 # 配置G端口的IP地址和子网掩码
    [Huawei-GigabitEthernet0/0/2]quit
    [Huawei] ip route-static 30.123.1.0 24 2.2.2.2
    查看路由表:
    AR1路由表
    其中static标识的就是咱们设置的静态地址路由
    配置AR2路由器:
    system-view
    [Huawei]interface GigabitEthernet 0/0/0
    [Huawei-GigabitEthernet0/0/0]ip addr 1.1.1.2 24
    [Huawei-GigabitEthernet0/0/0]quit
    [Huawei]interface GigabitEthernet 0/0/1
    [Huawei-GigabitEthernet0/0/1]ip addr 20.123.1.1 24
    [Huawei-GigabitEthernet0/0/1]quit
    [Huawei]ip route-static 10.123.1.0 30 1.1.1.1
    查看AR2路由表:
    AR2路由表
    配置AR3路由器:
    system-view
    [Huawei]interface GigabitEthernet 0/0/0
    [Huawei-GigabitEthernet0/0/0]ip addr 30.123.1.1 24
    [Huawei-GigabitEthernet0/0/0]quit
    [Huawei]interface GigabitEthernet 0/0/1
    [Huawei-GigabitEthernet0/0/1]ip addr 2.2.2.2 24
    [Huawei-GigabitEthernet0/0/1]quit
    [Huawei]ip route-static 10.123.1.0 30 2.2.2.1
    查看AR3路由表:
    AR3路由表
  3. 测试路由
    测试1
    测试2

交换机switch配置三台静态路由

Switch1:
#
sysname S1
#
vlan batch 10 40 50
#
interface Vlanif40
ip address 10.1.4.2 255.255.255.252
#
interface Vlanif50
ip address 10.1.4.5 255.255.255.252
#
interface Vlanif10
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 40
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 50
#
ip route-static 10.1.2.0 255.255.255.0 10.1.4.1
ip route-static 10.1.3.0 255.255.255.0 10.1.4.6
#
return
Switch2:
#
sysname S2
#
vlan batch 20 40
#
interface Vlanif40
ip address 10.1.4.1 255.255.255.252
#
interface Vlanif20
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 40
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
#
ip route-static 0.0.0.0 0.0.0.0 10.1.4.2
#
return
Switch3:
#
sysname S3
#
vlan batch 30 50
#
interface Vlanif50
ip address 10.1.4.6 255.255.255.252
#
interface Vlanif30
ip address 10.1.3.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 50
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 30
#
ip route-static 0.0.0.0 0.0.0.0 10.1.4.5
#
return

测试连通性(10.1.2.1 ping 10.1.3.1)

]]>