如何通过流策略实现VLAN间的访问权限?

前言
vlan(virtual local area network)即虚拟局域网,是将一个物理的lan在逻辑上划分成多个广播域的通信技术。
本文主要介绍通过流策略实现vlan间三层隔离,也就是我们常说的对用户增加访问权限。
01
 过流策略实现vlan间三层隔离
1.1 组网需求
如图 1 所示,为了通信的安全性,某公司将访客、员工、服务器分别划分到vlan10、vlan20、vlan30中。公司希望:
员工、服务器主机、访客均能访问internet。
访客只能访问internet,不能与其他任何vlan的用户通信。
员工a可以访问服务器区的所有资源,但其他员工只能访问服务器a的21端口(ftp服务)。

图片
图 1 配置通过流策略实现vlan间三层隔离组网图
1.2 配置思路
可采用如下思路配置通过流策略实现vlan间互访控制:
配置vlan并将各接口加入vlan,使员工、服务器、访客间二层隔离。
配置vlanif接口及其ip地址,使员工、服务器、访客间可三层互通。
配置上行路由,使员工、服务器、访客均可通过switch访问internet。
配置并应用流策略,使员工a可以访问服务器区的所有资源,其他员工只能访问服务器a的21端口,且只允许员工访问服务器;使访客只能访问internet。
1.3 操作步骤
【1】配置vlan并将各接口加入vlan,使员工、服务器、访客间二层隔离
# 在switch_1上创建vlan10,并将接口ge1/0/1以untagged方式加入vlan10,接口ge1/0/2以tagged方式加入vlan10。switch_2和switch_3的配置与switch_1类似,不再赘述。
system-view
[huawei] sysname switch_1
[switch_1] vlan batch 10
[switch_1] interface gigabitethernet 1/0/1
[switch_1-gigabitethernet1/0/1] port link-type access
[switch_1-gigabitethernet1/0/1] port default vlan 10
[switch_1-gigabitethernet1/0/1] quit
[switch_1] interface gigabitethernet 1/0/2
[switch_1-gigabitethernet1/0/2] port link-type trunk
[switch_1-gigabitethernet1/0/2] port trunk allow-pass vlan 10
[switch_1-gigabitethernet1/0/2] quit
# 在switch_4上创建vlan10、vlan20、vlan30、vlan100,并配置接口ge1/0/1~ge1/0/4分别以tagged方式加入vlan10、vlan20、vlan30、vlan100。
system-view
[huawei] sysname switch_4
[switch_4] vlan batch 10 20 30 100
[switch_4] interface gigabitethernet 1/0/1
[switch_4-gigabitethernet1/0/1] port link-type trunk
[switch_4-gigabitethernet1/0/1] port trunk allow-pass vlan 10
[switch_4-gigabitethernet1/0/1] quit
[switch_4] interface gigabitethernet 1/0/2
[switch_4-gigabitethernet1/0/2] port link-type trunk
[switch_4-gigabitethernet1/0/2] port trunk allow-pass vlan 20
[switch_4-gigabitethernet1/0/2] quit
[switch_4] interface gigabitethernet 1/0/3
[switch_4-gigabitethernet1/0/3] port link-type trunk
[switch_4-gigabitethernet1/0/3] port trunk allow-pass vlan 30
[switch_4-gigabitethernet1/0/3] quit
[switch_4] interface gigabitethernet 1/0/4
[switch_4-gigabitethernet1/0/4] port link-type trunk
[switch_4-gigabitethernet1/0/4] port trunk allow-pass vlan 100
[switch_4-gigabitethernet1/0/4] quit

