路由器中VLAN IP怎么配置?

路由器中VLAN IP怎么配置?,第1张

1、搭建拓扑规划地址,地址如图所示三个不同网段的主机连接在一台三层交换机上通过vlanif实现互通。

2、设好主机地址及默认网关。

3、创建vlan,vlan batch 10 20 30。

4、配置端口类型划分vlan port link-type access port default vlan x。

5、创建配置vlanif接口interface vlanif x    //要先创建vlan才可以创建vlanif接口ip address x.x.x.x 掩码。

6、测试即可。

首先有几个问题你没有说太明白,我只好做假设。

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

(配置完成,如果还有什么问题,可以问我。)

1.管理IP只是交换机用于被日常维护管理所用的

2.vlanIP通常是作为某个Vlan的网关地址,当然是给终端PC使用的

一般来讲,二层交换机只能设置管理IP(vlan1)。不能设置vlanIP

而三层交换机则同时可以设置

二。对于二层交换机只能设置一个VLAN IP

这个IP地址做管理用,缺省是设在VLAN 1上

但是你也可以根据需要设在别的VLAN下边,但是记住在二层交换机上只能设一个

你设的时候是可以在多个VLAN下设置IP, 但在二层交换机上只能同时 no shut 一个带IP的VLAN (即只有一个管理地址能被激活).例如:你在vlan1 和vlan 2上都配置了IP但是你如果只能激活vlan 1和vLna2中的一个


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/10896129.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-12
下一篇 2023-05-12

发表评论

登录后才能评论

评论列表(0条)

保存