当前位置:首页 » 文件传输 » 华为交换机如何指定网段访问
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

华为交换机如何指定网段访问

发布时间: 2023-03-07 04:39:31

① 华为交换机配置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
(配置完成,如果还有什么问题,可以问我。)

② 华为交换机如何配置用户访问指定ip的指定端口时,路由至指定的ip地址

华为和H3C的三层交换机的接口不能直接指定为三层接口,需要通过SVI接口和对应的VLAN制造三层接口才行。
先将端口划入一个VLAN a,然后使用interface vlan a,这个int vlan接口可以配置IP地址。直接给接口指定IP地址是怎样都不可以的。

③ 华为三层交换机5700 DHCP配置如何让ip从指定地址开始分配

在华为三层交换机5700交换机上开启DHCP服务,然后配置好地址池为192.168.2.254网段,排除掉192.168.2.200到192.168.2.199这个范围的所有IP,具体命令如下:

dhcp enable

ip address 192.168.2.200 255.255.255.0

interface vlanif10

dhcp server excluded-ip - address 192.168.2.200 192.168.2.199

dhcp select interface

dhcp server lease day 30 hour 0 minute 0

dhcp server dns-list X.X.X.X

其dns和租期要根据实际情况配置。

(3)华为交换机如何指定网段访问扩展阅读:

DHCP有三种机制分配IP地址:

1、(Automatic Allocation)自动分配方式,DHCP服务器为主机指定一个永久性的IP地址,DHCP客户端第一次成功从DHCP服务器端租用到IP地址后,就可以永久性地使用该地址。

2、(Dynamic Allocation)动态分配方式,DHCP服务器给主机指定具有时间限制的IP地址,时间到期或主机明确表示放弃该地址时,该地址可以被其他主机使用。

3、(Manual Allocation)手工分配方式,客户端的IP地址是由网络管理员指定的,DHCP服务器只能将指定的IP地址告诉客户端主机。

三种地址分配方式中,只有动态分配可以重复使用客户端不再需要的地址。