华为交换机配置vlan设定IP及路由做访问控制列表怎么做?

如题所述

首先有几个问题你没有说太明白,我只好做假设。
1,你所给的5个IP地址,是配置在S93上作为5个VLAN的网关来使用的吗?你没说明,我只能假设是。
2,还有你的VLAN是在S93上开始的吗?也就是说S93的接入口该是什么模式?你没说明,我只能假设开始于S93既交换机端口都是access模式。
3,设置静态路由则我们需要吓一跳地址和出接口,你没有给出。我只能做个假设。
好了配置开始。(接下来我写的是配置脚本,你可以直接复制使用,当然就没必要复制其中我用汉字进行说明的部分了)
首先配置VLAN
vlan 2
vlan 3
vlan 4
vlan 5
vlan 6 (一般使用VLAN不会用到VLAN1这是个莫用规则,因为VLAN1在所有设备上都存在,使用起来有诸多不便,还存在安全隐患)
vlan7(按照你的意思我猜测你的VLAN在此终结,也就是说上联口要有IP地址,而在93上IP地址是只能配在VLAN中而不能配在接口下的,所以将上联口的互联地址配置在此VLAN中,将上联口加入此VLAN即可)
interface vlanif 2
ip address 192.168.10.6 255.255.254.0(你没有给出掩码,经过我的计算只有255.255.254.0这个掩码能满足你现在过给的网段地址)
interface vlanif 3
ip address 192.168.20.6 255.255.254.0
interface vlanif 4
ip address 192.168.30.6 255.255.254.0
interface vlanif 5
ip address 192.168.40.6 255.255.254.0
interface vlanif 6
ip address 192.168.50.6 255.255.254.0
interface vlanif 7
ip address ?
interface gig 1/0/0
port link-type access (没做过S93的估计会指出这不用改,呵呵。事实上93上端口的默认状态是trunk所以没做过的 请闭嘴)
port default vlan 2
interface gig 1/0/1
port link-type access
port default vlan 3
interface gig 1/0/2
port link-type access
port default vlan 4
interface gig 1/0/3
port link-type access
port default vlan 5
interface gig 1/0/4
port link-type access
port default vlan 6
interface gig 1/0/5
port link-type access
port default vlan 7
ip route-static 10.126.80.20 0.0.0.0 gig 1/0/5 ?(因为你没指明上联口互联地址我只能写?号,这里要写上联口的对端地址。)
ip route-static 10.126.80.20 0.0.0.0 gig 1/0/5 ?
接下来是访问控制,在93中访问控制列表只是工具不能直接在端口下调用。

acl 3001(要做基于目的地址和源地址的访控必须是高级访问控制列表,从3000开始
rule 0 permit destinationg 192.168.10.6 0.0.2.255 source 10.126.80.20 0.0.0.0 (注意此处用的是反掩码)
rule 1 permit destinationg 192.168.10.6 0.0.2.255 source 10.126.80.21 0.0.0.0
rule 2 deny any
traffic classifier tc1
if-match acl 3001
traffic behavior tb1
permit
traffic policy tp1
classifier tc1 behavior tb1
quit
acl 3002
rule 0 permit destinationg 192.168.20.6 0.0.2.255 source 10.126.80.20 0.0.0.0
rule 1 permit destinationg 192.168.20.6 0.0.2.255 source 10.126.80.21 0.0.0.0
rule 2 deny any
traffic classifier tc2
if-match acl 3002
traffic behavior tb2
permit
traffic policy tp2
classifier tc2 behavior tb2
quit
acl 3003
rule 0 permit destinationg 192.168.30.6 0.0.2.255 source 10.126.80.20 0.0.0.0
rule 1 permit destinationg 192.168.30.6 0.0.2.255 source 10.126.80.21 0.0.0.0
rule 2 deny any
traffic classifier tc3
if-match acl 3003
traffic behavior tb3
permit
traffic policy tp3
classifier tc3 behavior tb3
quit
acl 3002
rule 0 permit destinationg 192.168.40.6 0.0.2.255 source 10.126.80.20 0.0.0.0
rule 1 permit destinationg 192.168.40.6 0.0.2.255 source 10.126.80.21 0.0.0.0
rule 2 deny source any
traffic classifier tc4
if-match acl 3004
traffic behavior tb4
permit
traffic policy tp4
classifier tc4 behavior tb4
quit
acl 3005
rule 0 permit destinationg 192.168.50.6 0.0.2.255 source 10.126.80.20 0.0.0.0
rule 1 permit destinationg 192.168.50.6 0.0.2.255 source 10.126.80.21 0.0.0.0
rule 2 deny any
traffic classifier tc5
if-match acl 3005
traffic behavior tb5
permit
traffic policy tp5
classifier tc5 behavior tb5
quit
acl 3006
rule 0 permit destinationg 10.126.80.20 0.0.0.0 source 192.168.10.6 0.0.2.255
rule 1 permit destinationg 10.126.80.20 0.0.0.0 source 192.168.20.6 0.0.2.255
rule 2 permit destinationg 10.126.80.20 0.0.0.0 source 192.168.30.6 0.0.2.255
rule 3 permit destinationg 10.126.80.20 0.0.0.0 source 192.168.40.6 0.0.2.255
rule 4 permit destinationg 10.126.80.20 0.0.0.0 source 192.168.50.6 0.0.2.255
rule 5 permit destinationg 10.126.80.21 0.0.0.0 source 192.168.10.6 0.0.2.255
rule 6 permit destinationg 10.126.80.21 0.0.0.0 source 192.168.20.6 0.0.2.255
rule 7 permit destinationg 10.126.80.21 0.0.0.0 source 192.168.30.6 0.0.2.255
rule 8 permit destinationg 10.126.80.21 0.0.0.0 source 192.168.40.6 0.0.2.255
rule 9 permit destinationg 10.126.80.21 0.0.0.0 source 192.168.50.6 0.0.2.255
rule 10 deny any
traffic classifier tc6
if-match acl 3006
traffic behavior tb6
permit
traffic policy tp6
classifier tc6 behavior tb6
quit(注意访问控制列表应该是双向的不仅要控制回来还要控制出去注意绑定方向)
interface gig 1/0/0
traffic-policy tp1 outbound
interface gig 1/0/1
traffic-policy tp2 outbound
interface gig 1/0/2
traffic-policy tp3 outbound
interface gig 1/0/3
traffic-policy tp4 outbound
interface gig 1/0/4
traffic-policy tp5 outbound
interface gig 1/0/5
traffic-policy tp6 outbound
(配置完成,如果还有什么问题,可以问我。)
温馨提示:答案为网友推荐,仅供参考