资源预览内容
第1页 / 共8页
第2页 / 共8页
第3页 / 共8页
第4页 / 共8页
第5页 / 共8页
第6页 / 共8页
第7页 / 共8页
第8页 / 共8页
亲,该文档总共8页全部预览完了,如果喜欢就下载吧!
资源描述
首先,说明一下本例子。vlan 之间通讯需要用到的设备有:二层交换机两个(当然三层也可以,不过很贵),路由器/3 层交换机 一台(支持 802.1q 协议),pc4 台。试验环境为 Cisco 虚拟软件 packet trcer 4.1二层交换机:首先要明白一点,对于 vlan 通讯来说,二层交换机上 vlan 没有必要配 ip 地址,唯一需要的是 vlan1(配置的 ip 地址为管理地址)。其次,二层交换机没有 ip 地址。当然 vlan 可以设置 ip,但是端口什么的没有 ip。虽然这点很简单,但是,很多人经常忘记,至少我身边的同学好多都不知道这个事实。还有,这点很重要,二层交换机只能同一时刻存在一个 vlan。最后,要保证 vlan 之间可以相互通讯的前提,就是二层与路由的接口要设置为trunk 模式。路由器:由于要实现 vlan 之间通讯,所以路由器需要用到 802.1q 协议,来封装端口。(下面开始配置)S1:vlan 1 :IP :10.1.0.2/16vlan 10: name-V1 下属 pc:IP:192.168.1.x/24 网关 192.168.1.254/24vlan 20: name-V2 下属 pc:IP:192.168.2.x/24 网关 192.168.2.254/24S2:vlan1:IP:10.2.0.2/16vlan 30: name-V3 下属 pc:IP:192.168.3.x/24 网关 192.168.3.254/24vlan 40: name-V4 下属 pc:IP:192.168.4.x/24 网关 192.168.4.254/24R1:F0/0:IP:10.1.0.1/16虚接口地址:F0/0.1: IP:192.168.1.254/24F0/0.2: IP:192.168.2.254/24F0/1:IP:10.2.0.1/16虚接口地址:F0/1.1: IP:192.168.3.254/24F0/1.2: IP:192.168.4.254/24拓扑图如下:S1 配置如下:SwitchenSwitch#conf tEnter configuration commands, one per line. End with CNTL/Z.Switch(config)#hostSwitch(config)#hostname S1S1(config)#vlan 10S1(config-vlan)#name V1S1(config-vlan)#exitS1(config)#vlan 20S1(config-vlan)#name V2S1(config-vlan)#int vlan 1S1(config-if)#ip address 10.1.0.2 255.255.0.0S1(config-if)#no shut%LINK-5-CHANGED: Interface Vlan1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to upS1(config-if)#int f0/2S1(config-if)#switchport mode accessS1(config-if)#switchport access vlan 10S1(config-if)#no shutS1(config-if)#int f0/3S1(config-if)#switchport mode accessS1(config-if)#switchport access vlan 20S1(config-if)#no shutS1(config-if)#int f0/1S1(config-if)#switchport mode trunkS1(config-if)#switchport trunk allowed vlan allS1(config-if)#no shutS1(config-if)#end%SYS-5-CONFIG_I: Configured from console by consoleS1#sh vlanVLAN Name Status Ports- - - -1 default active Fa0/1, Fa0/4, Fa0/5, Fa0/6Fa0/7, Fa0/8, Fa0/9, Fa0/10Fa0/11, Fa0/12, Fa0/13, Fa0/14Fa0/15, Fa0/16, Fa0/17, Fa0/18Fa0/19, Fa0/20, Fa0/21, Fa0/22Fa0/23, Fa0/2410 V1 active Fa0/220 V2 active Fa0/31002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2- - - - - - - - - - -1 enet 100001 1500 - - - - - 0 010 enet 100010 1500 - - - - - 0 020 enet 100020 1500 - - - - - 0 01002 enet 101002 1500 - - - - - 0 01003 enet 101003 1500 - - - - - 0 01004 enet 101004 1500 - - - - - 0 01005 enet 101005 1500 - - - - - 0 0S2 设置如上:SwitchenSwitch#conf tEnter configuration commands, one per line. End with CNTL/Z.Switch(config)#hostname S2S2(config)#vlan 30S2(config-vlan)#name V3S2(config-vlan)#no shut% Invalid input detected at marker.S2(config-vlan)#vlan 40S2(config-vlan)#name V4S2(config-vlan)#int vlan 1S2(config-if)#ip address 10.2.0.2 255.255.0.0S2(config-if)#no shut%LINK-5-CHANGED: Interface Vlan1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to upS2(config-if)#int f0/2S2(config-if)#swit m aS2(config-if)#swit access vlan 30S2(config-if)#no shutS2(config-if)#int f0/3S2(config-if)#swit m aS2(config-if)#swit a vlan 40S2(config-if)#no shutS2(config-if)#int f0/1S2(config-if)#swit m tS2(config-if)#swit trunk allowed vlan allS2(config-if)#no shutS2(config-if)#end%SYS-5-CONFIG_I: Configured from console by consoleS2#sh vlanVLAN Name Status Ports- - - -1 default active Fa0/1, Fa0/4, Fa0/5, Fa0/6Fa0/7, Fa0/8, Fa0/9, Fa0/10Fa0/11, Fa0/12, Fa0/13, Fa0/14Fa0/15, Fa0/16, Fa0/17, Fa0/18Fa0/19, Fa0/20, Fa0/21, Fa0/22Fa0/23, Fa0/2430 V3 active Fa0/240 V4 active Fa0/31002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2- - - - - - - - - - -1 enet 100001 1500 - - - - - 0 030 enet 100030 1500 - - - - - 0 040 enet 100040 1500 - - - - - 0 01002 enet 101002 1500 - - - - - 0 01003 enet 101003 1500 - - - - - 0 01004 enet 101004 1500 - - - - - 0 01005 enet 101005 1500 - - - - - 0 0路由器 R1 设置如下:RouterenableRouter#conf tEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R1R1(config)#R1(config)#int f0/0R1(config-if)#ip address 10.1.0.1 255.255.0.0R1(config-if)#no shut%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR1(config-if)#int f0/1R1(config-if)#ip address 10.1.1.1 255.255.0.0% 10.1.0.0 overlaps with FastEthernet0/0R1(config-if)#ip address 10.2.0.1 255.255.0.0R1(config-if)#no shut%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upR1(config-if)#int f0/0.1%LINK-5-CHANGED:
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号