單臂路由實現不同vlan之間的通訊
路由器與交換機之間的單臂路由
要實現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通
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.