单臂路由实现不同vlan之间的通讯
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://cnxfei.blog.51cto.com/166422/31189 |
路由器与交换机之间的单臂路由
![]() 要实现vlan1 vlan2 vlan3间的通讯 借助一个路由器可以实现的 路由器与交换机之间也只需要连接一条链路 如图
单臂路由配置如下:
router(config)#interface 接口类型 槽位/接口序号.子接口号
router(config-subif)#encapsulation dot1q vlan-id
router(config-subif)#ip address ip_address subnetmask
如图实例 假设3个vlan中各有3台pc 配置如下:
router(config)#inter f0/0.1
router(config-subif)#encapsulation dot1q 1
router(config-subif)#ip address 192.168.1.1 255.255.255.0
router(config-subif)#no shutdown
router(config)#inter f0/0.2
router(config-subif)#encapsulation dot1q 2
router(config-subif)#ip address 192.168.2.1 255.255.255.0
router(config-subif)#no shutdown
router(config)#inter f0/0.3
router(config-subif)#encapsulation dot1q 3
router(config-subif)#ip address 192.168.3.1 255.255.255.0
router(config-subif)#no shutdown
router(config)#int f0/0
router(config-if)#no shutdown
在路由器与交换机连接的端口上配置子接口,每个子接口的ip地址是每个vlan的网关地址,并在子接口上封装802.1q
交换机和路由器相连的口要打上trunk
switch(config)#interface f0/12
switch(config-if)#switchport mode trunk
然后在3个vlan里的分别给3台pc配上相应的ip地址
相互应该可以ping通
本文出自 “菜鸟小飞” 博客,请务必保留此出处http://cnxfei.blog.51cto.com/166422/31189 本文出自 51CTO.COM技术博客 |




zr000
博客统计信息
热门文章
最新评论
友情链接