H3C VLAN的配置 VLAN配置实例

1,配置VLAN端口类型
<h3c>system-view
[h3c]interface Ethernet 1/0/2
[H3C-Ethernet1/0/2]port link-type Access|trunk|Hybrid
[H3C-Ethernet1/0/2]quit
2,配置将端口加入指定的vlan
<h3c>system-view
[h3c]interface Ethernet 1/0/2
A,Trunk类型:[H3C-Ethernet1/0/2]port trunk permit vlan X
B,Hybrid类型:[H3C-Ethernet1/0/2]port hybird vlan X tagged|untagged
[H3C-Ethernet1/0/2]quit
3,配置端口的缺省VLAN

<h3c>system-view
[h3c]interface Ethernet 1/0/2
A,Trunk类型:[H3C-Ethernet1/0/2]port trunk pvid vlan X
B,Hybrid类型:[H3C-Ethernet1/0/2]port hybird pvid vlan X
[H3C-Ethernet1/0/2]quit

-------------------------------------------------------------------------------------------------------

H3C VLAN配置实例
 

用4台PC(pc多和少,原理是一样的,所以这里我只用了4台pc),华为路由器(R2621)、交换机(S3026e)各一台,组建一VLAN,实现虚拟网和物理网之间的连接。实现防火墙策略,和访问控制(ACL)。


方案说明:
四台PC的IP地址、掩码如下列表:
P1 192.168.1.1 255.255.255.0 网关IP 为192.168.1.5
P2 192.168.1.2 255.255.255.0 网关IP 为192.168.1.5
P3 192.168.1.3 255.255.255.0 网关IP 为192.168.1.6
P4 192.168.1.4 255.255.255.0 网关IP 为192.168.1.6
路由器上Ethernet0的IP 为192.168.1.5
Ethernet1的IP 为192.168.1.6
firewall 设置默认为deny

实施命令列表:
交换机上设置,划分VLAN:
<Quidway>sys
//切换到系统视图
[Quidway]vlan enable
[Quidway]vlan 2
[Quidway-vlan2]port e0/1 to e0/8
[Quidway-vlan2]quit
//默认所有端口都属于VLAN1,指定交换机的e0/1 到e0/8八个端口属于VLAN2
[Quidway]vlan 3
[Quidway-vlan3]port e0/9 to e0/16
[Quidway-vlan3]quit
//指定交换机的e0/9 到e0/16八个端口属于VLAN3
[Quidway]dis vlan all
[Quidway]dis cu

路由器上设置,实现访问控制:
[Router]interface ethernet 0
[Router-Ethernet0]ip address 192.168.1.5 255.255.255.0
[Router-Ethernet0]quit
//指定ethernet 0的ip
[Router]interface ethernet 1
[Router-Ethernet1]ip address 192.168.1.6 255.255.255.0
[Router-Ethernet1]quit
//开启firewall,并将默认设置为deny
[Router]fire enable
[Router]fire default deny
//允许192.168.1.1访问192.168.1.3
//firewall策略可根据需要再进行添加
[Router]acl 101
[Router-acl-101]rule permit ip source 192.168.1.1 255.255.255.0 destination 192.168.1.3 255.255.255.0
[Router-acl-101]quit
//启用101规则
[Router-Ethernet0]fire pa 101
[Router-Ethernet0]quit
[Router-Ethernet1]fire pa 101
[Router-Ethernet1]quit

---------------------------------------------------------------------------------------------------------------------------------------------------

H3C E126A是一款专为教育城域网(或校园网)设计的二层智能交换机,作业接入层或汇聚层使用。本篇文章主要介绍基于端口的Vlan的配置。

  一、创建Vlan
  在系统(全局)视图下输入命令:vlan vlanid
[Swicth126A]vlan 20 //说明:创建ID为20的vlan
[Swicth126A-vlan20]name Chinese //vlan的名称为Chinese
[Swicth126A-vlan20]description Chinese Teacher  //vlan的描述
[Swicth126A-vlan20]quit
  
  二、把交换机的端端口划分到相应的Vlan中
[Swicth126A]interface ethernet1/0/2       //进入端口模式
[Swicth126A-Ethernet1/0/2]port link-type access //设置端口的类型为access
[Swicth126A-Ethernet1/0/2]port access vlan 20  //把当前端口划到vlan 20
[Swicth126A-Ethernet1/0/2]

[Swicth126A]vlan 10
[Swicth126A-vlan10]port ethernet1/0/3 to ethernet1/0/5  //把以及网端口1/0/3到1/0/5划到vlan10
[Swicth126A-vlan10]quit

  三、为Vlan配置IP
[Swicth126A]management-vlan 20          //管理vlan20
[Swicth126A]interface vlan-interface 20     //进入vlan 20接口模式
[Swicth126A-Vlan-interface20]
%Apr 2 00:33:29:321 2000 Swicth126A L2INF/5/VLANIF LINK STATUS CHANGE:- 1 -
Vlan-interface20 is UP

[Swicth126A-Vlan-interface20]ip address 192.168.0.1 255.255.255.0 //为vlan20接口配置IP地址
[Swicth126A-Vlan-interface20]
%Apr 2 00:33:42:092 2000 Swicth126A IFNET/5/UPDOWN:- 1 -Line protocol on the in
terface Vlan-interface20 is UP

[Swicth126A-Vlan-interface20]quit
[Swicth126A]

[Swicth126A]undo interface vlan-interface 20  //删除vlan 20管理接口
[Swicth126A]
%Apr 2 00:40:45:273 2000 Swicth126A L2INF/5/VLANIF LINK STATUS CHANGE:- 1 -
Vlan-interface20 is DOWN

%Apr 2 00:40:45:375 2000 Swicth126A IFNET/5/UPDOWN:- 1 -Line protocol on the in
terface Vlan-interface20 is DOWN

[Swicth126A]management-vlan 10        
[Swicth126A]interface vlan-interface 10  //进入vlan 10接口模式
[Swicth126A-Vlan-interface10]
%Apr 2 00:41:11:634 2000 Swicth126A L2INF/5/VLANIF LINK STATUS CHANGE:- 1 -
Vlan-interface10 is UP

[Swicth126A-Vlan-interface10]ip address 192.168.1.1 255.255.255.0  //设置IP地址
[Swicth126A-Vlan-interface10]
%Apr 2 00:41:23:241 2000 Swicth126A IFNET/5/UPDOWN:- 1 -Line protocol on the in
terface Vlan-interface10 is UP

[Swicth126A-Vlan-interface10]quit
[Swicth126A]

  四、查看Vlan信息
[Swicth126A][Swicth126A]display vlan 20
VLAN ID: 20
VLAN Type: static
Route Interface: not configured
Description: Chinese Teacher
Name: Chinese
Tagged Ports: none
Untagged Ports:
Ethernet1/0/2 Ethernet1/0/6 Ethernet1/0/7
Ethernet1/0/8 Ethernet1/0/9 Ethernet1/0/10

 

你可能感兴趣的:(配置,h3c)