(1)各VLAN之间互联互通:单臂路由
(2)每台PC都能自动获取IP地址:DHCP
(3)两台交换机要求VLAN2走上面,VLAN3走下面:STP负载均衡
(4)SW2能从SW1学到VLAN相关信息:Trunk、VTP
(5)能在任何地方都能管理到每台网络设备:telnet 交换机用vlan 1做管理VLAN3
(6)交换机连接PC的端口做实现快速收敛(portfast)
------------------------------------------------------SW1-----------------
SW1(config)#int f0/13
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk //配置trunk
SW1(config-if)#int f0/14
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config)#int f0/3
SW1(config-if)#switchport mode trunk
*修改了VTP的域为YB,并且创建了vlan2和vlan3.
SW1#show vtp s
VTP Version : 2
Configuration Revision : 2
Maximum VLANs supported locally : 128
Number of existing VLANs : 7
VTP Operating Mode : Server
VTP Domain Name : YB
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x00 0xAB 0x73 0xC7 0x59 0xF6 0x50 0xC8
Configuration last modified by 0.0.0.0 at 3-1-93 00:15:43
Local updater ID is 172.16.14.10 on interface Vl1 (lowest numbered VLAN interface found
SW1(config)#enable password cisco
SW1(config)#line vty 0 15
SW1(config)#int vlan 1
SW1(config-if)#ip address 172.16.14.10 255.255.255.0
SW1(config-line)#password cisco
SW1#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
2 VLAN0002 active Fa0/1
3 VLAN0003 active Fa0/2
*把F0/1分配给vlan2,把F0/2分配给vlan3.
SW1(config)#int range f0/1 - 2
SW1(config-if-range)#spanning-tree portfast //配置快速收敛的接口。
--------------------------------------------------------------SW2-----------------------------------
SW2(config)#int f0/14
SW2(config-if)#spanning-tree vlan 3 cost 18
SW2#show spanning-tree vlan 2
Fa0/1 Desg FWD 100 128.1 Shr
Fa0/13 Root FWD 19 128.13 P2p
Fa0/14 Altn BLK 19 128.14 P2p
SW2#show spanning-tree vlan 3
Fa0/13 Altn BLK 19 128.13 P2p
Fa0/14 Root FWD 18 128.14 P2p
*实现负载均衡。
SW2(config)#int f0/1
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 2
SW2#show vtp status
VTP Version : 2
Configuration Revision : 2
Maximum VLANs supported locally : 64
Number of existing VLANs : 7
VTP Operating Mode : Server
VTP Domain Name : YB
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x00 0xAB 0x73 0xC7 0x59 0xF6 0x50 0xC8
Configuration last modified by 0.0.0.0 at 3-1-93 00:15:43
Local updater ID is 0.0.0.0 (no valid interface found)
-------------------------------------------R1---------------------------------------------------------
R1(config)#int e0/0
R1(config-if)#ip add 172.16.14.1 255.255.255.0
R1(config-if)#no shut
R1(config)#int e0/0.2
R1(config-subif)#encapsulation d
R1(config-subif)#encapsulation dot1Q 2
R1(config-subif)#ip add 172.16.12.1 255.255.255.0
R1(config-subif)#int e0/0.3
R1(config-subif)#encapsulation dot1Q 3
R1(config-subif)#ip add 172.16.13.1 255.255.255.0
R1(config)#int e0/0.2
R1(config-subif)#ip help
R1(config-subif)#ip helper-address 172.16.12.4
R1(config-subif)#int e0/0.3
R1(config-subif)#ip helper-address 172.16.12.4
--------------------------------------------R2-------------------------------------------------------
R2(config)#int f0/0
R2(config-if)#ip add dhcp
*Interface FastEthernet0/0 assigned DHCP address 172.16.12.5, mask 255.255.255.0
在DHCP服务器中取到了IP地址。
R2#telnet 172.16.14.10
Trying 172.16.14.10 ... Open
User Access Verification
Password:
SW1>en
Password:
SW1#
SW1#
*远程交换1成功。
-----------------------------------R3-------------------------------------
R3(config)#int f0/0
R3(config-if)#ip add dhcp
*Mar 1 00:39:20.076: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 172.16.13.2, mask 255.255.255.0, hostname R3
*在DHCP中拿到IP地址。
R3#telnet 172.16.14.10
Trying 172.16.14.10 ... Open
User Access Verification
Password:
SW1>en
Password:
SW1#
*远程交换机1成功。
--------------------------------------------R4----------------------------
R4(config)#int e0/0
R4(config-if)#ip add 172.16.12.4 255.255.255.0
R4(config)#ip dhcp pool 1
R4(dhcp-config)#network 172.16.12.0 /24
R4(dhcp-config)#default-router 172.16.12.1
R4(config)#ip dhcp excluded-address 172.16.12.1 172.16.12.4
R4(config)#ip dhcp pool 2
R4(dhcp-config)#network 172.16.13.0 /24
R4(dhcp-config)#default-router 172.16.13.1
R4(config)#ip dhcp excluded-address 172.16.13.1
SW2(config)#int f0/1
SW2(config-if)#spanning-tree portfas
R4#telnet 172.16.14.10
Trying 172.16.14.10 ... Open
User Access Verification
Password:
SW1>en
Password:
SW1#
*远程交换机1成功。
实验的验证:
1) 单臂路由:
R2#ping 172.16.13.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.13.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
R2#ping 172.16.12.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.12.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/202/1004 ms
R3#ping 172.16.12.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.12.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
R3#ping 172.16.12.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.12.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
R4#ping 172.16.13.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.13.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms
R4#ping 172.16.12.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.12.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
2)学习到的trunk和vtp的信息:
SW1#show int trunk
Port Mode Encapsulation Status Native vlan
Fa0/3 on 802.1q trunking 1
Fa0/13 on 802.1q trunking 1
Fa0/14 on 802.1q trunking 1
SW2#show int trunk
Port Mode Encapsulation Status Native vlan
Fa0/13 desirable 802.1q trunking 1
Fa0/14 desirable 802.1q trunking 1
SW2#show vtp status
VTP Version : 2
Configuration Revision : 2
Maximum VLANs supported locally : 64
Number of existing VLANs : 7
VTP Operating Mode : Server
VTP Domain Name : YB
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
SW1#show vtp status
VTP Version : 2
Configuration Revision : 2
Maximum VLANs supported locally : 128
Number of existing VLANs : 7
VTP Operating Mode : Server
VTP Domain Name : YB
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
本文出自 “做个踏实的虚拟人” 博客,转载请与作者联系!