您的位置:首页 > 其它

路由交换笔记(40)---配置vlan与trunk

2010-05-28 22:54 706 查看


配置PC的IP
pc1-pc6 192.1.1.1.-192.1.1.6



首先创建vlan
switch1
Router#vlan database
Router(vlan)#vlan 10 na
Router(vlan)#vlan 10 name a
VLAN 10 added:
Name: a
Router(vlan)#vla
Router(vlan)#vlan 20 nam
Router(vlan)#vlan 20 name b
VLAN 20 added:
Name: b

再把借口定义为access并且放入vlan
Router(config)#interface range fastEthernet 0/1 - 2
Router(config-if-range)#sw
Router(config-if-range)#switchport mod
Router(config-if-range)#switchport mode acc
Router(config-if-range)#switchport mode access sw
Router(config-if-range)#switchport mode access
Router(config-if-range)#sw
Router(config-if-range)#switchport acc
Router(config-if-range)#switchport access vl
Router(config-if-range)#switchport access vlan 10
Router(config-if-range)#exit
Router(config)#int
Router(config)#interface f0/3
Router(config-if)#sw
Router(config-if)#switchport mo
Router(config-if)#switchport mode ac
Router(config-if)#switchport mode access
Router(config-if)#sw
Router(config-if)#switchport acc
Router(config-if)#switchport access vl
Router(config-if)#switchport access vlan 20
确定trunk干道
Router(config)#int f0/0
Router(config-if)#sw
Router(config-if)#switchport acc
Router(config-if)#switchport access en
Router(config-if)#switchport trun
Router(config-if)#switchport trunk en
Router(config-if)#switchport trunk encapsulation do
Router(config-if)#switchport trunk encapsulation dot1q
Router(config-if)#sw
Router(config-if)#switchport mod
Router(config-if)#switchport mode tr
Router(config-if)#switchport mode trunk

switch2与1一样配置

switch2#vlan database
switch2(vlan)#vlan 10 name a
VLAN 10 added:
Name: a
switch2(vlan)#vlan 20 nam
switch2(vlan)#vlan 20 name b
VLAN 20 added:
Name: b
switch2(config)#int f0/4
switch2(config-if)#switchport mode access
switch2(config-if)#switchport access vl
switch2(config-if)#switchport access vlan 10
switch2(config-if)#exit
switch2(config)#int range fastEthernet 0/5 - 6
switch2(config-if-range)#switchport mode access
switch2(config-if-range)#switchport access vlan
switch2(config-if-range)#switchport access vlan 20

配好以后 show vlan-switch 看接口
测试效果相同vlan是可以通信的,不同vlan不能通信
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: