第一步,配置VTP域,创建VLAN
3550:
3550:
3550#vlan database
3550(vlan)#vtp server
3550(vlan)#vtp domain sy
3550(vlan)#vtp password cisco
3550(vlan)#vlan 2
3550(vlan)#vlan 3
3550(vlan)#vtp pruning
3550(vlan)#exit
3550(vlan)#vtp server
3550(vlan)#vtp domain sy
3550(vlan)#vtp password cisco
3550(vlan)#vlan 2
3550(vlan)#vlan 3
3550(vlan)#vtp pruning
3550(vlan)#exit
SW1:
SW1#vlan database
SW1(vlan)#vtp client
SW1(vlan)#vtp domain sy
SW1(vlan)#vtp password cisco
SW1(vlan)#exit
SW1(vlan)#vtp client
SW1(vlan)#vtp domain sy
SW1(vlan)#vtp password cisco
SW1(vlan)#exit
第二步,设置中继
3550:
3550:
3550(config)#int f0/0
3550(config-if)#switchport trunk encapsulation dot1q
3550(config-if)#switchport mode trunk
3550(config-if)#end
3550#show vtp status
VTP Version : 2
Configuration Revision : 2
Maximum VLANs supported locally : 256
Number of existing VLANs : 7
VTP Operating Mode : Server
VTP Domain Name : sy
VTP Pruning Mode : Enabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
3550(config-if)#switchport trunk encapsulation dot1q
3550(config-if)#switchport mode trunk
3550(config-if)#end
3550#show vtp status
VTP Version : 2
Configuration Revision : 2
Maximum VLANs supported locally : 256
Number of existing VLANs : 7
VTP Operating Mode : Server
VTP Domain Name : sy
VTP Pruning Mode : Enabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
SW1:
SW1(config)#int f0/15
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#end
SW1#show vtp status
VTP Version : 2
Configuration Revision : 2
Maximum VLANs supported locally : 256
Number of existing VLANs : 7
VTP Operating Mode : Client
VTP Domain Name : sy
VTP Pruning Mode : Enabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#end
SW1#show vtp status
VTP Version : 2
Configuration Revision : 2
Maximum VLANs supported locally : 256
Number of existing VLANs : 7
VTP Operating Mode : Client
VTP Domain Name : sy
VTP Pruning Mode : Enabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
第三步,端口加入VLAN
SW1:
SW1:
SW1#conf t
SW1(config)#int f0/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 2
SW1(config-if)#exit
SW1(config)#int f0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 3
SW1(config-if)#end
SW1(config)#int f0/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 2
SW1(config-if)#exit
SW1(config)#int f0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 3
SW1(config-if)#end
第四步,配置三层交换,实现VLAN之间互通
3550
3550#conf t
3550(config)#ip routing
3550(config)#int vlan 2
3550(config-if)#ip address 192.168.2.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#exit
3550(config)#int vlan 3
3550(config-if)#ip address 192.168.3.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#end
3550(config)#ip routing
3550(config)#int vlan 2
3550(config-if)#ip address 192.168.2.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#exit
3550(config)#int vlan 3
3550(config-if)#ip address 192.168.3.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#end
第五步,客户机验证
PC1#ping 192.168.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 216/284/336 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 216/284/336 ms
PC2#ping 192.168.2.2
T ype escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 144/211/276 ms
T ype escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 144/211/276 ms
第六步,在三层交换机上启用路由功能
3550:
3550:
3550(config)#int f0/1
3550(config-if)#no switchport
3550(config-if)#ip address 172.16.1.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#exit
3550(config)#int f0/2
3550(config-if)#no switchport
3550(config-if)#ip address 172.16.2.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#exit
3550(config-if)#no switchport
3550(config-if)#ip address 172.16.1.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#exit
3550(config)#int f0/2
3550(config-if)#no switchport
3550(config-if)#ip address 172.16.2.1 255.255.255.0
3550(config-if)#no shutdown
3550(config-if)#exit
第七步,配置两台路由器,并启用HSRP
R1:
R1:
R1(config)#
R1(config)#int f0/0
R1(config-if)#no ip address
R1(config-if)#ip address 172.16.1.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#speed 100
R1(config-if)#duplex full
R1(config-if)#exit
R1(config)#int f1/0
R1(config-if)#ip address 10.0.0.254 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#speed 100
R1(config-if)#duplex full
R1(config-if)#standby 1 ip 10.0.0.252
R1(config-if)#standby 1 priority 200
R1(config-if)#standby 1 preempt
R1(config-if)#standby 1 track f0/0 10
R1(config-if)#end
R1#show standby brief
P indicates configured to preempt.
|
Interface Grp Prio P State Active Standby Virtual IP
Fa1/0 1 200 P Active local 10.0.0.253 10.0.0.252
R1(config)#int f0/0
R1(config-if)#no ip address
R1(config-if)#ip address 172.16.1.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#speed 100
R1(config-if)#duplex full
R1(config-if)#exit
R1(config)#int f1/0
R1(config-if)#ip address 10.0.0.254 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#speed 100
R1(config-if)#duplex full
R1(config-if)#standby 1 ip 10.0.0.252
R1(config-if)#standby 1 priority 200
R1(config-if)#standby 1 preempt
R1(config-if)#standby 1 track f0/0 10
R1(config-if)#end
R1#show standby brief
P indicates configured to preempt.
|
Interface Grp Prio P State Active Standby Virtual IP
Fa1/0 1 200 P Active local 10.0.0.253 10.0.0.252
R2:
R2#conf t
R2(config)#int f0/0
R2(config-if)#ip address 172.16.2.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#speed 100
R2(config-if)#duplex full
R2(config-if)#exit
R2(config)#int f1/0
R2(config-if)#ip address 10.0.0.253 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#speed 100
R2(config-if)#duplex full
R2(config-if)#standby 1 ip 10.0.0.252
R2(config-if)#end
R2(config)#int f0/0
R2(config-if)#ip address 172.16.2.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#speed 100
R2(config-if)#duplex full
R2(config-if)#exit
R2(config)#int f1/0
R2(config-if)#ip address 10.0.0.253 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#speed 100
R2(config-if)#duplex full
R2(config-if)#standby 1 ip 10.0.0.252
R2(config-if)#end
第八步,配置动态路由协议
3550:
3550(config)#router ospf 1
3550(config-router)#network 192.168.2.0 0.0.0.255 area 0
3550(config-router)#network 192.168.3.0 0.0.0.255 area 0
3550(config-router)#network 172.16.1.0 0.0.0.255 area 0
3550(config-router)#network 172.16.2.0 0.0.0.255 area 0
3550(config-router)#end
3550(config-router)#network 192.168.2.0 0.0.0.255 area 0
3550(config-router)#network 192.168.3.0 0.0.0.255 area 0
3550(config-router)#network 172.16.1.0 0.0.0.255 area 0
3550(config-router)#network 172.16.2.0 0.0.0.255 area 0
3550(config-router)#end
R1:
R1(config)#router ospf 2
R1(config-router)#network 172.16.1.0 0.0.0.255 area 0
R1(config-router)#network 10.0.0.0 0.0.0.255 are 0
R1(config-router)#end
R1(config-router)#network 172.16.1.0 0.0.0.255 area 0
R1(config-router)#network 10.0.0.0 0.0.0.255 are 0
R1(config-router)#end
R2:
R2(config)#router ospf 3
R2(config-router)#network 172.16.2.0 0.0.0.255 area 0
R2(config-router)#network 10.0.0.0 0.0.0.255 area 0
R2(config-router)#end
R2#show ip route
R2(config-router)#network 172.16.2.0 0.0.0.255 area 0
R2(config-router)#network 10.0.0.0 0.0.0.255 area 0
R2(config-router)#end
R2#show ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 2 subnets
O 172.16.1.0 [110/2] via 172.16.2.1, 00:03:39, FastEthernet0/0
[110/2] via 10.0.0.254, 00:03:39, FastEthernet1/0
C 172.16.2.0 is directly connected, FastEthernet0/0
10.0.0.0/24 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, FastEthernet1/0
O 192.168.2.0/24 [110/2] via 172.16.2.1, 00:03:39, FastEthernet0/0
O 192.168.3.0/24 [110/2] via 172.16.2.1, 00:03:39, FastEthernet0/0
O 172.16.1.0 [110/2] via 172.16.2.1, 00:03:39, FastEthernet0/0
[110/2] via 10.0.0.254, 00:03:39, FastEthernet1/0
C 172.16.2.0 is directly connected, FastEthernet0/0
10.0.0.0/24 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, FastEthernet1/0
O 192.168.2.0/24 [110/2] via 172.16.2.1, 00:03:39, FastEthernet0/0
O 192.168.3.0/24 [110/2] via 172.16.2.1, 00:03:39, FastEthernet0/0
第九步,客户机验证
PC3#ping 192.168.2.2、
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 288/337/432 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 288/337/432 ms
PC3#ping 192.168.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 240/300/336 ms
Sending 5, 100-byte ICMP Echos to 192.168.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 240/300/336 ms
PC1#ping 192.168.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 192/231/288 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 192/231/288 ms
转载于:https://blog.51cto.com/376369/116801