华为ensp静态路由配置
简单配置静态路由;本人学习了3天学会了静态路由的配置,如不对地方,多多指教,谢谢!
1.直连路由“不需要”配置路由,跨设置之间需要配置路由协议!
2.多多练习才能达到一定的学习效果!
3.一三570六五286八;可联系本人,共同学习,共同努力!!!!!
4.本人处于初学中,希望能得到大家的帮助,学习更多的知识点
5.再次感谢大家的检查及帮助!
文章目录
文章目录
一、静态路由是什么?
示例:静态路由(英语:Static routing)是一种路由的方式,路由项(routing entry)由手动配置,而非动态决定。与动态路由不同,静态路由是固定的,不会改变,即使网络状况已经改变或是重新被组态。一般来说,静态路由是由网络管理员逐项加入路由表。
二、使用步骤
1.AR1;路由器配置
如下(示例):
The device is running!
<Huawei>system-view ##进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info enable ##关闭提醒信息
Info: Information center is disabled.
[Huawei]sysname AR1 ##修改设备名称为:AR1
[AR1]int g0/0/0 ##进入端口g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 10.0.0.1 255.255.255.0 ##在g0/0/0端口配置ip地址
[AR1-GigabitEthernet0/0/0]quit ##退出端口
[AR1]int g0/0/1 ##进入端口g0/0/1
[AR1-GigabitEthernet0/0/1]ip add 20.0.0.2 255.255.255.0 ##在g0/0/1端口配置ip地址
[AR1-GigabitEthernet0/0/1]quit ##退出端口
[AR1]
[AR1]ip route-static 192.168.10.0 255.255.255.0 10.0.0.2
[AR1]ip route-static 192.168.20.0 255.255.255.0 10.0.0.2 ### 配置静态路由;到 PC 网段;即:目标网段+子网掩码+下一跳(端口IP地址)###
[AR1]ip route-static 192.168.30.0 255.255.255.0 10.0.0.2
[AR1]quit ##退出端口
<AR1>
<AR1>save #保存配置
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
<AR1>
2.LSW1;核心交换机配置如下
代码如下(示例):
The device is running!
<Huawei>system-view #进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info enable #关闭提醒信息
Info: Information center is disabled.
[Huawei]vlan batch 10 20 30 40 #创建多个vlan 10 20 30 40
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int g0/0/2 #进入g0/0/2端口
[Huawei-GigabitEthernet0/0/2]port link-type trunk #端口类型配置为:trunk
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20 30 40 #允许通过vlan 10 20 30 40
[Huawei-GigabitEthernet0/0/2]undo port trunk allow-pass vlan 1 #关闭端口不允许vlan 1通过
[Huawei-GigabitEthernet0/0/2]int vlanif 10 #进入vlanif 10
[Huawei-Vlanif10]ip add 192.168.10.254 255.255.255.0 #配置vlanif 10 的IP地址
[Huawei-Vlanif10]quit #退出
[Huawei]int g0/0/3 #进入g0/0/3端口
[Huawei-GigabitEthernet0/0/3]port link-type trunk #端口类型配置为:trunk
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 20 30 40 #允许通过vlan 10 20 30 40
[Huawei-GigabitEthernet0/0/3]undo port trunk allow-pass vlan 1 #关闭端口不允许vlan 1通过
[Huawei-GigabitEthernet0/0/3]int vlanif 20 #进入vlanif 20
[Huawei-Vlanif20]ip add 192.168.20.254 255.255.255.0 #配置vlanif 20 的IP地址
[Huawei-Vlanif20]quit #退出
[Huawei]int g0/0/4 #进入g0/0/4端口
[Huawei-GigabitEthernet0/0/4]port link-type trunk #端口类型配置为:trunk
[Huawei-GigabitEthernet0/0/4]port trunk allow-pass vlan 10 20 30 40 #允许通过vlan 10 20 30 40
[Huawei-GigabitEthernet0/0/4]undo port trunk allow-pass vlan 1 #关闭端口不允许vlan 1通过
[Huawei-GigabitEthernet0/0/4]int vlanif 30 #进入vlanif 30
[Huawei-Vlanif30]ip add 192.168.30.254 255.255.255.0 #配置vlanif 30 的IP地址
[Huawei-Vlanif30]quit #退出
[Huawei]int g0/0/1 #进入g0/0/1端口
[Huawei-GigabitEthernet0/0/1]port link-type access #端口类型配置为:access
[Huawei-GigabitEthernet0/0/1]port default vlan 40 #配置只通过vlan 40
[Huawei-GigabitEthernet0/0/1]int vlanif 40 #进入vlanif 40
[Huawei-Vlanif40]ip add 10.0.0.2 255.255.255.0 #配置vlanif 40 的IP地址
[Huawei-Vlanif40]quit #退出
[Huawei]
[Huawei]ip route-static 20.0.0.0 255.255.255.0 10.0.0.1 #配置静态路由;目标网段+子网掩码+下一跳(端口IP地址)
[Huawei]quit #退出
<Huawei>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 0.
Save the configuration successfully.
<Huawei>
3.LSW2;接入层交换机配置如下
代码如下(示例):
The device is running!
<Huawei>
<Huawei>system-view #进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info enable #关闭提醒信息
Info: Information center is disabled.
[Huawei]sysname SW2 #修改设备名称为:SW2
[SW2]vlan 10 #创建vlan 10
[SW2-vlan10]quit #退出
[SW2]int g0/0/2 #进入g0/0/2端口
[SW2-GigabitEthernet0/0/2]port link-type access #端口类型配置为:access
[SW2-GigabitEthernet0/0/2]port default vlan 10 #配置只通过vlan 10
[SW2-GigabitEthernet0/0/2]quit #退出
[SW2]int g0/0/3 #进入g0/0/3端口
[SW2-GigabitEthernet0/0/3]port link-type access #端口类型配置为:access
[SW2-GigabitEthernet0/0/3]port default vlan 10 #配置只通过vlan 10
[SW2-GigabitEthernet0/0/3]quit #退出
[SW2]int g0/0/1 #进入g0/0/1端口
[SW2-GigabitEthernet0/0/1]port link-type trunk #端口类型配置为:trunk
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 #配置trunk 可以通过vlan10
[SW2-GigabitEthernet0/0/1]undo port trunk allow-pass vlan 1 #关闭端口不允许vlan 1通过
[SW2-GigabitEthernet0/0/1]quit #退出
[SW2]
<SW2>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 0.
Save the configuration successfully.
<SW2>
4.LSW3;接入层交换机配置如下
代码如下(示例):
The device is running!
<Huawei>
<Huawei>system-view #进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info enable #关闭提醒信息
Info: Information center is disabled.
[SW3]sysname SW3 #修改设备名称为:SW3
[SW3]vlan 20 #创建vlan 20
[SW3-vlan20]quit #退出
[SW3]int g0/0/2 #进入g0/0/2端口
[SW3-GigabitEthernet0/0/2]port link-type access #端口类型配置为:access
[SW3-GigabitEthernet0/0/2]port default vlan 20 #配置只通过vlan 20
[SW3-GigabitEthernet0/0/2]quit #退出
[SW3]int g0/0/3 #进入g0/0/3端口
[SW3-GigabitEthernet0/0/3]port link-type access #端口类型配置为:access
[SW3-GigabitEthernet0/0/3]port default vlan 20 #配置只通过vlan 20
[SW3-GigabitEthernet0/0/3]quit #退出
[SW3]int g0/0/1 #进入g0/0/1端口
[SW3-GigabitEthernet0/0/1]port link-type trunk #端口类型配置为:trunk
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 20 #配置trunk 可以通过vlan10
[SW3-GigabitEthernet0/0/1]undo port trunk allow-pass vlan 1 #关闭端口不允许vlan 1通过
[SW3-GigabitEthernet0/0/1]quit #退出
[SW3]
<SW3>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 0.
Save the configuration successfully.
<SW3>
5.LSW4;接入层交换机配置如下
代码如下(示例):
The device is running!
<Huawei>
<Huawei>system-view system-view #进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info enable #关闭提醒信息
Info: Information center is disabled.
[Huawei]sysname SW4 #修改设备名称为:SW4
[SW4]vlan 30 #创建vlan 20
[SW4-vlan30]quit #退出
[SW4]int g0/0/2 #进入g0/0/2端口
[SW4-GigabitEthernet0/0/2]port link-type access #端口类型配置为:access
[SW4-GigabitEthernet0/0/2]port default vlan 30 #配置只通过vlan 30
[SW4-GigabitEthernet0/0/2]quit #退出
[SW4]int g0/0/3 #进入g0/0/3端口
[SW4-GigabitEthernet0/0/3]port link-type access #端口类型配置为:access
[SW4-GigabitEthernet0/0/3]port default vlan 30 #配置只通过vlan 30
[SW4-GigabitEthernet0/0/3]quit #退出
[SW4]int g0/0/1 #进入g0/0/1端口
[SW4-GigabitEthernet0/0/1]port link-type trunk #端口类型配置为:trunk
[SW4-GigabitEthernet0/0/1]port trunk allow-pass vlan 30 #配置trunk 可以通过vlan30
[SW4-GigabitEthernet0/0/1]undo port trunk allow-pass vlan 1 #关闭端口不允许vlan 1通过
[SW4-GigabitEthernet0/0/1]quit #退出
[SW4]
<SW4>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 0.
Save the configuration successfully.
<SW4>
总结
提示:这里对文章进行总结:
希望大家多多指教!!!
可联系本人相互学习,谢谢大家!