eNSP-配置单臂路由与静态路由实验

单臂路由:

交换机和路由器之间仅有一条物理链路连接。在交换机上,把连接到路由器的端口配置为Trunk口,并允许Vlan的帧通过。在路由器上设置子接口,在逻辑上把一条物理链路分成多条逻辑链路。

一般步骤:

交换机:

        1.创建vlan。

        2.与主机相连的端口设置为access并允许相关vlan通过,与路由器相连的端口设置为trunk并允许所有vlan通过。

路由器:

        1.创建vlan。

        2.进入子接口(x.1、x.2、……);

        启用IEEE 802.1q封装;

        配置ip地址;

        启用arp broadcast.

静态路由:

        静态路由是一种路由的方式,路由项由手动配置,而非动态决定。与动态路由不同,静态路由是固定的,不会改变,即使网络状况已经改变或是重新被组态。一般来说,静态路由是由网络管理员逐项加入路由表。

命令:ip route-static <ip address>  <subnet mask> <nexthop-address>

        ip route-static 目标网段 子网掩码 下一跳端口地址

单臂路由与静态路由实验:

拓扑图:

 PC1:

 PC2:

 PC3:

首先配置单臂路由、各个路由器和交换机:

配置LSW1:

<Huawei>system-view 

[Huawei]sysname LSW1

[LSW1]vlan batch 10 20
 
[LSW1]interface Ethernet 0/0/1 

[LSW1-Ethernet0/0/1]port link-type access

[LSW1-Ethernet0/0/1]port default vlan 10

[LSW1-Ethernet0/0/1]quit

[LSW1]interface Ethernet 0/0/2

[LSW1-Ethernet0/0/2]port link-type access

[LSW1-Ethernet0/0/2]port default vlan 20

[LSW1-Ethernet0/0/2]quit

[LSW1]interface GigabitEthernet 0/0/1

[LSW1-GigabitEthernet0/0/1]port link-type trunk 

[LSW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20

[LSW1-GigabitEthernet0/0/1]quit

[LSW1]quit

配置R1:

<Huawei>system-view 

[Huawei]sysname R1

[R1]interface GigabitEthernet 0/0/1.1

[R1-GigabitEthernet0/0/1.1]dot1q termination vid 10

[R1-GigabitEthernet0/0/1.1]ip address 192.168.10.254 24

[R1-GigabitEthernet0/0/1.1]arp broadcast enable

[R1-GigabitEthernet0/0/1.1]quit 

[R1]interface GigabitEthernet 0/0/1.2

[R1-GigabitEthernet0/0/1.2]dot1q termination vid 20

[R1-GigabitEthernet0/0/1.2]ip address 192.168.20.254 24

[R1-GigabitEthernet0/0/1.2]arp broadcast enable

[R1-GigabitEthernet0/0/1.2]quit

[R1]interface GigabitEthernet 0/0/0

[R1-GigabitEthernet0/0/0]ip address 10.0.1.1 30

[R1-GigabitEthernet0/0/0]quit

[R1]quit

[R1-GigabitEthernet0/0/1.1]qu

配置S2:

<Huawei>system-view 
	
[Huawei]sysname R2

[R2]interface GigabitEthernet 0/0/0

[R2-GigabitEthernet0/0/0]ip address 10.0.1.2 30
	
[R2-GigabitEthernet0/0/0]quit 
	
[R2]interface Ethernet 0/0/1
	
[R2-Ethernet0/0/1]ip address 10.0.2.1 30

[R2-Ethernet0/0/1]quit

[R2]quit

接下来配置静态路由:

配置LSW1:

<LSW1>system-view 

[LSW1]ip route-static 10.0.1.0 30 192.168.10.254 

[LSW1]ip route-static 10.0.1.0 30 192.168.20.254

[LSW1]ip route-static 10.0.2.0 30 192.168.10.254

[LSW1]ip route-static 10.0.2.0 30 192.168.20.254

[LSW1]quit

<LSW1>save 

    The current configuration will be written to the device.
    Are you sure to continue?[Y/N]y
    Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
    Apr  5 2022 12:40:56-08:00 LSW1 %%01CFM/4/SAVE(l)[0]:The user chose Y when decid
    ing whether to save the configuration to the device.
    Now saving the current configuration to the slot 0.
    Save the configuration successfully.

配置R1:

<R1>system-view 

[R1]ip route-static 10.0.2.0 30 10.0.1.2

[R1]quit

<R1>save
 
    The current configuration will be written to the device.
    Are you sure to continue?[Y/N]y
    Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
    Now saving the current configuration to the slot 17.
    Save the configuration successfully.

配置R2:

<R2>system-view 

[R2]ip route-static 192.168.10.0 24 10.0.1.1

[R2]ip route-static 192.168.20.0 24 10.0.1.1

[R2]quit

<R2>save 
    The current configuration will be written to the device.
    Are you sure to continue?[Y/N]y
    Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
    Now saving the current configuration to the slot 17.
    Save the configuration successfully.

最后进行Ping测试:

  • 6
    点赞
  • 36
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

樱花于雪与你

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值