由于华为近几年在国内的市场越来越大,网络工程师中的组网技术的题目都由思科变为了华为,所以华为的设备还是有必要学习一下的了;本文用华为提供的eNSP模拟器模拟出了可以用于校园/企业网络的规划与设计实现。同时也可以作为大学生的学期课程设计,由于本文章只提供,在设计过程中的关键技术与设计笔记(可根据以下所提供的设计与实现步骤一步一步自行实现(每一条命令都是关键的命令) ;但是如果有需要的也可以根据以下地址进行下载完整的topo图和完整的配置进行参考与借鉴
华为基于eNSP的千人中型校园/企业网络设计与规划.rar
拓扑图:
设计需求:
① 信息中心配置Eth-trunk实现链路冗余
② 企业内网划分多个vlan ,减小广播域大小,提高网络稳定性
③ 核心交换机作为用户网关实现vlan间路由
④ 所有用户均为自动获取ip地址
⑤ 出口配置NAT实现地址转换
⑥ 在企业出口将内网服务器的80端口映射出去,允许外网用户访问
⑦ 所有设备都可以被telnet远程管理
⑧ 所有校区之间可以互访且出口实现冗余
⑨ 企业财务服务器,只允许(vlan 40)的员工访问。
⑩ 禁止vlan 20 员工访问外网且关键设备做好实时监控
插曲部分:经过改造可以为冗余型的网络设计,改造后基于eNSP的千人规模 冗余型 中型校园/企业网络设计与规划 如下图所示(但是并不在该篇文章中做详细介绍和说明,如查看可点击连接自行查看阅读):
我们用到的设计思想就是根据交换机的三层架构来设计,核心层进行高速转发、冗余、均衡;汇聚层进行策略控制ACL、VLAN、Qos、分组过滤、路由选择、组播管理;最后的接入层给用户接入,多端口、用户访问控制
1)提前好由华为提供的eNSP模拟器软件(安装eNSP的前提需要先安装:VirtualBox、WinPcap、Wireshark这个三个软件作为底层的软件)
2)电脑的配置内存尽量都在8GB及以上的内存
3)提前掌握一些网络设计与规划的这些单个技术的使用
4)该综合实验使用到的关键技术有:DHCP、SVI、OSPF、NAT、Telnet、ACL、SNMP
(如果是拿到了该topo图的,设备名称一律以蓝色填充的标注的为准)
网络拓扑(Network Topology)结构是指用传输介质互连各种设备的物理布局。指构成网络的成员间特定的物理的即真实的、或者逻辑的即虚拟的排列方式。如果两个网络的连接结构相同我们就说它们的网络拓扑相同,尽管它们各自内部的物理接线、节点间距离可能会有不同。
配置接入层SW8设备:
接入层SW8:
<Huawei>system-view //进入用户模式
[Huawei]un in en //关闭泛洪的信息
[Huawei]sysname JR_SW8 //将设备命名为JR_SW8,与图片中的设备名称匹配
[JR_SW8]int Eth-Trunk 1
[JR_SW8-Eth-Trunk1]mode lacp-static
[JR_SW8-Eth-Trunk1]trunkport g 0/0/1 0/0/2 //将两个端口进行捆绑
[JR_SW8-Eth-Trunk1]port link-type trunk //并将其设置为trunk口
[JR_SW8-Eth-Trunk1]port trunk allow-pass vlan 200
[JR_SW8-Eth-Trunk1]port trunk allow-pass vlan 900
[JR_SW8]vlan 200 //创建vlan200
[JR_SW8-vlan200]quit
[JR_SW8]vlan 900 //创建管理vlan900(以下的交换机中都需要创建管理vlan900方便后期的管理)
[JR_SW8-vlan900]quit
<JR_SW8>save
<JR_SW8>sysem-view //长时间没有接触命令板所以退出了,需要重新进入一下用户模式
[JR_SW8]port-group group-member Ethernet 0/0/2 Ethernet 0/0/3
[JR_SW8-port-group]port link-type access
[JR_SW8-port-group]port default vlan 200
核心层交换机SW1配置:
核心SW1:
<Huawei>system-view
[Huawei]un in en
[Huawei]sysname HX_SW1 //将设备命名为HX_SW1与图片的标注匹配
[HX_SW1]int Eth-Trunk 1
[HX_SW1-Eth-Trunk1]mode lacp-static
[HX_SW1-Eth-Trunk1]trunkport g0/0/2
[HX_SW1-Eth-Trunk1]trunkport g0/0/5
[HX_SW1-Eth-Trunk1]port link-type trunk
[HX_SW1-Eth-Trunk1]port trunk allow-pass vlan 200 900
[HX_SW1-Eth-Trunk1]quit
[HX_SW1]vlan batch 10 20 30 40 200 900 800 //批量创建vlan
[HX_SW1]int g0/0/1
[HX_SW1-GigabitEthernet0/0/1]port link-type trunk
[HX_SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 900
[HX_SW1-GigabitEthernet0/0/1]int g0/0/3
[HX_SW1-GigabitEthernet0/0/3]port link-type trunk
[HX_SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 30 900
[HX_SW1-GigabitEthernet0/0/3]int g0/0/4
[HX_SW1-GigabitEthernet0/0/4]port link-type trunk
[HX_SW1-GigabitEthernet0/0/4]port trunk allow-pass vlan 40 900
[HX_SW1-GigabitEthernet0/0/4]quit
[HX_SW1]int g0/0/24
[HX_SW1-GigabitEthernet0/0/24]port link-type access
[HX_SW1-GigabitEthernet0/0/24]port default vlan 800
[HX_SW1-GigabitEthernet0/0/24]quit
[HX_SW1]
接入层SW5配置:
接入SW5:
<Huawei>system-view
[Huawei]sysname JR_SW5
[JR_SW5]vlan 10
[JR_SW5-vlan10]quit
[JR_SW5]port-group group-member e0/0/2 e0/0/3
//也可以是这样[JR_SW5]port-group group-member e0/0/2 to e0/0/20 从2-20口
[JR_SW5-port-group]port link-type access
[JR_SW5-port-group]port default vlan 10
[JR_SW5-port-group]quit
[JR_SW5]int g0/0/1
[JR_SW5-GigabitEthernet0/0/1]port link-type trunk
[JR_SW5-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 900
[JR_SW5-GigabitEthernet0/0/1]quit
[JR_SW5]vlan 900//作为管理vlan后期配置telnet的时候会用到
[JR_SW5-vlan900]quit
[JR_SW5-vlan900]quit
[JR_SW5]quit
<JR_SW5>save
接入层SW6:
接入SW6:
<Huawei>system-view
[Huawei]sysname JR_SW6
[JR_SW6]vlan batch 20 900
[JR_SW6]int e0/0/1
[JR_SW6-Ethernet0/0/1]port link-type access
[JR_SW6-Ethernet0/0/1]port default vlan 20
[JR_SW6-Ethernet0/0/1]quit
[JR_SW6]int g0/0/1
[JR_SW6-GigabitEthernet0/0/1]port link-type trunk
[JR_SW6-GigabitEthernet0/0/1]port trunk allow-pass vlan 20 900
[JR_SW6-GigabitEthernet0/0/1]quit
[JR_SW6]quit
<JR_SW6>save
汇聚层SW2:
汇聚SW2:
<Huawei>sy
[Huawei]un in en
[Huawei]sysname HJ_SW2
[HJ_SW2]vlan batch 10 20 900
[HJ_SW2]int g0/0/2
[HJ_SW2-GigabitEthernet0/0/2]port link-type trunk
[HJ_SW2-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 900
[HJ_SW2-GigabitEthernet0/0/2]int g0/0/3
[HJ_SW2-GigabitEthernet0/0/3]port link-type trunk
[HJ_SW2-GigabitEthernet0/0/3]port trunk allow-pass vlan 20 900
[HJ_SW2-GigabitEthernet0/0/3]int g0/0/1
[HJ_SW2-GigabitEthernet0/0/1]port link-type trunk
[HJ_SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 900
[HJ_SW2-GigabitEthernet0/0/1]quit
[HJ_SW2]quit
<HJ_SW2>save
接入层SW7:
汇聚SW7
<Huawei>sy
[Huawei]un in en
[Huawei]sysname JR_SW7
[JR_SW2]vlan batch 30 900
[JR_SW7]port-group group-member e0/0/1 to e0/0/22
[JR_SW7-port-group]port link-type access
[JR_SW7-port-group]port default vlan 30
[JR_SW7-port-group]quit
[JR_SW7]int g0/0/1
[JR_SW7-GigabitEthernet0/0/1]port link-type trunk
[JR_SW7-GigabitEthernet0/0/1]port trunk allow-pass vlan 30 900
[JR_SW7-GigabitEthernet0/0/1]quit
<JR_SW7>save
汇聚层SW3:
汇聚SW3:
<Huawei>SY
[Huawei]un in en
[Huawei]sysname HJ_SW3
[HJ_SW3]vlan batch 30 900
[HJ_SW3]port-group group-member g0/0/1 g0/0/2
[HJ_SW3-port-group]port link-type trunk
[HJ_SW3-port-group]port trunk allow-pass vlan 30 900
[HJ_SW3-port-group]quit
<HJ_SW3>save
接入SW9:
接入SW9:
[Huawei]sysname JR_SW9
[JR_SW9]vlan batch 40 900
[JR_SW9]int e0/0/2
[JR_SW9-Ethernet0/0/2]port link-type access
[JR_SW9-Ethernet0/0/2]port default vlan 40
[JR_SW9-Ethernet0/0/2]int g0/0/1
[JR_SW9-GigabitEthernet0/0/1]port link-type trunk
[JR_SW9-GigabitEthernet0/0/1]port trunk allow-pass vlan 40 900
<JR_SW9>save
汇聚SW4:
汇聚SW4:
<Huawei>system-view
[Huawei]un in en
[Huawei]sysname HJ_SW4
[HJ_SW4]vlan batch 40 900
[HJ_SW4]port-group group-member g0/0/1 g0/0/2
[HJ_SW4-port-group]port link-type trunk
[HJ_SW4-port-group]port trunk allow-pass vlan 40 900
[HJ_SW4-port-group]quit
[HJ_SW4]quit
<HJ_SW4>save
扩展代码:
[JR_SW8]dis eth-trunk //查看绑定的trunk
[JR_SW8-Eth-Trunk1]dis this//查看当前的配置信息
只用配置核心交换机SW1:
核心SW1:
<HX_SW1>sy
[HX_SW1]un in en
[HX_SW1]int vlanif 10
[HX_SW1-Vlanif10]ip add 192.168.10.1 24
[HX_SW1-Vlanif10]int vlanif 20
[HX_SW1-Vlanif20]ip add 192.168.20.1 24
[HX_SW1-Vlanif20]int vlanif 30
[HX_SW1-Vlanif30]ip add 192.168.30.1 24
[HX_SW1-Vlanif30]int vlanif 40
[HX_SW1-Vlanif40]ip add 192.168.40.1 24
[HX_SW1-Vlanif40]int vlanif 200
[HX_SW1-Vlanif200]ip add 192.168.200.1 24
[HX_SW1-Vlanif200]int vlanif 800
[HX_SW1-Vlanif800]ip add 192.168.254.2 24
[HX_SW1-Vlanif800]quit
<HX_SW1>save
之后可以给PC设置一个静态IP地址如:
192.168.10.5 255.255.255.0,网关可以先不配,
ping 192.168.10.1是否能ping通
[HX_SW1]display ip interface brief //查看端口IP简要状态信息
核心SW1:
[HX_SW1]dhcp enable //启动DHCP服务
[HX_SW1]ip pool syl_vlan10 //创建一个名为syl_vlan10的地址池
[HX_SW1-ip-pool-syl_vlan10]network 192.168.10.0 mask 24//分配10.0这个网段的地址
[HX_SW1-ip-pool-syl_vlan10]gateway-list 192.168.10.1 //设置网关
[HX_SW1-ip-pool-syl_vlan10]dns-list 114.114.114.114 8.8.8.8 //分配dns 辅助dns
......
//其余地址池也是一样的创建
[HX_SW1]int vlanif 10
[HX_SW1-Vlanif10]dhcp select global
[HX_SW1-Vlanif10]quit
[HX_SW1]int vlanif 20
[HX_SW1-Vlanif20]dhcp select global
[HX_SW1-Vlanif20]quit
......
//其余vlanif也是一样的配置vlanif有10 20 30 40 200 800 900
//可以检测pc机的IP地址ping网关
第一步配置IP地址:
R1:首先配置接口IP地址
[R1]int g4/0/0
[R1-GigabitEthernet4/0/0]ip add 192.168.254.1 24
[R1]int g3/0/0
[R1-GigabitEthernet3/0/0]ip add 12.1.1.1 29
[R1-GigabitEthernet3/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 13.1.1.1 29
[R1-GigabitEthernet0/0/1]int g1/0/0
[R1-GigabitEthernet1/0/0]ip add 192.168.104.1 30
[R1-GigabitEthernet1/0/0]int g2/0/0
[R1-GigabitEthernet2/0/0]ip add 192.168.105.1 30
[R1-GigabitEthernet2/0/0]quit
YD_R2:
[YD_R2]int e0/0/0
[YD_R2-Ethernet0/0/0]ip add 12.1.1.6 29
[YD_R2]int LoopBack 0
[YD_R2-LoopBack0]ip add 9.9.9.9 24
[YD_R2-LoopBack0]description baidu
LT_R3:
[LT_R3]int e0/0/0
[LT_R3-Ethernet0/0/0]ip add 13.1.1.6 29
[LT_R3]int LoopBack 0
[LT_R3-LoopBack0]ip add 9.9.9.9 24
[LT_R3-LoopBack0]description baidu
XXQ1_R4:
[XXQ1_R4]int e0/0/1
[XXQ1_R4-Ethernet0/0/1]ip add 192.168.104.2 30
[XXQ1_R4-Ethernet0/0/1]int e0/0/0
[XXQ1_R4-Ethernet0/0/0]ip add 192.168.100.1 24
XXQ2_R5:
[XXQ2_R5]int e0/0/0
[XXQ2_R5-Ethernet0/0/0]ip add 192.168.105.2 30
[XXQ2_R5-Ethernet0/0/0]int e0/0/1
[XXQ2_R5-Ethernet0/0/1]ip add 192.168.150.1 24
client1:
ip:192.168.100.2 24
gateway-list:192.168.100.1
client2:
ip:192.168.150.2 24
gateway-list:192.168.150.1
第二步设置OSPF路由协议:
SW1:提前完成IP地址的配置
[HX_SW1]ospf 1 router-id 1.1.1.1
[HX_SW1-ospf-1]area 0
[HX_SW1-ospf-1-area-0.0.0.0]network 192.168.200.0 0.0.0.255
[HX_SW1-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[HX_SW1-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[HX_SW1-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
[HX_SW1-ospf-1-area-0.0.0.0]network 192.168.40.0 0.0.0.255
[HX_SW1-ospf-1-area-0.0.0.0]network 192.168.254.0 0.0.0.255
R1:
[R1]ospf 1 router-id 2.2.2.2
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 192.168.254.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 192.168.104.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 192.168.105.1 0.0.0.0//包含出口的接口即可
R4:
[XXQ1_R4]ospf 1 router-id 4.4.4.4
[XXQ1_R4-ospf-1]area 0
[XXQ1_R4-ospf-1-area-0.0.0.0]network 192.168.104.2 0.0.0.0
[XXQ1_R4-ospf-1-area-0.0.0.0]network 192.168.100.1 0.0.0.0
R5:
[XXQ2_R5]ospf 1 router-id 5.5.5.5
[XXQ2_R5-ospf-1]area 0
[XXQ2_R5-ospf-1-area-0.0.0.0]network 192.168.105.2 0.0.0.0
[XXQ2_R5-ospf-1-area-0.0.0.0]network 192.168.150.1 0.0.0.0
[HX_SW1]dis ip routing-table //查看路由表信息,此处应该出现4个OSPF学习才行如下图所示
第三步:测试
测试1用客户端访问服务端:
测试二:用老校区访问新校区网络如:PC>ping 192.168.104.2
SW1:
[HX_SW1]ip route-static 0.0.0.0 0 192.168.254.1//静态路由
R1:
[R1]ip route-static 0.0.0.0 0 12.1.1.6 //默认60的优先级
[R1]ip route-static 0.0.0.0 0 13.1.1.6 preference 70 //优先级为70,优先级越小越优先
[R1]display ip routing-table
//查看路由表示只有一条为60的static路由
//如果是移动坏了就会默认通往优先级为70的连通static路由
//这样连通起到了一个备份的作用
需要访问外网,就需要将地址转换我饿公网地址才行
R1:
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.0.0 0.0.255.255
[R1-acl-basic-2000]quit
[R1]int g3/0/0
[R1-GigabitEthernet3/0/0]nat outbound 2000
[R1-GigabitEthernet3/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000
//现在的话这些PC机就可以通过上网了,ping 9.9.9.9
R1:
[R1]int g3/0/0
[R1-GigabitEthernet3/0/0]nat server protocol tcp global current-interface 80 inside 192.168.200.10 80
[R1-GigabitEthernet3/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 80 inside 192.168.200.10 80
YD_R2:
[YD_R2]int e0/0/1
[YD_R2-Ethernet0/0/1]ip add 7.7.7.1 24
Client3:
ip:7.7.7.7 24
gateway-list:7.7.7.1
核心HX_SW1:
[HX_SW1]aaa
[HX_SW1-aaa]local-user a privilege level 3 password cipher 123
[HX_SW1-aaa]local-user a service-type telnet
[HX_SW1-aaa]quit
[HX_SW1]user-interface vty 0 4 //允许最多5个人同时登录
[HX_SW1-ui-vty0-4]authentication-mode aaa
//[HX_SW1-ui-vty0-4]protocol inbound telnet真机了加入
//[JR_SW8]telnet server enable 真机可能还需要敲这个指令
.......
//所有的交换机和R1、XXQ1_R4、XXQ2_R5都做这个一模一样的配置,复制粘贴即可
/*aaa
local-user a privilege level 3 password cipher 123
local-user a service-type telnet
user-interface vty 0 4
authentication-mode aaa*/
继续核心HX_SW1:
[HX_SW1]int vlanif 900
[HX_SW1-Vlanif900]ip add 192.168.255.1 24
JR_SW8:
[JR_SW8]int vlanif 900
[JR_SW8-Vlanif900]ip add 192.168.255.8 24
[JR_SW8-Vlanif900]quit
[JR_SW8]ip route-static 0.0.0.0 0 192.168.255.1//所有的接入层和汇聚层都需要配置一条回报路由
.....
//其余交换机都是像JR_SW8一样的配置,除核心交换机以外的路由器都有 ip route-static 0.0.0.0 0 192.168.255.1这条路由下一跳都是255.1
之后用PC机ping其他网段进行检测如:ping 192.168.255.9/.8/.7
//由于模拟器上不可以telnet所以就换成了路由器
PC路由这个配置:自动获取IP地址
[Huawei]sysname PC
[PC]un in en
[PC]int e0/0/0
[PC-Ethernet0/0/0]ip add dhcp-alloc
之后就可以telnet了
<PC>telnet 192.168.255.1
注意这里自动获取地址可能会有点慢,可以使用以下命令进行查看是否是自动获取IP地址
[PC]dis ip interface brief
⑨ 企业财务服务器,只允许(vlan 40)的员工访问。
⑩ 禁止vlan 20 员工访问外网
HX_SW1:
[HX_SW1]acl 3000
[HX_SW1-acl-adv-3000]rule permit ip source 192.168.40.0 0.0.0.255 destination 192.168.200.20 0
//允许40.0这个网段访问财务服务器
[HX_SW1-acl-adv-3000]rule deny ip source any destination 192.168.200.20 0
//其余网段访问20.0财务服务器拒接
[HX_SW1]int Eth-Trunk 1
[HX_SW1-Eth-Trunk1]traffic-filter outbound acl 3000//运用在这个出口上
R1:
[R1]acl 3001
[R1-acl-adv-3001]rule permit ip destination 192.168.0.0 0.0.255.255
//允许访问192.168.X.X网段
[R1-acl-adv-3001]rule deny ip source 192.168.20.0 0.0.0.255
//拒接访问外网
[R1-acl-adv-3001]int g4/0/0
[R1-GigabitEthernet4/0/0]traffic-filter inbound acl 3001//运用在g4/0/0这个接口的入口处
<Huawei>system-view
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname R1
[R1]interface g0/0/1 //进入g0/0/1接口
[R1-GigabitEthernet0/0/1]ip address 10.1.1.1 24 //配置g0/0/1IP地址
[R1-GigabitEthernet0/0/1]quit
[R1]interface g0/0/2
[R1-GigabitEthernet0/0/2]ip address 10.1.4.1 30
[R1-GigabitEthernet0/0/2]quit
[R1]ip route-static 10.1.2.0 24 10.1.4.2 //配置静态路由
//目的网段 子网掩码 下一跳
[R1]ip route-static 10.1.3.0 24 10.1.4.2
<R1>save
同理路由器R2:
//配置静态路由
[R2]ip route-static 10.1.1.0 24 10.1.4.1 //配置静态路由
//目的网段 子网掩码 下一跳
[R2]ip route-static 10.1.3.0 24 10.1.5.2
PC1(其他PC机同理):
IP地址:10.1.1.2
子网掩码:255.255.255.0
网关:10.1.1.1
基于GVRP的VLAN配置实验:
第一步:交换机LSW1和LSW2的基本配置:
LSW1:
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname SwitchA
[SwitchA]gvrp
[SwitchA]vlan 2 //创建一个vlan2
[SwitchA-vlan2]quit
[SwitchA]int vlan2 //进入vlan2
[SwitchA-Vlanif2]ip address 192.168.1.254 24
LSW2:
<Huawei>system-view
[Huawei]undo info-center enable
[Huawei]sysname SwitchB
[SwitchB]gvrp
[SwitchA]vlan 2 //创建一个vlan2
第二步:交换机LSW1和LSW2的端口配置:
LSW1:
[SwitchA]int g0/0/1
[SwitchA-GigabitEthernet0/0/1]port link-type access //与连接PC1的端口链路类型设置为access
[SwitchA-GigabitEthernet0/0/1]port default vlan 2 //将端口G0/0/1加入vlan 2
[SwitchA-GigabitEthernet0/0/1]int g0/0/2
[SwitchA-GigabitEthernet0/0/2]port link-type trunk //将交换机互联的端口链路类型设置为trunk
[SwitchA-GigabitEthernet0/0/2]port trunk allow-pass vlan all //将端口G0/0/2加入vlan2
LSW2:
[SwitchB]int g0/0/1
[SwitchB-GigabitEthernet0/0/1]port link-type access //与连接PC1的端口链路类型设置为access
[SwitchB-GigabitEthernet0/0/1]port default vlan 2 //将端口G0/0/1加入vlan 2
[SwitchB-GigabitEthernet0/0/1]int g0/0/2
[SwitchB-GigabitEthernet0/0/2]port link-type trunk //将交换机互联的端口链路类型设置为trunk
[SwitchB-GigabitEthernet0/0/2]port trunk allow-pass vlan all //将端口G0/0/2加入vlan2
第三步:交换机LSW1和LSW2配置GVRP:
LSW1:
[SwitchA]int g0/0/2
[SwitchA-GigabitEthernet0/0/2]gvrp //开启gvrp
LSW2:
[SwitchB]int g0/0/2
[SwitchB-GigabitEthernet0/0/2]gvrp
第四步:配置PC1和PC2的IP
PC1的IP地址:192.168.1.1
网关:192.168.1.254
子网掩码:255.255.255.0
PC1的IP地址:192.168.1.2
网关:192.168.1.254
子网掩码:255.255.255.0
PC1上:ping 192.168.1.2
PC2上:ping 192.168.1.1
R1:
<Huawei>system-view
[Huawei]un in en
Info: Information center is disabled.
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 192.168.1.1 24
R2:
<Huawei>system-view
[Huawei]interface g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.1.2 24
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 10.10.0.1 24
2、配置RIP协议
R1:
[Huawei]rip
[Huawei-rip-1]network 192.168.1.0
[Huawei-rip-1]return
<Huawei>save
R2:
[Huawei]rip
[Huawei-rip-1]network 192.168.1.0
[Huawei-rip-1]network 10.0.0.0
[Huawei-rip-1]return
<Huawei>save
R3:
[Huawei]rip
[Huawei-rip-1]network 10.0.0.0
[Huawei-rip-1]return
<Huawei>save
3、检验结果:display ip routing、ping
R1:
Destination/Mask Proto Pre Cost NextHop
10.0.0.0/8 RIP 100 1 192.168.1.2
//目标网段 RIP获取 管理距离 下一跳
[R1]ospf
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 192.200.10.4 0.0.0.3
// 网络号/网络地址 反掩码
[R1-ospf-1-area-0.0.0.0]area 1
[R1-ospf-1-area-0.0.0.1]network 192.1.0.128 0.0.0.63
第三步:验证ping、dis ip routing、dis cu
第一步:配置IP地址
第二步:配置IS-IS:
R1:
[R1]isis //开启全局ISIS配置
[R1-isis-1]network-entity 10.0000.0000.0001.00
[R1-isis-1]quit
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]isis enable //开启这个端口的ISIS服务
[R1-GigabitEthernet0/0/0]quit
[R1]quit
<R1>save
R2:
[R2]isis //开启全局ISIS服务
[R2-isis-1]network-entity 10.0000.0000.0002.00
[R2-isis-1]quit
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]isis enable
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]isis enable //开启该端口的ISIS服务
[R2-GigabitEthernet0/0/1]quit
[R2]quit
<R2>save
第三步:验证ping、dis ip routing、dis isis peer
第一步:配置IP地址:
<Huawei>system-view
[Huawei]un in en
[Huawei]sysname R1
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.254 24
[R1-GigabitEthernet0/0/0]quit
[R1]ip pool PC //创建地址池名字为PC
Info:It's successful to create an IP address pool.
[R1-ip-pool-PC]gateway-list 192.168.1.254 //获取网关
[R1-ip-pool-PC]network 192.168.1.0 mask 24 //分配网段
[R1-ip-pool-PC]quit
第二步:开启DHCP配置:
[R1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]dhcp select global //基于global分配
[R1-GigabitEthernet0/0/0]quit
<R1>save
第一步:配置ip
[R3-GigabitEthernet0/0/0]ip address 192.168.2.254 24
第二步:开启DHCP
[R3]dhcp enable
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]dhcp select interface//用于该端口
第一步:配置ip地址
第二步:配置静态路由或RIP全网连通(此处以静态路由为例)
静态路由:
[R1]ip route-static 192.168.20.0 24 192.168.12.2
// 目的网段 网关 下一跳
[R2]ip route-static 192.168.10.0 24 192.168.12.1
// 目的网段 网关 下一跳
第三步:配置ACL、ACL规则,并应用
配置ACL禁止PC3与PC1之间的访问:
<R2>system-view
[R2]acl 3000
[R2-acl-adv-3000]rule 5 deny ip source 192.168.20.3 0.0.0.255 destination 192.168.10.1 0.0.0.255
//前是源网段 反掩码 后是目的网段 反掩码
//表示的是拒绝20.3这个网段访问10.1这个网段(整个网段)
//(还以表示为[R2-acl-adv-3000]rule 5 deny ip source 192.168.20.3 0 destination 192.168.10.1 0)此处的0表示的是主机数(阻止20.3的访问IP地址为10.1这个地址)
[R2-acl-adv-3000]quit
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]traffic-filter inbound acl 3000
[R2-GigabitEthernet0/0/0]quit
第四步:验证ACL。display acl 3000、dis cu、 dis acl all、ping命令
ACL其他命令:
[SW]time-range satime 8:00 to 18:00 working-day //设置时间
[SW]traffic classifier c_m //创建一个c_m的流分类
[SW-classifier-c_m]if-match acl 3002 //将ACL与流分类关联(if-match设定流分类分匹配规则)
[SW]traffic behavior d_m //创建一个流行为
[SW-behavior-d_m]deny //配置流行为动作为拒绝报文通过
[SW]traffic policy e_m //创建流策略
[SW-trafficcpolicy-e_m]classifier c_m behavior d_m
[SW]int g0/0/1 //进入接口
[SW-g0/0/1]traffic-policy e_m outbound //将策略应用到接口
SW1:
[SW1]int e0/0/2
[SW1-Ethernet0/0/2]port link-type access//设置02端口为access口
[SW1-Ethernet0/0/2]port default vlan 10
[SW1-Ethernet0/0/2]int e0/0/3
[SW1-Ethernet0/0/3]port link-type access//设置03端口为access口
[SW1-Ethernet0/0/3]port default vlan 20
[SW1-Ethernet0/0/3]int e0/0/1
[SW1-Ethernet0/0/1]port link-type trunk
[SW1-Ethernet0/0/1]port trunk allow-pass vlan 10 20
[SW1-Ethernet0/0/1]int e0/0/4
[SW1-Ethernet0/0/4]port link-type trunk
[SW1-Ethernet0/0/4]port trunk allow-pass vlan 10 20
[SW1-Ethernet0/0/4]quit
SW2:
<Huawei>system-view
[Huawei]un in en
[Huawei]sysname SW2
[SW2]vlan batch 10 20 //批量创建vlan 10 和vlan20
[SW2]int e0/0/1
[SW2-Ethernet0/0/1]port link-type trunk //设置01口为trunk
[SW2-Ethernet0/0/1]port trunk allow-pass vlan 10 20 //允许10 20通过
[SW2-Ethernet0/0/1]int e0/0/2
[SW2-Ethernet0/0/2]port link-type access
[SW2-Ethernet0/0/2]port default vlan 10
[SW2-Ethernet0/0/2]int e0/0/3
[SW2-Ethernet0/0/3]port link-type access
[SW2-Ethernet0/0/3]port default vlan 20
[SW2-Ethernet0/0/3]quit
第三步:配置Router路由器
<Huawei>system-view
[Huawei]un in en
[Huawei]sysname R1
[R1]interface g0/0/0.1 //进入一个逻辑端口0.1
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 10
[R1-GigabitEthernet0/0/0.1]ip address 192.168.1.254 24 //设置IP地址
[R1-GigabitEthernet0/0/0.1]arp broadcast enable //开启arp
[R1-GigabitEthernet0/0/0.1]quit
[R1]interface g0/0/0.2 //进入一个逻辑端口0.2
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 20
[R1-GigabitEthernet0/0/0.2]ip address 192.168.2.254 24
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
第四步:测试vlan
SW1:dis vlan
10 common UT:Eth0/0/2(U)
TG:Eth0/0/1(U) Eth0/0/4(U)
20 common UT:Eth0/0/3(U)
TG:Eth0/0/1(U) Eth0/0/4(U)
SW2:dis vlan
10 common UT:Eth0/0/2(U)
TG:Eth0/0/1(U)
20 common UT:Eth0/0/3(U)
TG:Eth0/0/1(U)
步骤一:配合PC机地址
PC1:192.168.1.1 255.255.255.0 192.168.1.254
PC2:192.168.1.2 255.255.255.0 192.168.1.254
PC3:192.168.2.1 255.255.255.0 192.168.2.254
步骤二:配置路由器R1、R2地址
R1:
[Huawei]sysname R1
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.254 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip address 10.10.1.1 24
R2:
[Huawei]sysname R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 10.10.1.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.2.254 24
<R1>system-view
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat static glo
[R1-GigabitEthernet0/0/1]nat static global 172.16.1.1 inside 192.168.1.1
//将192.168.1.1转换为172.16.1.1地址
R1:
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]undo nat static global 172.16.1.1 inside 192.168.1.1
//删除刚才的静态nat
[R1]nat address-group 1 172.16.1.1 172.16.1.5
//分配一个地址1.1-1.5
[R1]acl 2000 //创建一标准的ACL
[R1-acl-basic-2000]rule 5 permit source 192.168.1.0 0.0.0.255//允许1.0网段通过
[R1-acl-basic-2000]quit
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000 address-group 1 no-pat //运用在这个端口上
这个时候ping1.0网段不通:可以配置R2的静态路由,在ping的同时可以抓取R2中g0/0/0端口数据包查看
PC>ping 10.10.1.2
Ping 10.10.1.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
Request timeout!
Request timeout!
Request timeout!
给R2配置静态路由:
<R2>system-view
[R2]ip route-static 172.16.1.0 24 10.10.1.1
//目的网段 子网掩码 下一跳
//这个时候在ping就可以通了
PC>ping 10.10.1.2
Ping 10.10.1.2: 32 data bytes, Press Ctrl_C to break
From 10.10.1.2: bytes=32 seq=1 ttl=254 time=47 ms
From 10.10.1.2: bytes=32 seq=2 ttl=254 time=93 ms
也是需要ACL规则和地址池的,接上面的R2静态路由
R1:
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]undo nat outbound 2000 address-group 1 no-pat
//删除刚才的动态nat
[R1]nat address-group 1 172.16.1.1 172.16.1.5
//分配一个地址1.1-1.5
[R1]acl 2000 //创建一标准的ACL
[R1-acl-basic-2000]rule 5 permit source 192.168.1.0 0.0.0.255//允许1.0网段通过
[R1-acl-basic-2000]quit
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000 address-group 1 //运用在这个端口上
也需要ACL规则但是不需要地址池
<R1>system-view
[R1]un in en
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000