不同VLAN之间互访.docx
《不同VLAN之间互访.docx》由会员分享,可在线阅读,更多相关《不同VLAN之间互访.docx(10页珍藏版)》请在冰豆网上搜索。
不同VLAN之间互访
不同VLAN之间互访
利用三层交换机实现不同VLAN之间的互访
交换机switch0和switch1创建4个vlan,vlan10,vlan20,vlan30,vlan40,将每个交换机的fa0/1-3,fa0/4-6,fa0/7-9,fa0/10-12分别分配给以上四个vlan,再在三层交换机上进行配置,要求实现不同vlan之间能够互访。
一、拓扑图
二、交换机的配置
1、switch0的配置
Switch>en
Switch#vlandatabase
Switch#conft
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
Switch(config)#interfacerangefa0/1-3
Switch(config-if-range)#switchportmodeaccess
Switch(config-if-range)#switchportaccessvlan10
Switch(config-if-range)#exit
Switch(config)#interfacerangefa0/4-6
Switch(config-if-range)#switchportmodeaccess
Switch(config-if-range)#switchportaccessvlan2
%AccessVLANdoesnotexist.Creatingvlan2
Switch(config-if-range)#switchportaccessvlan20
Switch(config-if-range)#exit
Switch(config)#interfacerangefa0/7-9
Switch(config-if-range)#switchportmodeaccess
Switch(config-if-range)#switchportaccessvlan30
Switch(config-if-range)#exit
Switch(config)#interfacerangefa0/10-12
Switch(config-if-range)#switchportmodeaccess
Switch(config-if-range)#switchportaccessvlan40
Switch(config-if-range)#exit
Switch(config)#interfacefa0/24
Switch(config-if)#switchportmodetrunk
Switch(config-if)#switchporttrunkallowedvlanall
Switch(config-if)#exit
Switch(config)#
2、switch1的配置
同switch0的配置一样
3、MultilayerSwitch0
Switch>enable
Switch#vlandatabase
%Warning:
ItisrecommendedtoconfigureVLANfromconfigmode,
asVLANdatabasemodeisbeingdeprecated.Pleaseconsultuser
documentationforconfiguringVTP/VLANinconfigmode.
Switch(vlan)#vlan10
VLAN10added:
Name:
VLAN0010
Switch(vlan)#vlan20
VLAN20added:
Name:
VLAN0020
Switch(vlan)#vlan30
VLAN30added:
Name:
VLAN0030
Switch(vlan)#vlan40
VLAN40added:
Name:
VLAN0040
Switch(vlan)#exit
APPLYcompleted.
Exiting....
Switch#conft
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
Switch(config)#iprouting
Switch(config)#interfacevlan10
Switch(config-if)#
%LINK-5-CHANGED:
InterfaceVlan10,changedstatetoup
%LINEPROTO-5-UPDOWN:
LineprotocolonInterfaceVlan10,changedstatetoup
Switch(config-if)#ipaddress192.168.0.254255.255.255.0
Switch(config-if)#noshutdown
Switch(config-if)#exit
Switch(config)#interfacevlan20
Switch(config-if)#
%LINK-5-CHANGED:
InterfaceVlan20,changedstatetoup
%LINEPROTO-5-UPDOWN:
LineprotocolonInterfaceVlan20,changedstatetoup
Switch(config-if)#ipaddress192.168.1.254255.255.255.0
Switch(config-if)#noshutdown
Switch(config-if)#exit
Switch(config)#interfacevlan30
%LINK-5-CHANGED:
InterfaceVlan30,changedstatetoup
%LINEPROTO-5-UPDOWN:
LineprotocolonInterfaceVlan30,changedstatetoup
Switch(config-if)#ipaddress192.168.2.254255.255.255.0
Switch(config-if)#noshutdown
Switch(config-if)#exit
Switch(config)#interfacevlan40
%LINK-5-CHANGED:
InterfaceVlan40,changedstatetoup
%LINEPROTO-5-UPDOWN:
LineprotocolonInterfaceVlan40,changedstatetoup
Switch(config-if)#ipaddress192.168.3.254255.255.255.0
Switch(config-if)#noshutdown
Switch(config-if)#^Z
Switch#
%SYS-5-CONFIG_I:
Configuredfromconsolebyconsole
Switch#
三、电脑的配置
三、测试连通性
Pc0ping其它电脑