23rewr 发表于 2014-11-21 17:31:29

使用华为三层交换实现vlan间路由配置实战

1.    实验网络拓扑:
使用ENSP模拟器(版本V100R002C00 1.2.00.350)

2.    实验需求:属于vlan 10的C1能和属于vlan 20的C3、C4及R1通信
3.    实验步骤:A.IP地址及valn划分规划配置如下:C1:ip地址为192.168.10.10/24 属于vlan 10C2:ip地址为192.168.20.20/24属于vlan 20C3:ip地址为192.168.10.30/24属于vlan 10C4:ip地址为192.168.20.40/24属于vlan 20Sw1:vlan10 的网关为192.168.10.1/24      vlan20 的网关为192.168.20.1/24      G0/0/3属于vlan100ip为201.100.100.1 /24R1:G0/0/0 ip为201.100.100.2/24B.配置脚本:
1.   交换机SW2的配置l 先在交换机上加VLAN 10 20,再设置接口传输模式为access口sy
vlan bat 10 20   #批量加vlan10和20
int e0/0/1
portlink-type ac
port link-typeaccess#接口类型为access
port defaultvlan 10#让接口属于vlan10
inte0/0/2
portlink-type ac
portlink-type access
portde
portdefault vlan 20

intg0/0/1
port link-type trunk#将g0/0/1设为trunk 中继口
port trunk allow-pass vlan 1 10 20   
#此中继接口允许vlan1 10 20的数据过,也称透传
l用display vlan 查看配置结果如下图
l给交换机SW2配IP地址和网关,便于远程管理因为交换机的接口是二层接口不能陪IP,所以给交换机配IP只能为其VLAN虚拟口配IPint vlan 1
ip add192.168.1.254 24
q

l在华为模拟器上通过设默认路由的方式为其设置网关ip route-s
ip route-static 0.0.0.0 0.0.0.0 192.168.1.1

l用display ip interface brief查看各接口配置
2.交换机SW3的配置
l为交换机SW3配VLAN,接口传输模式为hybrid untagged模式,hybriduntagged模式不带标签相当于access模式,hybrid tagged模式带标签相当于trunk模式sy
vlan bat 10 20
interface e0/0/3
portlink-type hybrid   #将接口类型设为hybrid混合接口,华为三层交换机接口默认就是hybrid,属于这条命令可以不用写
port hybridpvid vlan 10
porthy
porthybrid un
porthybrid untagged
porthybrid untagged vlan 10#允许vlan10 的数据过且不带标签
inte0/0/4
porthybrid pvid vlan 20
porthybrid un
porthybrid untagged vlan 20


intg0/0/1
porthybrid pvid vlan 10
porthybrid pvid vlan 20
porthy
porthybrid t   
porthybrid tagged vlan 10 20
#允许vlan10 20的数据通过且带标签

l用display vlan查看vlan配置
l给交换机vlan1配ip地址和网关,便于远程管理intvlan 1
ip add192.168.1.253 24
q
ip route-s
ip route-static 0.0.0.0 0.0.0.0 192.168.1.1

结果如图:


3.三层交换机SW1的配置
l给交换机SW1配vlansy
vlan bat 10 20 100
interface g0/0/1
portlink-type trunk
porttrunk allow-pass vlan 1 10 20

intg0/0/2
port hybridpvid vlan 1
port hybridpvid vlan 10
port hybridpvid vlan 20
porthybrid un
port hybriduntagged vlan 1 10 20

intg0/0/3
portlink-type ac
portlink-type access
portde
portdefault vlan 100


l 给vlan110 20 100配ip地址intvlan 1
ipadd 192.168.1.1 24


intvlan 10

ip add192.168.10.1 24


int vlan20
ip add192.168.20.1 24


int vlan100
ip add201.100.100.1 24

l为交换机配默认路由iproute-s
ip route-static 0.0.0.0 0.0.0.0 201.100.100.2
结果如图:


4.路由器R1 的配置
l 给路由器R1接口配ip地址和默认路由sy
int g0/0/0
ipadd 201.100.100.2 24
ip route-s
ip route-static 0.0.0.0 0.0.0.0 201.100.100.1
l用display ip int b查看接口配置,用displayip routing-t查看路由表,结果如图


4).验证结果
因为C1和C3属于vlan10,C2和C4属于vlan20,如果没有做vlan间路由,不同vlan间的成员是无法通信的,现在用C1 ping C2、C4和R1就说明vlan间路由是做成功的lC1 ping C2 d的ip192.168.20.20和C4的ip192.168.20.40 结果如图:
l C1ping R1的ip201.100.100.2 结果如图:

由上可得华为三层交换vlan间路由的实验成功了。


页: [1]
查看完整版本: 使用华为三层交换实现vlan间路由配置实战