CISCO3550交換機上聯一臺路由器(擁有互聯網出口),下面連接一臺CISCO29450交換機,在CISCO3550上還對各個VLAN作了定義,CISCO3550交換機的配置如下所示:
Catalyst 3550 (Catalyst 3550-48 Switch)
Cat3550#show running-config
Building configuration...
Current configuration : 3092 bytes
!
version 12.1
no service single-slot-reload-enable
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Cat3550
ip subnet-zero
!--- Enable IP routing for interVLAN routing.(這一步非常重要,通過ip routing命令了實現了各個VLAN間的路由,這樣各個VLAN間是可以互訪的,但是由于每個VLAN都是一個獨立的廣播域,所以即使在一個VLAN中發生諸如ARP地址欺騙之類的病毒,也不會影響其它的VLAN)
ip routing
!
spanning-tree extend system-id
!
interface FastEthernet0/1
no ip address
!
!--- Output suppressed.
!
interface FastEthernet0/5
description to SERVER_1
!--- Configure the server port to be in the server VLAN, VLAN 3.
switchport access vlan 3
!--- Configure the port to be an access port to prevent trunk negotiation delays.
switchport mode access
no ip address
!--- Configure PortFast for initial Spanning Tree Protocol (STP) delay. Refer to
!--- Using PortFast and Other Commands to Fix Workstation Startup Connectivity Delays
!--- for more information. (這里又介紹了一個非常重要的概念,即如果確認交換機下某個端口連接的是一臺重要的服務器,那就可以將該端口設置為“spanning-tree portfast”狀態,從而實現服務器與交換機端口的快速連接)
spanning-tree portfast
!
!--- Output suppressed.
!
interface FastEthernet0/48
description To Internet_Router
!--- The port that connects to the router converts into a routed (L3) port.(fa0/48是上連到一臺路由器)
no switchport
!--- Configure the IP address on this port. (為了實現與路由器的通訊,在端口上設置了IP地址)
ip address 200.1.1.1 255.255.255.252
!
interface GigabitEthernet0/1
description To 2950
!--- Configure IEEE 802.1 (dot1q) trunking, with negotiation, on the L2 switch.
!--- If there is not support for Dynamic Trunking Protocol (DTP) on the far switch,
!--- issue the switchport mode trunk command to force the switch port to trunk mode.
!--- Note: The default trunking mode is dynamic auto. If you establish a trunk link
!--- with the default trunking mode, the trunk does not appear
!--- in the configuration, even though a trunk has been established on
!--- the interface. Use the show interfaces trunk command to verify the
!--- establishment of the trunk.
(G0/1下連到一臺CISCO2950的交換機,其實CISCO3550交換機是支持自動設置為TRUNK模式的,即如果下連的網絡端口被設置為TRUNK模式的話,3550上的對應端口就會自動的變成TRUNK模式,但是本例中為了詳細說明TRUNK的設置,還是把端口封裝802.1Q的命令寫了出來)
switchport trunk encapsulation dot1q
no ip address
!
interface Vlan1
no ip address
shutdown
!
interface Vlan2
description USER_VLAN
!--- This IP address is the default gateway for users. (VLAN2是接入用戶的VLAN,VLAN上設置的IP地址就作為下接用戶的網關,這也是一個非常重要的概念)
ip address 10.1.2.1 255.255.255.0
!
interface Vlan3
description SERVER_VLAN
!--- This IP address is the default gateway for servers. (VLAN3是連接服務器的)
ip address 10.1.3.1 255.255.255.0
!
interface Vlan10
description MANAGEMENT_VLAN
!--- This IP address is the default gateway for other L2 switches. (VLAN10是管理VLAN,下面所連接交換機會以VLAN10的IP作為自己的網關,為管理專門劃分一個VLAN,將管理VLAN與業務VLAN區別開了這也是非常重要的一個概念)。
ip address 10.1.10.1 255.255.255.0
!
ip classless
!--- This route statement allows the 3550 to send Internet traffic to
!--- the default router which, in this case, is the 7200VXR (Fe 0/0 interface). (因為是上連到一臺路由器,所以在這臺交換機上設置了默認路由)
ip route 0.0.0.0 0.0.0.0 200.1.1.2
ip http server
!
line con 0
line vty 5 15
!
end