【2】配置vlanif接口及其ip地址,使员工、服务器、访客间可以三层互通
# 在switch_4上创建vlanif10、vlanif20、vlanif30、vlanif100,并分别配置其ip地址为10.1.1.1/24、10.1.2.1/24、10.1.3.1/24、10.1.100.1/24。
[switch_4] interface vlanif 10
[switch_4-vlanif10] ip address 10.1.1.1 24
[switch_4-vlanif10] quit
[switch_4] interface vlanif 20
[switch_4-vlanif20] ip address 10.1.2.1 24
[switch_4-vlanif20] quit
[switch_4] interface vlanif 30
[switch_4-vlanif30] ip address 10.1.3.1 24
[switch_4-vlanif30] quit
[switch_4] interface vlanif 100
[switch_4-vlanif100] ip address 10.1.100.1 24
[switch_4-vlanif100] quit
【3】配置上行路由,使员工、服务器、访客均可通过switch访问internet。
# 在switch_4上配置ospf基本功能,发布用户网段以及switch_4与router之间的互联网段。
[switch_4] ospf
[switch_4-ospf-1] area 0
[switch_4-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[switch_4-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255
[switch_4-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255
[switch_4-ospf-1-area-0.0.0.0] network 10.1.100.0 0.0.0.255
[switch_4-ospf-1-area-0.0.0.0] quit
[switch_4-ospf-1] quit
router上需要进行如下配置:
将连接switch的接口以tagged方式加入vlan100,并指定vlanif100的ip地址与10.1.100.1在同一网段。
配置ospf基本功能,并发布switch与router之间的互联网段。
【4】配置并应用流策略,控制员工、访客、服务器之间的访问
a、通过acl定义每个流
# 在switch_4上配置acl 3000,禁止访客访问员工区和服务器区。
[switch_4] acl 3000
[switch_4-acl-adv-3000] rule deny ip destination 10.1.2.1 0.0.0.255
[switch_4-acl-adv-3000] rule deny ip destination 10.1.3.1 0.0.0.255
[switch_4-acl-adv-3000] quit
# 在switch_4上配置acl 3001,使员工a可以访问服务器区的所有资源,其他员工只能访问服务器a的21端口。
[switch_4] acl 3001
[switch_4-acl-adv-3001] rule permit ip source 10.1.2.2 0 destination 10.1.3.1 0.0.0.255
[switch_4-acl-adv-3001] rule permit tcp destination 10.1.3.2 0 destination-port eq 21
[switch_4-acl-adv-3001] rule deny ip destination 10.1.3.1 0.0.0.255
[switch_4-acl-adv-3001] quit
b、配置流分类,区分不同的流
# 在switch_4上创建流分类c_custom、c_staff,并分别配置匹配规则3000、3001。
[switch_4] traffic classifier c_custom
[switch_4-classifier-c_custom] if-match acl 3000
[switch_4-classifier-c_custom] quit
[switch_4] traffic classifier c_staff
[switch_4-classifier-c_staff] if-match acl 3001
[switch_4-classifier-c_staff] quit
c、配置流行为,指定流动作
# 在switch_4上创建流行为b1,并配置允许动作。
[switch_4] traffic behavior b1
[switch_4-behavior-b1] permit
[switch_4-behavior-b1] quit
d、配置流策略,关联流分类和流行为
# 在switch_4上创建流策略p_custom、p_staff,并分别将流分类c_custom、c_staff与流行为b1关联。
[switch_4] traffic policy p_custom
[switch_4-trafficpolicy-p_custom] classifier c_custom behavior b1
[switch_4-trafficpolicy-p_custom] quit
[switch_4] traffic policy p_staff
[switch_4-trafficpolicy-p_staff] classifier c_staff behavior b1
[switch_4-trafficpolicy-p_staff] quit
e、应用流策略,实现员工、访客、服务器之间的访问控制
# 在switch_4上,分别在vlan10、vlan20的入方向应用流策略p_custom、p_staff。
[switch_4] vlan 10
[switch_4-vlan10] traffic-policy p_custom inbo


2019 MWC十大新机 看看哪款属于你 !
基于可编程增益放大器和ADC实现低功耗高性能数据采集系统的设计
如何轻松看懂丰田汽车的电路图?
大唐恩智浦旗下DNB1168大大提高动力电池安全阈值
半导体的进步需要创新的滤波方法
如何通过流策略实现VLAN间的访问权限?
语音芯片电路图
联想发布LaVie家庭一体机,搭载LG的屏幕发声技术将于3月上市
NVIDIA宣布正打造英国最强大的超级计算机,将借助AI解决医疗难题
带宽范围为120dB的双对数变换器ADL5310
恩智浦将重要工业4.0技术结合到模块化平台中,简化工业物联网开发
二极管的组成及仿真
微软Visual Studio Online更新后支持Docker镜像和Dockerfile
温度对测量仪器的致命影响
小米9充电器给汽车电瓶充电? 还真有这种操作
运用 Node-RED 开发 LoRa 应用
微软明确2011年五大重点
本文将带你简单领略RFID技术在仓库管理中的价值
关于新能源电控系统VCU-HIL测试的解决方案
三星SPH-P9000:具有基于Windows XP的PC功能