在企业网中利用单臂路由实现VLAN间通信
一、基础知识:
1)VLAN的类型:
1、本地vlan:同一个vlan的成员都在一台交换机上;
2、端到端vlan:同一个vlan的成员分散到不同的交换机上;
2)VLAN的优点:
1、控制网络的广播风暴
采用VLAN技术,可将某个交换端口划到某个VLAN中,而一个VLAN的广播风暴不会影响其它VLAN的性能。
2、确保网络安全
共享式局域网之所以很难保证网络的安全性,是因为只要用户插入一个活动端口,就能访问网络。而VLAN能限制个别用户的访问,控制广播组的大小和位置,甚至能锁定某台设备的MAC地址,因此VLAN能确保网络的安全性。
3、简化网络管理
网络管理员能借助于VLAN技术轻松管理整个网络。例如需要为完成某个项目建立一个工作组网络,其成员可能遍及全国或全世界,此时,网络管理员只需设置几条命令,就能在几分钟内建立该项目的VLAN网络,其成员使用VLAN网络,就像在本地使用局域网一样。
4、成本降低
成本高昂的网络升级需求减少,现有带宽和上行链路的利用率更高,因此可节约成本。
5、性能提高
将第二层平面网络划分为多个逻辑工作组(广播域)可以减少网络上不必要的流量并提高性能。
3)端口类型:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102209Oyeh.png"></a>
4)各种端口的报文接受和发送过程:
a、ACCESS端口模式图解
1.端口接收到报文处理方式
<a href="http://blog.51cto.com/attachment/201208/215103538.png" target="_blank"></a>
2.端口发送报文处理方式
<a href="http://blog.51cto.com/attachment/201208/215202719.png" target="_blank"></a>
b、TRUNK端口模式图解
<a href="http://blog.51cto.com/attachment/201208/215219394.png" target="_blank"></a>
<a href="http://blog.51cto.com/attachment/201208/215234356.png" target="_blank"></a>
c、HYBRID端口模式图解
<a href="http://blog.51cto.com/attachment/201208/215248516.png" target="_blank"></a>
<a href="http://blog.51cto.com/attachment/201208/215259540.png" target="_blank"></a>
二、案例 - 1:
1、实验说明:
假设某企业有两个主要部门:技术部和市场部,用工都连接在一台二层交换机上,网络中有一台路由器用于连接Internet。现发现网络内广播流量太多,还有从安全性方面考虑,为了实现隔离广播和网络的安全性,现划分的vlan,分为技术部vlan、市场部vlan、和服务器vlan,还有一个普通vlan,要求普通vlan、技术部vlan和市场部vlan只能与服务器vlan相互通信,其他vlan间不能通信。
2、实验原理:
在交换网络中,通过VLAN技术对一个局域网进行逻辑划分,不同的VLAN之间是无法直接通信的,必须通过三层及更高的的设备进行连接;
将路由器和交换机相连,使用IEEE802.1q来启动路由器上的以太网子接口成为干道模式,就可以利用路由器来实现VLAN间通信;
为了实现控制VLAN间通信,我们在路由器上可以添加访问控制列表来进行控制;
3、实验拓扑:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102315iR1I.png"></a>
4、实验环境:
华为交换机1台(S2000系列)
华为路由器1台(R2621系列)
PC机4台
5、实验要求:
PC 1与Server互通;
PC 2与Server互通;
PC 3与Server互通;
PC 1、PC 2和PC 3之间互不相同;
6、实验步骤:
1)配置交换机:
a、创建vlan 10:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102452OWDj.png"></a>
b、创建vlan 20:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_13451024536xUk.png"></a>
c、创建vlan 30:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102458oqKK.png"></a>
d、将一个端口设置成trunk端口,用以实现vlan间通信:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_13451024735kEM.png"></a>
2)配置路由器:
a、配置扩展访问控制列表:使用扩展访问控制列表
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102564eeAo.png"></a>
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102586W0Fg.png"></a>
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102615LDf8.png"></a>
b、配置接口:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102643ocZ3.png"></a>
c、配置以太网子接口,并在接口上应用扩展ACL:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102681Blb6.png"></a>
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102698fBKR.png"></a>
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_13451027221UT5.png"></a>
7、验证测试:
1)从PC 1 ping Server主机:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102731fBhA.png"></a>
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102745awh0.png"></a>
2)从PC 2 ping Server主机:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102753C8kI.png"></a>
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_13451027551J5j.png"></a>
3)从PC 3 ping Server主机:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102763KQbL.png"></a>
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102769aTTC.png"></a>
4)从PC 1 ping PC 2:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_1345102793r0Z1.png"></a>
5)从PC 2 ping PC 3:
<a href="http://cexpert.blog.51cto.com/attachment/201208/16/5251990_134510280236rE.png"></a>
8、实验小结:
要想vlan1与其他vlan通信,不可以使用以太网子接口作为vlan1的网关,因为vlan1通过trunk时是不打标签的,所以在通过以太网子接口时,是无法通过的。
应该直接在路由器上的以太网接口上配置一个地址,此地址则为vlan 1的网关地址;从而实现vlan 1与其他vlan间的通信;
本文转自 cexpert 51CTO博客,原文链接:http://blog.51cto.com/cexpert/964960