您的位置:首页 > 其它

vlan间路由(通过一个路由器,也称单臂路由)

2007-03-19 17:29 239 查看
[align=center]一、vlan间路由[/align]
1.1、原理介绍
   大家都知道vlan之间是不能互相通讯的,我们可以通过路由器来让两个不同的vlan之间通讯,叫单臂路由,如果是三层交换机也可以用三层交换来实现,下面我们讲单臂路由。
1.2、拓扑





如图上所示,其中下面两个其实是路由器,我们用它来代替PC,交换机是一个三层交换,也可以是一个2950,我们就以2950为例来配制。R1是一个路由器。
1.2、配制
PC1:===============================
int f0/0
duplex full
speed 100
ip add 10.1.1.2 255.255.255.0
no sh
exit
ip route 0.0.0.0 0.0.0.0 10.1.1.1
注:因为是用路由器来模拟PC所以须设默认地址指路由器R1的子接口地址,(后面要配制)到)
PC2:==================================
int f0/0
duplex full
speed 100
ip add 10.2.2.2 255.255.255.0
no sh
exit
ip route 0.0.0.0 0.0.0.0 10.1.1.2

Sw1:交换上的配制===================================
vlan datebase
vlan 10       //创建vlan 10
vlan 20 // vlan 20创建
int f0/1 //f0/1端口放在vlan 10中
duplex full
speed 100
switchport mode access
switchport access vlan 10
no sh
int f0/2 //f0/2端口放在vlan 20中
duplex full
speed 100
switchport mode access
switchport access vlan 20
no sh
int f0/5 //trunk链路。该端口和路由器相连,所以设为
shutdown
duplex full
speed 100
switchport mode trunk
switchport trunk encap dot1q
no sh
R1:===================================
int f0/0
no sh
int f0/0.1
encap dot1q 10 //10为是vlan 10其中的
ip add 10.1.1.1 255.255.255.0
no sh
int f0/0.2
encap dot1q 20 //20为是vlan 20其中的
ip add 10.2.2.1 255.255.255.0
no sh
exit
ip route 10.1.1.0 255.255.255.0 f0/0.1    //设置静态路由
ip route 10.2.2.0 255.255.255.0 f0/0.2

1.3、验证
我们用PC1来ping PC2,如果通说明实验成功。然后我们把交换机上的f0/5 shutdown再来看看是不是不通了。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息